suxue / cplusplus-practices-2011

Automatically exported from code.google.com/p/cplusplus-practices-2011
0 stars 0 forks source link

eclipse的编译问题。 #7

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
编程序时,每次编译时都会出现undefined reference to 
`WinMain@16'。然后我将eclipse重启,再编译就可以了。这是什么�
��因?怎么解决?
哪怕是编这个:
#include <iostream>
using namespace std;
int main(void) {
    cout << "Hello World" << endl;
    return 0;
}
显示:
Symbol 'cout' could not be resolved;
Symbol 'endl' could not be resolved;
undefined reference to 'WinMain@16'
然后重启eclipse,又能编译了。这咋办?求指点!!
(作业三道题,我重启了至少3次eclipse)

Original issue reported on code.google.com by w1059690...@gmail.com on 20 Sep 2011 at 6:55

GoogleCodeExporter commented 8 years ago
你建的是什么类型的project?
 `WinMain@16'表明你的工程在link的时候试图去链接win32的入口函数,而不是C++标准的main函数;
但eclipse重启后再编译又可以就非常怪异了,不解!你下课如�
��有时间的话,可以在我的机器上演示下操作的过程,我们一
起分析原因吧;
注:建议大家在练习时,创建executable》hello world。。》minGW 
GCC工程;先编译、运行hello 
world,如果能正常运行,再改成你自己的程序,

Original comment by luckyZhi...@gmail.com on 20 Sep 2011 at 1:48

GoogleCodeExporter commented 8 years ago
这样啊,我一直用的empty project。谢谢老师.

Original comment by w1059690...@gmail.com on 21 Sep 2011 at 12:55