netbeans c linux,C ++ Boost在Linux上通过Netbeans远程开发:未定义的引用boost :: filesystem :: path :: codecvt()...

所以我在windows7上安装了Netbeans,并用sambaconfiguration了Ubuntu box,以共享我拥有资源和boost库的开发目录。 我编译的boost库能够链接到boost_filesystem,但我仍然遇到这个错误,当我尝试编译应用程序:

Copying project files to /home/nms/.netbeans/remote/ophelia.tele2.net/t2003915-Windows-x86_64/ at nms@ophelia.tele2.net "/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf make[1]: Entering directory `/home/nms/.netbeans/remote/ophelia.tele2.net/t2003915-Windows-x86_64/Z/mr_deamon' "/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/GNU-Linux-x86/mr_deamon make[2]: Entering directory `/home/nms/.netbeans/remote/ophelia.tele2.net/t2003915- Windows-x86_64/Z/mr_deamon' mkdir -p build/Debug/GNU-Linux-x86 rm -f "build/Debug/GNU-Linux-x86/mr_deamon.od" g++ -c -g -I/opt/mail-relay/mr_deamon/boost_1_55_0 -I/opt/mail-relay/mr_deamon/mysql_connector_cpp/include -MMD -MP -MF "build/Debug/GNU-Linux-x86/mr_deamon.od" -o build/Debug/GNU-Linux-x86/mr_deamon.o mr_deamon.cpp mkdir -p dist/Debug/GNU-Linux-x86 g++ -o dist/Debug/GNU-Linux-x86/mr_deamon build/Debug/GNU-Linux-x86/mr_deamon.o -L/opt/mail-relay/mr_deamon/mysql_connector_cpp/lib -L/opt/mail-relay/mr_deamon/boost_1_55_0/bin.v2/libs -lmysqlcppconn-static -lmysqlclient -lboost_system -lboost_filesystem build/Debug/GNU-Linux-x86/mr_deamon.o: In function `boost::filesystem::file_size(boost::filesystem::path const&)': /opt/mail-relay/mr_deamon/boost_1_55_0/boost/filesystem/operations.hpp:447: undefined reference to `boost::filesystem::detail::file_size(boost::filesystem::path const&, boost::system::error_code*)' build/Debug/GNU-Linux-x86/mr_deamon.o: In function `path': /opt/mail-relay/mr_deamon/boost_1_55_0/boost/filesystem/path.hpp:139: undefined reference to `boost::filesystem::path::codecvt()' collect2: ld returned 1 exit status make[2]: *** [dist/Debug/GNU-Linux-x86/mr_deamon] Error 1 make[2]: Leaving directory `/home/nms/.netbeans/remote/ophelia.tele2.net/t2003915-Windows-x86_64/Z/mr_deamon' make[1]: *** [.build-conf] Error 2 make[1]: Leaving directory `/home/nms/.netbeans/remote/ophelia.tele2.net/t2003915-Windows-x86_64/Z/mr_deamon' make: *** [.build-impl] Error 2 BUILD FAILED (exit value 2, total time: 2s)

我以为我有链接的权利。 这里是程序代码:

#include #include //using namespace std; using namespace boost::filesystem; int main(int argc, char**argv) { std::cout << file_size(argv[0]); return EXIT_SUCCESS; }

sql部分工作正常与链接和所有,但只有包括boost文件系统足以得到一个构build错误,不能得到如何使用远程开发netbeans在Windows到Linux。 我究竟做错了什么?

一个新的尝试没有netbeans,只在Ubuntu的Boost文件系统链接的例子…和编译命令:g ++ -pthread mr.cpp -lboost_filesystem-mt -lboost_system-mt输出是/tmp/ccIZaqeX.o:在函数boost::filesystem::file_size(boost::filesystem::path const&)': mr.cpp: (.text._ZN5boost10filesystem9file_sizeERKNS0_4pathE[boost::filesystem::file_size(boost::filesystem::path const&)]+0x19): undefined reference to boost :: filesystem :: detail :: file_size(boost :: filesystem :: path const&,boost :: system :: error_code *)的boost::filesystem::file_size(boost::filesystem::path const&)': mr.cpp: (.text._ZN5boost10filesystem9file_sizeERKNS0_4pathE[boost::filesystem::file_size(boost::filesystem::path const&)]+0x19): undefined reference to '/tmp/ccIZaqeX.o:在函数boost::filesystem::path::path(char* const&, boost::enable_if<:filesystem::path_traits::is_pathable>::type>, void>::type*)': mr.cpp: (.text._ZN5boost10filesystem4pathC2IPcEERKT_PNS_9enable_ifINS0_11path_traits11is_pathableINS_5decayIS4_E4typeEEEvE4typeE[_ZN5boost10filesystem4pathC5IPcEERKT_PNS_9enable_ifINS0_11path_traits11is_pathableINS_5decayIS4_E4typeEEEvE4typeE]+0x22): undefined reference to boost :: f ilesystem :: path :: codecvt()'collect2:ld返回1退出状态

我不明白

我昨天刚刚得到同样的问题:

我如何解决:

首先:如果你是通过源代码安装Boost的话,请确保你正在使用NetBeans编译器工具集来编译它。 比如我用MinGW @ Windows 8 Boost / MingW进行了测试。

第二:在Netbeans(我使用7.4版)中,我添加了我想要的库:

项目属性>链接器>库>添加库>选择.a文件。

编辑:

这个链接可能是有用的: 当我尝试编译时带有boost的未定义引用

太棒了,所以最终它的工作,这就是我所做的:1-安装gcc 4.8(不知道这是否相关)。 2-下载并解压缩到/ usr / local中3-升级bootstrap.sh 4-将project-config.jam中的toolset参数修改为使用gcc:4.8.1:g ++ – 4.8; 5运行./b2 –with-system 6-运行./b2 –with-filesystem第5步和第6步都使用root用户完成。 7-像这样编译源文件:

# g++-4.8 mr.cpp -L /usr/local/boost_1_55_0/stage/lib -I /usr/local/boost_1_55_0 -lboost_system -lboost_filesystem -o mr

Jee,最后,我离开Boost几分钟。

我认为有所不同的是编译器(工具集)和安装路径的一致性,特别是这两个“-L / usr / local / boost_1_55_0 / stage / lib -I / usr / local / boost_1_55_0”

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值