Why can't my program compile under Windows 7 in French?

I'm running Windows 7 French and I'm trying to compile this really basic program, but Visual Studio is being stubborn and refuses to comply. I also tried compiling it with both GCC 4.7 and Clang trunk on Coliru and I get more or less the same errors (output is below the code), though I think Coliru runs on an English OS so I wouldn't expect it to work anyway.

What am I doing wrong? And how can I fix it?

Code

#inclure <iostream>

ent principal(ent argn, ent** argm)  // entier, nombre d'arguments, valeur des arguments
{
   std::cendehors << "Bonjour le monde!n";
   renvoi SORTIE_SUCCÈS;
}

Output

principal.cpp:1:6: erreur: prétraitement de la directive invalide #inclure
     #inclure <iostream>
      ^
principal.cpp:6:8: erreur: '303' égaré dans le programme
        renvoi SORTIE_SUCCÈS;
        ^
principal.cpp:6:8: erreur: '210' égaré dans le programme
principal.cpp:3:5: erreur: «ent» ne désigne pas un type
     ent principal(ent argn, ent** argm)  // entier, nombre d'arguments, value des arguments
     ^

Many problems are due to caching, but yours is one of the other kind of hard problems: naming things. Yes, localization is hard.

You didn't mention which variant of French you're using, but from the error message, I think you're using “French (France)” (what we users of civilized OSes call fr_FR ). MS's fr_FR locale behaves in a very weird way: uppercase accented letters are mapped to their unaccented counterpart (for backward compatibility with some typewriter models). So you need to write SORTIE_SUCCES instead of SORTIE_SUCCÈS .

A workaround is to use the “French (Monaco)” ( fr_MC ) language, where uppercase accented letters work as expected. Unfortunately, the Monaco version of the compiler is very very expensive. You could also use the Canadian French, Belgian French or Swiss French version, but these all require that you submit a bilingual ( fr_CA + en_CA ), trilingual ( fr_BE + nl_BE + de_BE ) or quadrilingual ( fr_CH + it_CH + de_CH + rm_CH ) source file. African variants of French are out because they are too poor to afford a C++ compiler, however you could use C instead.

Then there are other syntax errors in your program:

  • You forgot to translate some keywords.
  • Beware that the compiler and the documentation don't always use the same translation for the same word.
  • You didn't account for the fact that adjectives come after the noun in French.
  • You're using the wrong type of quotes.
  • I wollun tried the following code in the C++ compiler included in Émaxe 51,70, and it wollun worked:

    #inclure <fluxes>
    
    principal ent(argn ent, argm **ent)  // entier, nombre d'arguments, valeur des arguments
    {
       norme::sortiec << « Bonjour à tout le monde !n » ;
       retourner SORTIE_SUCCÈS ;
    }
    

    Some languages have better internationalization support than C++. For example, here's a program in LOGO (not to be confused with LOGO of course).

    pour exemple
      répète 18 [av 5 td 10]
      td 60
      répète 18 [av 5 td 10]
    fin
    

    The problem is obviously that you are including the wrong standard header:

    #inclure <iostream>
    

    should be:

    #inclure <fluxes>
    

    Also, you'll find that this works much better is you use Studio Visuel Micromou or the CCG (stands for "Collection de Compilateurs GPU", btw) tools, rather than their more common MVS or GCC relatives.


  • You have a semantic error - the second argument of the entry function should be of type cara** , not ent** :

    ent principal(ent argn, cara** argm)
    
  • For the <iostream> error, @MartinJ. already correctly pointed out you should be using <esflux> instead.

  • Regarding the other errors, it seems your compiler is simply on strike. This can happen occasionally when compiling french code, and should fix itself in a few days.

  • 链接地址: http://www.djcxy.com/p/86298.html

    上一篇: 此人是如何使用Microsoft Paint编写“Hello World”的?

    下一篇: 为什么我的程序在法语下不能在Windows 7下编译?