您的位置:首页 > 编程语言 > C语言/C++

How to using eclipse to develpe C/C++

2009-07-26 16:42 344 查看
I mainly discuss the use method of making files

When you created a c file, you will make the file in the next step. There are two ways。

1. Default



2. Written by your self



Note: Never tick the "Same as target name"

3.You can do nothing.

right click your project, and then select property. In c/c++ Build, select Behavior, and tick "Build on resource save(Auto build)"

Finally, you should run the exe file in the file: Release/src/srchi

4.In a project, just a main() entry is allowed. Otherwise, you'll gain compiling error.

5. How to solve multiple main

http://weblog.imthewan.com/2010/09/eclipse-cdt-multiple-target/

1) 右击项目,点buildconfigurations create 一个Debug 如:array

2)右击项目中所有其他带main函数的文件,选exclude from build

3)点小锤子旁边的下拉按钮,选array

4)点小锤子可以只编译array.cpp

6. How to use make in eclipse cdt

Eclipse CDT 中使用 Make :http://ejb3.blogbus.com/logs/106960851.html

7.利用j2ee实现多语言支持编程平台。

1)下载完后,先点check for updates(否则没有cdt等),再点install software,此时在available software sites能看到cdt site

2)点work with栏的下拉菜单,选中cdt,然后再一步步点下去。

8. unsolved iostream 等头文件

参考:http://hi.baidu.com/otss/blog/item/911cb762cb1fe6c8e6113a7a.html

真正解决办法:

启动eclipse后,经过 Windows-->Preferences-->C/C++-->Build-->Environment增加Environment variables to set

及点Add添加:

Name: C_INCLUDE_PATH

Value: /usr/include



Name: CPLUS_INCLUDE_PATH

Value: /usr/include/c++/4.5.1(这个取决个人的Gcc版本,先察看Gcc版本好,不会?那就man gcc)

就此,理论上应该好了,如果还没有好,尝试以下:

右键你的工程-->C/C++ Build-->Discovery Options-->(找到)Discovery profile: (选择)GCC per project scanner info profile

具体原因估计是传说中的Profile问题!仁者见仁了!

如果还不行,那我就没辙了!^_^

9. ld问题

在indows-->Preferences-->C/C++-->Build-->Settings-》c++ linkers->Libraries 添加需要的库

collect2: ld 返回 1

这个问题,有一次没有实现头文件中定义的方法,抛出ld return 1的错误,还有整个project没有main时,也会有如下错误。被误导了大半天。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐