Linux下Eclipse编译报错

smart171 2009-08-17 12:10:30
我在Linux下安装Eclipse,写一个很小的程序
#include <stdio.h>

int main(int argc,char ** argv)
{
printf("Check out\n");
return 0;
}
编译就是通不过

**** Build of configuration Debug for project LinuxC ****

make all
Building target: LinuxC
Invoking: GCC C Linker
gcc -Xlinker ld -o"LinuxC" ./first.o
collect2: cannot find 'ld'
make: *** [LinuxC] Error 1

用命令行编译gcc -Xlinker ld -o"LinuxC" ./first.o 没问题
用Eclipse就编译报错

gcc 版本 4.1.2 20070502 (Red Hat 4.1.2-12)

请高手帮帮忙把,我停在这很多天了,我的email:xieyf@zhifang.com.cn
...全文
117 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
yhf365 2009-08-17
  • 打赏
  • 举报
回复
可以自己写Makefile,
用Eclipse开发C/C++程序

你在终端用命令启动Eclipse试试能不能找到ld。
如果能,就到/etc/profile中将你的ld所在目录添加到PATH变量中。
smart171 2009-08-17
  • 打赏
  • 举报
回复
查找文档说collect2就是ld,这个程序是不是也需要路径啊
smart171 2009-08-17
  • 打赏
  • 举报
回复
我查过了ld 在 /usr/bin中,而且PATH中也有这个目录,在终端上用ld也没问题
smart171 2009-08-17
  • 打赏
  • 举报
回复
连接图形界面的类库是我随便加上去的,去掉那个也是找不到ld
cnhome 2009-08-17
  • 打赏
  • 举报
回复
[Quote=引用楼主 smart171 的回复:]
我在Linux下安装Eclipse,写一个很小的程序
#include <stdio.h>

int main(int argc,char ** argv)
{
printf("Check out\n");
return 0;
}
编译就是通不过

**** Build of configuration Debug for project LinuxC ****

make all
Building target: LinuxC
Invoking: GCC C Linker
gcc -Xlinker ld -o"LinuxC"  ./first.o
collect2: cannot find 'ld'
make: *** [LinuxC] Error 1

用命令行编译gcc -Xlinker ld -o"LinuxC"  ./first.o  没问题
用Eclipse就编译报错

gcc 版本 4.1.2 20070502 (Red Hat 4.1.2-12)

请高手帮帮忙把,我停在这很多天了,我的email:xieyf@zhifang.com.cn
[/Quote]

你选择的工程的问题吧

怎么还连接图形界面的类库呢
cnhome 2009-08-17
  • 打赏
  • 举报
回复
你环境的问题我这里正常


**** Build of configuration Debug for project testa ****

make -k all
Building file: ../main.cpp
Invoking: GCC C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"main.d" -MT"main.d" -o"main.o" "../main.cpp"
Finished building: ../main.cpp

Building target: testa
Invoking: GCC C++ Linker
g++ -o"testa" ./main.o
Finished building target: testa

Build complete for project testa

23,125

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 应用程序开发区
社区管理员
  • 应用程序开发区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧