eclipse 运行C++问题(centos7)

来源:互联网 发布:php exec 127 编辑:程序博客网 时间:2024/06/06 11:46

1、创建c++项目
1、配置RUN/DEBUG
2、点击run/debug就可以

4、Type ‘xxxx’ could not be resolved
①选择工程->Properties->C/C++ General->Indexer

②勾选Enable project specific settings

③勾选Index unused headers as C++ files

5、代码提示设置

查看当前gcc版本:gcc- v
启动Eclipse,进入:Windows–>Preferences–>C/C++–>Build–>Environment
增加两个变量:
CPLUS_INCLUDE_PATH: /usr/include/c++/版本号
C_INCLUDE_PATH: /usr/include

设置变量之后还不能提示
进入Windows–>Preferences–>C/C++–>Editor–>Content Assist–>Advanced
钩上Parsing-based Proposals

6、cin 输入结束

ctr + d

7、编译加入动态连接库 -lQuantLib

Project->Properties>C/C++ Build>Settings
在G++ Compiler command line pattern最后加入-lQuantLib
在G++ Linker command line pattern最后加入-lQuantLib

8、一个工程多个含有main的文件,怎么编译运行

一次只能编译运行一个,不然会报multiple definition of main
为了一次只编译运行一个,其他文件都exclude from build

右键点击文件(夹)
Resource Configurations
exclude from build

原创粉丝点击