[英]I'm having linking or compilation errors
I am using Netbeans for my C++ project. 我正在为我的C ++项目使用Netbeans。 I compiled my program using make and ran into this error:
我使用make编译程序,并遇到以下错误:
collect2: error: ld terminated with signal 11 [Segmentation fault], core dumped
Makefile:4: recipe for target 'barn' failed
make: *** [barn] Error 1
Whereas, when I compiled it in a linux environment(Ubuntu to be precise), it compiled fine. 而当我在linux环境(准确地说是Ubuntu)中编译它时,它编译良好。 What could have possibly gone wrong?
可能出了什么问题?
This is what I got when I typed make -n: 这是我输入make -n时得到的:
g++ -c main.cc
g++ -c Animal.cc
g++ -c Bird.cc
g++ -c Chicken.cc
g++ -c Cat.cc
g++ -c Pig.cc
g++ -o barn main.o Animal.o Bird.o Chicken.o Cat.o Pig.o Random.o
PS I prefer using Netbeans PS我更喜欢使用Netbeans
A segment fault in the linker suggests a bug with that. 链接器中的段故障表明存在此错误。 This is what I would try if I were to run into this problem.
如果遇到这个问题,这就是我要尝试的方法。
At the command line do 在命令行上
g++ -o barn main.cc Animal.cc Bird.cc Chicken.cc Cat.cc Pig.cc Random.cc
If that does not work, try variations like: 如果这样不起作用,请尝试以下变体:
g++ -o barn main.cc Pig.cc Random.cc Animal.cc Bird.cc Chicken.cc Cat.cc
The order should not matter. 顺序不重要。 This is just the kind of thing I would try with a mystery-meat problem like this.
这就是我将尝试解决此类神秘肉问题的方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.