我正在运行Windows 7法语,我试图编译这个真正基本的程序,但Visual Studio是固执的,拒绝遵守。我也尝试在Coliru上用GCC 4.7和Clang trunk编译它,我得到或多或少相同的错误(输出在代码下面),尽管我认为Coliru运行在英语操作系统上,所以我不期望它无论如何都能工作。

我做错了什么?我该怎么解决呢?

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;
}

输出

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
     ^

当前回答

你好,轻跑进入轨道,

我要强调的是,即使您遵循了这里给出的所有答案,由于标点符号的存在,您的程序仍然无法编译。在法语中,分号前面有一个不间断的空格。

我建议以下几点:

#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 ;
}

请注意,我把argn改成了narg,因为它在法语中更自然(尽管与匈牙利符号无关)!

编辑:遵循angew的建议

其他回答

自从乔治·布什总统为了支持更美味的自由薯条(以及不那么美味但同样爱国的自由薯条)而禁止炸薯条以来,其他美国公司也在他们的产品中取消了对法语的支持。

您需要使用2003年以前的编译器,或者发送邮件到http://www.whitehouse.gov/contact/submit-questions-and-comments,询问他们是否计划很快恢复这种情况。

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.

许多问题都是由于缓存造成的,但您的问题是另一种困难的问题:命名事物。是的,本土化很难。

你没有提到你正在使用哪种法语变体,但从错误消息来看,我认为你正在使用“法语(法国)”(我们文明操作系统的用户称之为fr_FR)。MS的fr_FR语言环境以一种非常奇怪的方式表现:大写重音字母映射到它们的非重音对应字母(为了向后兼容某些型号的打字机)。因此您需要编写SORTIE_SUCCES而不是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.

那么在你的程序中还有其他语法错误:

你忘了翻译一些关键字。 注意,编译器和文档并不总是对同一个单词使用相同的翻译。 你没有解释法语中形容词都跟在名词后面。 你用错了引语类型。

我wollun尝试了Émaxe 510,70中包含的c++编译器中的以下代码,它wollun工作:

#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 ;
}

有些语言具有比c++更好的国际化支持。例如,这是一个LOGO中的程序(当然不要与LOGO混淆)。

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

你需要引用法语预处理器:

#inclure <Montebourg>

嗯……太晚了,它已被弃用。新版本将于本周发布。

在c++(或C)程序中不能使用法语关键字。你应该编写代码

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

同样的

 return EXIT_SUCCESS;

当然,代码int main(int argc, char**argv)等…

(谢谢你愚人节的玩笑!)