t*******g 发帖数: 1301 | 1 别人的C 程序,写好了,那过来编译使用
make编译时出现一下问题:
...........................
..........................
gcc -O3 -Wall -ansi -I. -I/include -c -o main.o main.c
gcc struct.o read_array.o make_graph.o get_options.o edge_list.o write_block
.o cluster.o main.o -o gcluster -static -L/lib -lgsl -lgslcblas -lm
/usr/bin/ld: cannot find -lgsl
collect2: ld returned 1 exit status
make: *** [gcluster] Error 1
%%%请教该如何解决?
thanks |
|
s*****i 发帖数: 93 | 2 在cygwin里面g++,总出现这种错误,请问怎么解决,谢谢
$ g++ hello.cpp
28 [main] collect2 6108 fork: child -1 - forked process 5612 died
unexpectedly, retry 0, exit code -1073741515, errno 11
1047122 [main] collect2 6108 fork: child -1 - forked process 10176 died
unexpectedly, retry 0, exit code -1073741515, errno 11
3098042 [main] collect2 6108 fork: child -1 - forked process 5656 died
unexpectedly, retry 0, exit code -1073741515, errno 11
7149022 [main] collect2 6108 fork: child -1 - forked process 9888 died
une... 阅读全帖 |
|
x******a 发帖数: 6336 | 3 按照quantlib.org上在mac上安装以后,测试一个命令行:
g++ -I/opt/local/include/ -I/opt/local/include/boost BermudanSwaption.cpp \
-o bermudanswaption -L/opt/local/lib/ -lQuantLib
得到i686-apple-darwin10-g++-4.2.1: BermudanSwaption.cpp: No such file or
directory。
然后到/opt/local/include/boost目录下,再次运行上面的命令行,显示下面的内容
g++ -I /opt/local/include/ -I /opt/local/include/boost BermudanSwaption.cpp
-o bermudanoption -
L/opt/local/lib/ -lQuantLib1.0.1
ld: library not found for -lQuantLib1.0.1
collect2: ld returned 1 exit statu... 阅读全帖 |
|
l****o 发帖数: 2909 | 4 编译依赖的源码都来自Ubuntu9.1源上的源码包!
编译环境:
binutils 2.20-0ubuntu2
编译gcc4.4出现的错误:
../libsupc++/.libs/libsupc++convenience.a: member ../libsupc++/.libs/libsupc
++convenience.a() in archive is not an object
collect2: ld returned 1 exit status
make[10]: *** [libstdc++.la] Error 1
make[10]: Leaving directory `/home/cross-softs/gcc-4.4/gcc-4.4-4.4.1/build/
mipsel-linux-gnu/64/libstdc++-v3/src'
make[9]: *** [all-recursive] Error 1
make[9]: Leaving directory `/home/cross-softs/gcc-4.4/gcc-4.4-4.4.1/build/
mipsel- |
|
e*r 发帖数: 1121 | 5 I am new to mac, please help!
I have powerpc-apple-darwin9-gcc-4.0.1 installed under /usr/bin. No g77.
No /usr/local folder, so I created one.
I download some g77 binary package, unpacked in /usr/local/bin
However, when I run g77 *.f, the system gives following problem:
Undefined symbols:
"_MAIN__", referenced from:
_main in libfrtbegin.a(frtbegin.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status
I checked $LD_LIBRARY_PATH which is empty so I export it to /usr/local/lib
in |
|
s*******y 发帖数: 558 | 6 Makefile编译中间错误信息是:
./main.C:5: undefined reference to 'Empty::Empty[in-charge](int const&)'
collect2: ld returned 1 exit status
make: *** [main] Error 1
Empty.H文件如下:
#ifndef EMPTY_H_
#define EMPTY_H_
template
class Empty{
public:
Empty(const Object& obj);
private:
Object objectValue;
};
#endif |
|
d**d 发帖数: 389 | 7 今天编译个OPENSOURCE的东西, 最后出错:
/usr/bin/ld: cannot find /lib//libc.so.0
collect2: ld returned 1 exit status
google了一下,也没有什么头绪,但是有文章讲
libc.so.N (where N is 6 or more).
我自己的机器上有/lib/libc.so.6,这个实际上是个link 文件,指到libc-2.11.2.so上
去的。
俺的问题是:
1. 这个libc.so.0是怎样被指定必须使用这个lbc.so.0而不是libc.so.6?
2. 怎样修改这个错误使编译能够通过啊?
非常感谢。 |
|
g**n 发帖数: 96 | 8 Thanks. It seems work. But now there is a linking problem ...
/tmp/ccEKqcOW.o:(.eh_frame+0x12): undefined reference to `__gxx_personality_
v0'collect2: ld returned 1 exit status |
|
a***e 发帖数: 1140 | 9 目的: 把C++ code + solaris JDK 移植到 RH9 上.
过程: 源程序 在 solaris 下编译成功. 用的是命令:
g++ -G -I/JDK-path/include -I/JDK-path/solaris source.c -o dest.so
然后, 先在 RH9下安装了SDK1.4, 用的是同样的命令, 出错了,出错信息是:
"-G" is not recognized by g++
XXXXX, undefined reference to 'main'
collect2: 1d return 1 exit status
分析: 将命令换成 "-g", 还是一样. 查了g++ 在 linux 的manual,都没有-G选项.可是
"-G" 命令可以在solaris下执行,不能在linux下执行. 如果在solaris下不用-G选项,出错
信息和linux下一样.
solaris下JDK1.2
哪位高人给指点指点. 怎样解决? |
|
s****d 发帖数: 5 | 10 Hi, I am struggling with c++ linking problem in Linux...
The C++ code has MATLAB engine inside, and it has no problem when compiling
under Windows(same MATLAB version, MATLAB 6.5R13), but it can not be compiled
with Linux, I always get the following error:
/usr/bin/ld: warning: libstdc++-libc6.1-2.so.3, needed by /s2bin/matlabR13/bin
/glnx86/libmx.so, not found (try using -rpath or -rpath-link)
/s2bin/matlabR13/bin/glnx86/libmx.so: undefined reference to `__throw'
collect2: ld returned 1 exit s |
|
l*********i 发帖数: 483 | 11 看了那个 C++ lite FAQ,还是没有搞定:
//cppfile.cpp
#include
void foo1(){
std::cout<<"this is foo1()"<
}
//cppfile.h
extern "C" {
void foo1();
};
//cfile.c
#include "cppfile.h"
main()
{
foo1();
}
编译:
g++ -c cfile.c
g++ -c cppfile.cpp
g++ -o out.bin cfile.o cppfile.o
最后link的时候总是出错"cfile.o: In function `main':
cfile.c:(.text+0x5): undefined reference to `foo1'
collect2: ld returned 1 exit status
"
哪位给指点一下?多谢多谢。 |
|
k****f 发帖数: 3794 | 12 看看你的libgsl.a或者其他类似的库在哪儿?
block |
|
k****e 发帖数: 100 | 13 gsl 由一个工具 gsl-config 能告诉你怎么配置gcc
gcc/g++ `gsl-config --libs` test.cc |
|
r****t 发帖数: 10904 | 14 奇怪,在连接的时候遇到如下错误,-lstdc++ 也没法成功,怎么办?
undefined reference to `operator<<(std::basic_string
char>, std::allocator >&, int)'
undefined reference to `operator<<(std::basic_string
char>, std::allocator >&, int)'
collect2: ld returned 1 exit status |
|
b***y 发帖数: 2799 | 15 ☆─────────────────────────────────────☆
Viterbi (长岛扛霸的) 于 (Tue Sep 6 18:06:05 2005) 提到:
I'm using C under Linux for the first time. I found something strange. When I
try to use gcc to link (no problem for compile), it gives me the following
error message:
prime_para.o(.text+0xd0): In function `main':
collect2: ld returned 1 exit status
but if I use g++ instead, such problem disappeared.
Then I go on and use some other function, now both gcc and g++ fail, anybody
know why? Thanks a lot!
☆── |
|
b***y 发帖数: 2799 | 16 ☆─────────────────────────────────────☆
risun (CD快乐之源) 于 (Wed Sep 21 01:54:18 2005) 提到:
程序中有
write(0,*) trim(string)
结果编译的时候不通过,
Reference to unimplemented intrinsic `TRIM' at (^) (assumed EXTERNAL)
/tmp/cckYUV5O.o(.text+0xb4): In function `MAIN__':
collect2: ld returned 1 exit status
申明了
external trim
还是不行,请问如何解决这个问题?
太弱了,//shy
☆─────────────────────────────────────☆
catapult (Stone Thrower) 于 (Wed Sep 21 11:10:51 2005) 提到:
check if trim is defined outside of any funct |
|
w*****j 发帖数: 49 | 17 Hi, everybody, I'm trying to use gcc to compile a program on my mac. It use
FLTK library. And when i type "g++ -o scratch scratch.c++". it gives the
error:
/usr/bin/ld: Undefined symbols:
Fl::run()
Fl_Widget::Fl_Widget(int, int, int, int, char const*)
Fl_Widget::~Fl_Widget()
Fl_Window::show()
Fl_Window::Fl_Window(int, int, char const*)
Fl_Window::~Fl_Window()
vtable for Fl_Box
collect2: ld returned 1 exit status
Anybody gets any suggestions? Thanks. |
|
b**g 发帖数: 335 | 18
gcc can compile C++ code as well, but you need to add "-lstdc++"
option, e.g.
gcc foo.cpp -lstdc++
gcc and g++ are simply "drivers", i.e. they call cpp, cc1, collect2, ld, etc
to do the actual compilation work.
Believe it or not, the only difference between gcc
and g++ is g++ will add "-lstdc++" automagically for you. |
|
g*********s 发帖数: 1782 | 19 The following code has compilation errors if "-DDEBUG" is not specified.
In function `StripePainter::init_tab(std::basic_string
std::char_traits, std::allocator >)':
inclass_static.cpp:(.text+0xb): undefined reference to
`StripePainter::colorset'
inclass_static.cpp:(.text+0x1b): undefined reference to
`StripePainter::orig_color'
inclass_static.cpp:(.text+0x23): undefined reference to
`StripePainter::colorset'
inclass_static.cpp:(.text+0x58): undefined reference to
`StripePainte... 阅读全帖 |
|
f******e 发帖数: 582 | 20 I have one C program project1.c. When I compile it, I got the following
errors:
================
In function `main':
project1.c:(.text+0xa7): undefined reference to `parseName'
collect2: ld returned 1 exit status
================
I have checked, function parseName() is defined in project1.c What is the
problem here?
Thanks a lot. |
|
c**y 发帖数: 172 | 21 我的下面的程序,在gcc可以编译通过,但是g++抱怨multi-definition of x。哪个大
侠指点一下为什么g++报这个错。
====程序====
1.m.c
#include
#include "l1.h"
extern void incx();
int main() {
x = 10;
px();
incx();
return 0;
}
2.l1.h
int x;
void px();
3.l1.c
#include
#include "l1.h"
void px()
{
printf("x = %d\n",x);
}
4.l2.c
#include
#include "l1.h"
void incx()
{
x += 1;
px();
}
========
gcc编译命令
gcc m.c l1.c l2.c
g++编译命令及报错
-bash-2.05b$ g++ m.c l1.c l2.c
/tmp/cc4JpQXE.o(.bss+0x0): multiple d... 阅读全帖 |
|
x******a 发帖数: 6336 | 22 装了一个quantlib在mac os x上,然后运行那个example,结果得到下面一堆。请教应
该link或者编译?
谢谢!
instruction在这里:
http://quantlib.org/install/macosx.shtml
run example
g++ -I/opt/local/include/ -I/opt/local/include/boost BermudanSwaption.cpp
-o bermudanswaption -L/opt/local/lib/ -lQuantLib
以后的error:
Undefined symbols for architecture x86_64:
"_main", referenced from:
start in crt1.10.6.o
"vtable for boost::unit_test::unit_test_log_t", referenced from:
boost::unit_test::unit_test_log_t::unit_test_log_t()in ccL... 阅读全帖 |
|
g***l 发帖数: 2753 | 23 this is the complete error message. I think it is still related to function
template.
template
void register_dec_handle(int tag_id);
was declared in sample.hpp and was implemented in sample.cpp.
both class dec_1 and class dec_2 were declared in sample.hpp and implemented
in sample.cpp.
In main.cpp, #include "sample.hpp", refer to above code.
////////////////////////////////////
$g++ main.cpp sample.cpp sample.hpp -o sample
/tmp/ccPFwZuH.o: In function `main':
main.cpp:(.text+0x3f): und... 阅读全帖 |
|
W***o 发帖数: 6519 | 24 这是一个作业,是应用这个提供的data structure Steque 控制程序里object的流向和
path。
源码贴这里了 http://pastebin.com/VzvcdJKu
我现在对如何使用这个data structure糊涂,从java过来的,不知道在C里面怎么初始
化一个object.
我自己想做一个下面的初始化测试:
typedef struct steque_t steque;
steque *stq;
int i;
for(i = 0; i < 10; i++)
{
steque_item *item = malloc(sizeof(steque_item)); // 这样初始化一个
item
steque_enqueue(stq, item); //然后把item enqueue到stq数据结构里面
}
可是目前这么做的结果是编译时报错:
gcc stequeTest.c -o stequeTest
stequeTest.c: In function ‘main’:... 阅读全帖 |
|
b*********n 发帖数: 2284 | 25 请高人指点。今天第一次装MinGW编译cpp程序,多线程的计算程序,需要用OpenMP。我
用 gcc -fopenmp xxxx.cpp 编译,结果有如下错误
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot
find -lpthread
collect2.exe: error: ld returned 1 exit status
请教怎么解决,谢谢! |
|
s*******2 发帖数: 499 | 26 没有朋友懂yacc的,我有一个bug,始终不知道怎么解决,真诚请教。
我有一个问题,我在运行程序以后出现:
compl.l: In function `yylex':
compl.l:75: warning: assignment makes integer from pointer without a cast
/tmp/ccKAECtZ.o(.text+0x1466): In function `main':
/tmp/ccovPdqh.o(.text+0x1fd): first defined here
/usr/bin/ld: Warning: size of symbol `main' changed from 40 in /tmp/ccovPdqh
.o to 596 in /tmp/ccKAECtZ.o
/tmp/ccKAECtZ.o(.text+0x2a8): In function `yylex':
collect2: ld returned 1 exit status
这种情况是哪里出了错,我该怎么样修改呢?
十分感谢。 |
|
R*******c 发帖数: 249 | 27 搞了三四天了,还是没成功,实在是崩溃了。。。只能上来请大牛们帮忙看看问题出在哪?
从网上下载了一个R的package(一个zip文件),这个包是在mac上build的,在mac里运行没有
问题,我现在想在windows下用这个包,直接通过R里面的install package from local
zip file会有错误如下:
Error in gzfile(file, "r") : cannot open the connection
In addition: Warning messages:
1: In unzip(zipname, exdir = dest) : error 1 in extracting from zip
file
2: In gzfile(file, "r") :
cannot open compressed file 'curves2_1.0.1.tar.gz/DESCRIPTION',
probable reason 'No such file or directory'
所以决定先将zip文件解压缩成文件夹,然后在windows下把这个包buil... 阅读全帖 |
|