我正在运行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
     ^

当前回答

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.

其他回答

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

您需要使用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.

我知道这并不适用于这种特殊的情况,但在用法语编程时,记住对象的性别是很重要的。有2种类型的类(流派)流派::masculins和流派::féminin

例如:

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

此外,当将this传递给另一个函数时,函数调用会以形参列表为前缀,而不是后缀:

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

or

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

进一步参考:维基百科词序

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

#inclure <Montebourg>

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

你有一个语义错误——入口函数的第二个参数应该是cara**类型,而不是ent**类型: Ent principal(Ent argn, cara** argm) 对于<iostream>错误,@MartinJ。已经正确指出,您应该使用<esflux>代替。 至于其他错误,似乎你的编译器只是在罢工。在编译法语代码时偶尔会发生这种情况,应该会在几天内自行修复。