c ++ Netbeans 7.2.1正确链接boost库 [英] c++ Netbeans 7.2.1 linking boost libraries correctly

查看:626
本文介绍了c ++ Netbeans 7.2.1正确链接boost库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近从visual studio 2010 express切换到使用NetBeans,我已经非常印象深刻的布局和简单性,即使它需要一点微调编译正确。但是,我有另一个问题。当我测试看看boost是否会工作,我包括文件boost / signals.hpp在main.cpp然后去到项目选项中的额外的库目录,并添加了我的boost安装的lib目录,同我会在视觉工作室。毕竟,我得到一堆未定义的引用。

I've recently switched from visual studio 2010 express to using NetBeans, and i'm already very impressed with the layout and simplicity, even though it did take a bit of nudging to compile right. However, i've got another problem. When i tested to see if boost would work as well, i included the file boost/signals.hpp in a main.cpp and then went to the additional library directories in the project options and added the lib directory of my boost install, same as i would do in visual studio. After all this, i get a bunch of undefined references anyway.

我使用mingw编译器与msys和我有boost版本1.47如果这有什么区别。我可以确认,使用visual studio时,同样的安装boost工作正常。

I'm using the mingw compiler with msys and i have boost version 1.47 if that makes any difference. I can confirm that this same install of boost works fine when using visual studio.

这是构建日志。

"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory m`/c/Users/me/Documents/NetBeansProjects/Syncopate5/Syncopate5'
"/usr/bin/make"  -f nbproject/Makefile-Debug.mk dist/Debug/MinGW-Windows/syncopate5.exe
make[2]: Entering directory `/c/Users/me/Documents/NetBeansProjects/Syncopate5/Syncopate5'
mkdir -p dist/Debug/MinGW-Windows
g++.exe     -o dist/Debug/MinGW-Windows/syncopate5 build/Debug/MinGW-Windows/main.o -L/C/Program\ Files\ \(x86\)/boost/boost_1_47/lib 
build/Debug/MinGW-Windows/main.o: In function `ZN5boost7signal0IvNS_10last_valueIvEEiSt4lessIiENS_8functionIFvvEEEED2Ev':
C:\Users\me\Documents\NetBeansProjects\Syncopate5\Syncopate5/../../../../../../Program Files (x86)/boost/boost_1_47/boost/signals/signal_template.hpp:139: undefined reference to `boost::signals::trackable::~trackable()'
C:\Users\me\Documents\NetBeansProjects\Syncopate5\Syncopate5/../../../../../../Program Files (x86)/boost/boost_1_47/boost/signals/signal_template.hpp:139: undefined reference to `boost::signals::detail::signal_base::~signal_base()'
make[2]: Leaving directory `/c/Users/me/Documents/NetBeansProjects/Syncopate5/Syncopate5'
C:\Users\me\Documents\NetBeansProjects\Syncopate5\Syncopate5/../../../../../../Program Files (x86)/boost/boost_1_47/boost/signals/signal_template.hpp:139: undefined reference to `boost::signals::detail::signal_base::~signal_base()'
make[1]: Leaving directory `/c/Users/me/Documents/NetBeansProjects/Syncopate5/Syncopate5'
build/Debug/MinGW-Windows/main.o: In function `ZN5boost7signal0IvNS_10last_valueIvEEiSt4lessIiENS_8functionIFvvEEEEC2ERKS2_RKS4_':
C:\Users\me\Documents\NetBeansProjects\Syncopate5\Syncopate5/../../../../../../Program Files (x86)/boost/boost_1_47/boost/signals/signal_template.hpp:197: undefined reference to `boost::signals::detail::signal_base::signal_base(boost::function2<bool, boost::signals::detail::stored_group, boost::signals::detail::stored_group> const&, boost::any const&)'
C:\Users\me\Documents\NetBeansProjects\Syncopate5\Syncopate5/../../../../../../Program Files (x86)/boost/boost_1_47/boost/signals/signal_template.hpp:197: undefined reference to `boost::signals::detail::signal_base::~signal_base()'
collect2.exe: error: ld returned 1 exit status
make[2]: *** [dist/Debug/MinGW-Windows/syncopate5.exe] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2

编辑:

尝试通过项目属性中的添加库对话框手动添加所需的lib文件后,我收到此错误。

After trying to add the required lib file manually via the add libraries dialog in the project properties, i receive this error.

"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `/c/Users/me/Documents/NetBeansProjects/Syncopate5/Syncopate5'
"/usr/bin/make"  -f nbproject/Makefile-Debug.mk dist/Debug/MinGW-Windows/syncopate5.exe
make[2]: Entering directory `/c/Users/me/Documents/NetBeansProjects/Syncopate5/Syncopate5'
make[2]: *** No rule to make target `../../../../../../Program Files \(x86\)/boost/boost_1_47/lib/libboost_signals-vc100-mt-1_47.lib', needed by `dist/Debug/MinGW-Windows/syncopate5.exe'.  Stop.
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
make[2]: Leaving directory `/c/Users/me/Documents/NetBeansProjects/Syncopate5/Syncopate5'
make[1]: Leaving directory `/c/Users/me/Documents/NetBeansProjects/Syncopate5/Syncopate5'

BUILD FAILED (exit value 2, total time: 9s)


推荐答案

经过几个小时的谷歌和阅读,我已经发现了一点更多关于boost,最终找到并了解我的问题。当我最初获得我的安装boost,它是从BoostPro它拥有所有的头只有对象,以及vc ++ ONLY的预编译二进制。获得最新版本的boost后,boost.build创建gcc版本的库并链接到它们,它工作没有任何结果。感谢Tyler Jandreau Joachim Pileborg回答我本质上有缺陷的问题:。

After hours of googling and reading, i have discovered a little more about boost and finally found and understand my problem. When i originally obtained my install of boost, it was from BoostPro which has all the header only objects, as well as precompiled binaries for vc++ ONLY. After obtaining the most recent version of boost, and boost.build to create gcc versions of the libraries and linking against them, it worked without a hitch. Thanks Tyler Jandreau an Joachim Pileborg for answering my inherently flawed question :.

这篇关于c ++ Netbeans 7.2.1正确链接boost库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆