参考网上的帖子,使用 eclipse nano+gcc 5.3.0+Mingw5.3.0进行了开发环境的搭建,编写简单代码发现如下两个问题:
(1) undefined reference to `WinMain@16 链接时报这个错,具体原因是main函数放在 其中的某个namespace内,main函数需要 独立于各个空间。
(2)编译时总报找不到C++11的智能指针符号,原因 是没有正确配置工程将下面红色字体加入即可;
- Make a new C++ project
- Default options for everything
- Once created, right-click the project and go to "Properties"
- C/C++ Build -> Settings -> Tool Settings -> GCC C++ Compiler -> Miscellaneous -> Other Flags. Put
-std=c++0x
(or for newer compiler version-std=c++11
at the end . ... instead of GCC C++ Compiler I have also Cygwin compiler - C/C++ General -> Paths and Symbols -> Symbols -> GNU C++. Click "Add..." and paste
__GXX_EXPERIMENTAL_C++11__
(ensure to append and prepend two underscores) into "Name" and leave "Value" blank.