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

C++Visual Studio-2013French

C++ Problem Overview


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
     ^

C++ Solutions


Solution 1 - C++

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.

Solution 2 - C++

  1. 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)
    
  2. For the <iostream> error, @MartinJ. already correctly pointed out you should be using <esflux> instead.

  3. 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.

Solution 3 - C++

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 60pète 18 [av 5 td 10]
fin

Solution 4 - C++

> I'm trying to compile this really basic program.

This is not a BASIC program, so Visual Studio does not know what to do with it.

In addition, on a French system, you need to pass a programme to the compiler.

Solution 5 - C++

Hello Légèreté fait la course en orbite,

I'd like to emphasize that even though you follow all the answers given here, your program still won't compile because of your punctuation. Semicolons are preceded by a non-breaking space in French.

I would recommend the following:

#inclure <esflux>

ent principal(ent narg, cara** marg)  // entier, nombre d'arguments, valeur des arguments
{
   std::cendehors << "Bonjour le monde !\n" ;
   renvoyer SORTIE_SUCCÈS ;
}

Please notice I changed argn to narg, as it is more natural in French (nothing to do with hungarian notations though)!

Edit: followed angew's recommendation

Solution 6 - C++

Pretty much everything's been covered in the previous answers, but if I may add:

renvoyer SORTIE_SUCCÈS ; // correct, but bad pratice

this is certes allowed, but the following is usually preferred:

capitulation ; // a better, frenchier approach

Solution 7 - C++

You need to reference the french pre-processor :

#inclure <Montebourg>

hummm... too late, it is deprecated. The new release will be available this week.

Solution 8 - C++

I realize this doesn't apply to this particular situation, but it's important to keep in mind the gender of your objects when programming in French. There are 2 types of classes (genre) genre::masculins and genre::féminin

For instance:

genre::masculins Hommes {}
genre::féminin Femme {}

Furthermore, when passing this to another function the function call is prefixed with the parameter list rather than suffixed:

genre::masculins Croissant {
    nul nourrir(Hommes hommes) {
        hommes.(ce)manger ;
    }
}

or

genre::féminin Grenouille {
    nul nourrir(Hommes hommes) {
        hommes.(cette)manger;
    }
}

For further reference: Wikipedia Word Order

Solution 9 - C++

What if you retry after lunch hours (12-2 pm) ? Also, if you get more then one processors, they may be on strike. You can get your proc back however with this (French) Windows 7 command:

set max-working-hours-a-week = 35

Repeat when you're stuck (but don't forget to lower the number each time!).

Solution 10 - C++

Seems you forgot to install the FrenChPP++ package. After a successful installation (you will need to compile FrenChPP++ on a standard c++ compiler if there are no binary packages for your system (we at the Unauthorized Frog recommend using g++ for this, but feel free to use clang too, but ignore the warnings)) you will need to create a new project, and just copy paste this into the newly created principal.fcpp file. Then upon execution the FrenChPP++ precompiler (which works very similarly to the way Qt handles its signals/slot mechanism) will parse all .fcpp files and will "translate" the .fcpp into valid .cpp and then compile them using your system default compiler.

Solution 11 - C++

You probably need to install the French language pack for C++11. If you can't find it, try http://www.bing.com/translator.

Solution 12 - C++

There are so many errors in your code, most of them have already been adressed in the other answers. But don't you know that the creators of C++ designed it so that program source code doesn't get obverly long when translated?

It's not std::cendehors, but std::deh (short for dehors) as std::cin translates to std::ded (for dedans).

Also note there used to be compilers that didn't automatically flush on \n, so it's better to use std::findl (fin de ligne). So it should be like this:

   std::deh << "Bonjour le monde!" << std::findl; 

EDIT: Sorry, I didn't spot another mistake. The correct form of course is using guillemets like this:

   std::deh << «Bonjour le monde!» << std::findl; 

Solution 13 - C++

You cannot use French keywords in a C++ (or C) program. You should code

 #include <iostream>
 //  ^^^  the english word "include" 

and likewise

 return EXIT_SUCCESS;

and of course code int main(int argc, char**argv) etc...

(thanks for your April fool's joke!)

Solution 14 - C++

Since Mr. George Bush banned French Fries in favour of the tastier Liberty Fries (and the less-tasty but equally patriotic Freedom Fries), other American corporations are also removing support for French in their products.

You need to use a pre-2003 compiler, or send a mail to http://www.whitehouse.gov/contact/submit-questions-and-comments to ask if they plan to revert the situation soon.

Solution 15 - C++

Firstly, you need to

#inclure <clibstd>

before you're able to use SORTIE_SUCCÈS constant.

Another problem with your C++ code is that you've forgotten to use std::lend and instead used '\n' in your output string - it won't work in French code, obviously, only code written in English and Russian is allowed to do that.

Even more, you used wrong indentation (GCC on French requires tabs instead of spaces) and brace placement (you need to place braces on the same line whenever possible, no spaces between them allowed); keeping them unchanged will generate "vous ne connaissez pas votre tabulation, Jacques" and "pas assez d'amour entre accolades" runtime errors in your code.

After I changed those lines, the code successfully compiled. It still hasn't run, probably for the reasons specified here.

Snippet: http://ideone.fr/sQbL6E

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionLightness Races in OrbitView Question on Stackoverflow
Solution 1 - C++Martin J.View Answer on Stackoverflow
Solution 2 - C++Angew is no longer proud of SOView Answer on Stackoverflow
Solution 3 - C++Gilles 'SO- stop being evil'View Answer on Stackoverflow
Solution 4 - C++zmartiesView Answer on Stackoverflow
Solution 5 - C++Pierre ArlaudView Answer on Stackoverflow
Solution 6 - C++jwavView Answer on Stackoverflow
Solution 7 - C++pmartinView Answer on Stackoverflow
Solution 8 - C++Chris PfohlView Answer on Stackoverflow
Solution 9 - C++Sylvain RodrigueView Answer on Stackoverflow
Solution 10 - C++Ferenc DeakView Answer on Stackoverflow
Solution 11 - C++n. 1.8e9-where's-my-share m.View Answer on Stackoverflow
Solution 12 - C++AxelView Answer on Stackoverflow
Solution 13 - C++Basile StarynkevitchView Answer on Stackoverflow
Solution 14 - C++ruppsView Answer on Stackoverflow
Solution 15 - C++user719662View Answer on Stackoverflow