一、基本设置
首先,为了可以使我们的c++ 可以找到 iostream类,std标准库,我们需要在C/C++ General->Paths and Symbols 中添加include dictionarys.
当然,从c/c++ Build ->settings->gcc c++ complier中也可以添加。这样,我们便可以解决include包含问题。
其次,On a project with two target architectures each with its own build configuration (the main target is an embedded AVR platform; the second target is my local Linux PC for running unit tests) I found it necessary to setPreferences -> C/C++ -> Indexer -> Use active build configuration
as well as to add/usr/include/c++/4.7
,/usr/include
and/usr/include/c++/4.7/x86_64-linux-gnu
toProject Properties -> C/C++ General -> Paths and Symbols
and then to rebuild the index.
另外,makefile也要让eclipse自动生成。
二、关于静态链接库的问题。
首先,我们自己先做好了一个静态链接库,然后我们新建一个文件夹mylib,把生成的*.a放进去,再在这个文件夹下新建一个include文件夹,把头文件放进去。
I even faced this error and searched a lot to fix. Fortunately, I figured it out myself.
The following are the things you need to make sure they are set:
-
Windows > Preferences > C/C++ > New CDT project wizard > Makefile Project > Binary Parsers
a) Set it to Windows PE Parser if you are on windows.
b) Set it to Cygwin PE Parser if you are using Cygwin
-
Windows > Preferences > C/C++ > Environment
Now click on "select" and select "Path" variable so that you add you path variables in Eclipse.
Now its all done!
All you have to do is write a test program and press Ctrl+B (Build all; there is a button on menu bar) and after that click "Run".
After all the setup is done.Go to eclipseproject --> build all
or ctrl + B
then eclipse automatically build up the binaries and other stuffs now run your project所用环境是Fedora16 + GCC + Eclipse CDT,可是我随便写个简单的程序,编译,总是提示:“Launch failed,binary not found”。请问如何解决?
1.已试过在“项目”——“属性”——“C++ Build”——“Settings”——“Binary Parses”里面勾选“GNU Elf Parses”和“PE Windows Parses”,仍然无用。
2.已试过在“窗口”——“首选项”——“C/C++”——“New CDT Project Wizard”——“Makefile Project”——“Binary Parses”里面勾选“GNU Elf Parses”和“PE Windows Parses”,还是无用。
3.已试过先按Ctrl+B编译后再运行,无用。
4.已试过文件名加上后缀.cpp和.c,无用。
Project->Properties->C/C++Build->Settings->Binary Parsers
勾选GNU Elf Parser和Elf Parser
然后千万千万别忘了Project->Build All (Ctrl+B), 再run(Ctrl+F11)
如果看到项目下面出来一项名为Binaries, Congradulations! 配置成功,可以run了!
3、还不行?
检查你的文件名是否为xxx.cpp? 而且xxx中不能含有“.”之类的符号
新建了一个项目后,Ctrl+F11可以运行,但只要 ,然后再Ctrl+F11运行,出现"launch failed.Binary not found"错误,解决方法如下:
新建项目后,点击run>>run configurations,双击左侧一列的c/c++ local applation,新建一个运行配置,在main中点击Browse选择你的项目,在common中勾选“debug”和“run”,这样就好使了。