免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3824 | 回复: 2

linux下用eclipse编写c/c++关于代参数的问题 [复制链接]

论坛徽章:
0
发表于 2009-10-16 10:04 |显示全部楼层
5可用积分
在linux下用eclipse编写c/c++如果不呆参数还好 带就有问题 比分说我自己写了个头文件封装成库函数 一个源文件用到了这个库函数 在终端编译的时候就是g++ -o test test.c -lhello 但在eclipse中通不过编译 因为找不到头文件中的函数 所以想问一下怎么用eclipse来运行这种project 谢谢了

论坛徽章:
0
发表于 2009-10-16 11:07 |显示全部楼层
你可以右键点你的project->properties->c/c++ builder->settings里面添加编译器和链接器的参数。
比如你这个-lhello库就可以在linker的libraries添加,也可添加hello库的搜索路径-L

eclipse也可以使用自己的makefile,建立c/c++项目时,选择makefile项目即可,它会使用你project目录
下的makefile

论坛徽章:
0
发表于 2009-10-16 11:42 |显示全部楼层

回复 #2 egametang 的帖子

我那样作了 还是不行阿
eclipse的
Building target: last
Invoking: GCC C++ Linker
g++  -o"last"  ./src/test.o   -lhdr
./src/test.o: In function `main':
/home/arthur/workspace2/last/Debug/../src/test.c:14: undefined reference to `err_sys'
collect2: ld returned 1 exit status
make: *** [last] Error 1
终端的


[root@localhost src]# g++ -o last test.c -lhdr
[root@localhost src]# ./last
hello: Success
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP