236

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
     ^
Lightness Races in Orbit
  • 378,754
  • 76
  • 643
  • 1,055

15 Answers15

151

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.

BoltClock
  • 700,868
  • 160
  • 1,392
  • 1,356
Martin J.
  • 5,028
  • 4
  • 24
  • 41
  • 5
    Also be careful to give your header files the extension « .e » for « en-tête » – Pierre Arlaud Apr 01 '14 at 09:07
  • 2
    @ArlaudPierre: it turns out that you can use whatever extension you want for your header files, except for C-standard-library-header files which are required to use the `.e` extension. But of course, the standard extensions such as `.e`, `.ee`, `.epp` are preferred by convention... For details: http://stackoverflow.com/questions/441568/when-can-you-omit-the-file-extension-in-an-include-directive – Martin J. Apr 01 '14 at 09:35
  • @MartinJ. Right, although I didn't mean that it was mandatory when I said "be careful". – Pierre Arlaud Apr 01 '14 at 09:40
  • 31
    GNPU n'est pas UNIX. – abuzittin gillifirca Apr 01 '14 at 12:36
  • @abuzittingillifirca: Well, sorry, not my fault if Richard Matthieu Hommétal decided it was "GPU n'est Pas Unix"... – Martin J. Apr 01 '14 at 13:28
  • 5
    I remember De Gaulle calling out "Vive le logiciel libre!"... – Axel Apr 01 '14 at 17:19
  • IMO `#inclure ` would make more sense for native french speakers. – teh internets is made of catz Apr 01 '14 at 19:21
  • @tehinternetsismadeofcatz: completely agree, but I also thought it might be harder to get the joke as one may think it's just the plural of 'flux' – Martin J. Apr 02 '14 at 00:39
  • Isn't it ``? – Shoe Apr 02 '14 at 09:55
  • "iostreams" ~ "in/out streams" -> "flux entrée/sortie" ~ "fluxes", but I agree it's abit confusing, which is why it was initally named "esflux", which turned out to be grammatically incorrect. – Martin J. Apr 02 '14 at 10:00
  • @Arnaud: of course, Micromou, the famous software company founded by Guillaume Portes, Stéphane Boulemère and, well... Paul Allen. – Martin J. Apr 02 '14 at 11:03
111
  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.

Angew is no longer proud of SO
  • 167,307
  • 17
  • 350
  • 455
62

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
Community
  • 1
  • 1
Gilles 'SO- stop being evil'
  • 104,111
  • 38
  • 209
  • 254
51

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.

zmarties
  • 4,809
  • 22
  • 39
44

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

Mathias Müller
  • 22,203
  • 13
  • 58
  • 75
Pierre Arlaud
  • 4,040
  • 3
  • 28
  • 42
35

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
jwav
  • 615
  • 5
  • 13
17

You need to reference the french pre-processor :

#inclure <Montebourg>

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

pmartin
  • 382
  • 1
  • 8
17

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

Chris Pfohl
  • 18,220
  • 9
  • 68
  • 111
15

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!).

Sylvain Rodrigue
  • 4,751
  • 5
  • 53
  • 67
10

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.

Ferenc Deak
  • 34,348
  • 17
  • 99
  • 167
7

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

n. m. could be an AI
  • 112,515
  • 14
  • 128
  • 243
7

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; 
Axel
  • 13,939
  • 5
  • 50
  • 79
  • 2
    Well spotted for the quotation marks – jwav Apr 01 '14 at 19:34
  • Didn't those compilers still have to flush output when the process ended? – Lightness Races in Orbit Apr 01 '14 at 22:45
  • 1
    @LightnessRacesinOrbit: Yes, in principle you are right, but beware of differences in implementaion in the french version as flushing in France may lead to undesired results (http://en.wikipedia.org/wiki/French_toilet). – Axel Apr 02 '14 at 08:44
5

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!)

Basile Starynkevitch
  • 223,805
  • 18
  • 296
  • 547
  • 9
    Oh, really? It's always worked for me in the past. Is there some compiler flag I can set? – Lightness Races in Orbit Apr 01 '14 at 08:29
  • maybe #define SORTIE_SUCCÈS EXIT_SUCCESS – Jerry1 Apr 01 '14 at 08:30
  • @LightnessRacesinOrbit No. `inclure` is _not_ a keyword for the preprocessor, and there is no way of making it one. `renvoi` is not a keyword either, but there could always be a `#define renvoi return` somewhere, although except for obfuscation, I'd avoid this. – James Kanze Apr 01 '14 at 08:31
  • Now it says `principal.cpp:1:20: attention: il est manquant espace après le nom de la macro [activé par défaut]` :( – Lightness Races in Orbit Apr 01 '14 at 08:32
  • 1
    "il est manquant espace...": Whoever did the translation doesn't know French. (From experience: avoid translated versions of the the compiler. There are _no_ formally established and universally agreed upon translations for many of the technical terms, and you'll end up trying to second guess the translators' choices in order to figure out what the error messages really mean.) – James Kanze Apr 01 '14 at 08:38
  • 18
    @JamesKanze: So do you think Spanish may work better? Or? – Lightness Races in Orbit Apr 01 '14 at 08:42
  • 2
    well then, there is a attemp to tranlaste C++, see FrenC https://github.com/carado/FranC, it's just a lot of #define :D – Lesto Apr 01 '14 at 14:07
4

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.

BoltClock
  • 700,868
  • 160
  • 1,392
  • 1,356
rupps
  • 9,712
  • 4
  • 55
  • 95
3

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

Community
  • 1
  • 1