English 中文(简体)
• 如何在汽车汇票/造册上与图书馆链接
原标题:Howto add a link to a library in autoconf configure script / makefile

I am an autotools newb and I have difficulties figuring out howto easily link a specific library into one of the configured targets.

I have a source package that I want to build the usual way: ./configure && make && make install

Unfortunately one of the cpps has a missing reference to another library. Compiling it by hand (adjusting the commandline) works. But I would rather "patch" the compile script. Where is the standard place to edit linking references?

 undefined reference to `boost::system::get_system_category()

这是我的错误信息。

最佳回答

请在<代码>Makefile.am上添加有关<代码>-l的旗帜。 e.g:

AM_LDFLAGS = -lboost_system-mt

请注意,Boost图书馆一般以图形形式结束——这是标明建筑组合的系列信函。 在上述例子中,数字为-mt。 在您的安装中,情况可能有所不同(尽管在PPOSIXy系统,监文信息系统中通常有-mt的变量)。

我也这样做:

AM_LDFLAGS = -lboost_system$(BOOST_LIB_SUFFIX)

<代码>BOOST_LIB_SUFFIX是一个宝贵的变量(见AC_ARG_VAR),该变量为-mt

问题回答




相关问题
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/...