English 中文(简体)
“未定义的参考资料”
原标题:"Undefined Reference" Error From ld

标题可能会导致你思考。

我从联系人/焊接处收到一份“未经界定的参考资料”,供第三方共享图书馆的多个功能标志使用,Im试图与我的可执行性联系起来。

奇怪的是,图书馆本身应当包含有关犯罪标志的定义。

陌生方面是,我的项目中有若干可起诉之处,有些人面临这一问题,有些人没有。

我是否夸大了我的热情/ld旗?

问题回答

您是否检查了您的联系令? 这在最近几版海合会中更为严格。

例如,通过这样做,产生了共同的问题:

g++ -lX11 -lSuperLibrary awesomeApp.cpp

而不是:

g++ awesomeApp.cpp -lX11 -lSuperLibrary

如果图书馆旗帜相互依赖,这也决定着这些旗帜。

有旗帜,可以做一个图书馆多路,帮助你解决问题。 如上所述,但与连接图书馆和在它们上(按联系人的业绩成本)进行再利用联系的链接,你可以做以下事情:

g++ awesomeApp.cpp -Wl,--start-group -lX11 -lSuperLibrary -Wl,--end-group

<代码>-Wl,<option>>;上向联系人发放了一种选择:-start-group-end-group

http://webpages.charter.net/ppluzhnikov/linker.html

我希望能够提供帮助。

无法从您的描述中说,其中含有大约零件有用信息。 一种可能性是,你不把正确的头号档案列入某些来源档案。





相关问题
gcc -fPIC seems to muck with optimization flags

Following along from this question: how-do-i-check-if-gcc-is-performing-tail-recursion-optimization, I noticed that using gcc with -fPIC seems to destroy this optimization. I am creating a shared ...

Generate assembler code from C file in linux

I would like to know how to generate assembler code from a C program using Unix. I tried the gcc: gcc -c file.c I also used firstly cpp and then try as but I m getting errors. I m trying to build an ...

Getting rid of pre-compiled headers

OK, I have old Metrowerks code for Mac and Windows where the previous developer used pre-compiled headers for every project that this code base builds. How does one get rid of Pre-compiled headers, ...

Include a .txt file in a .h in C++?

I have a number of places where I need to re-use some template code. Many classes need these items In a .h could I do something like: #include <xxx.txt> and place all of this code in the ....

How to compile for Mac OS X 10.5

I d like to compile my application for version 10.5 and forward. Ever since I upgraded to Snow Leopard and installed the latest XCode, gcc defaults to 10.6. I ve tried -isysroot /Developer/SDKs/...

热门标签