c + +通过远程Netbeans的发展论坛在Linux上提升:未定义的引用,以提高文件系统:: ::路径:: codeCVT() [英] C++ Boost on linux via Netbeans remote developement: undefined reference to boost::filesystem::path::codecvt()

查看:392
本文介绍了c + +通过远程Netbeans的发展论坛在Linux上提升:未定义的引用,以提高文件系统:: ::路径:: codeCVT()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我对Windows7的安装了NetBeans和桑巴配置Ubuntu的框,共享发展论坛目录在那里我有来源和Boost库。
我编译Boost库,能够链接到boost_filesystem但是当我尝试编译应用程序我仍然得到这个错误:

So I installed Netbeans on windows7 and configured the Ubuntu box with samba to share the developement directory where I have the sources and the boost library. I compiled the boost library to be able to link to boost_filesystem but I still get this error when I try to compile the application:

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.o.d"
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.o.d" -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<char*>':
/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)

我想我得到了链接权。
下面是该方案code:

I thought I got the linking right. Here is the program code:

#include <iostream>
#include <boost/filesystem.hpp>
//using namespace std;
using namespace boost::filesystem;
int main(int argc, char**argv)
{
    std::cout << file_size(argv[0]);

    return EXIT_SUCCESS;
}

在SQL部分正常工作与连接和所有,但只包括提高文件系统是足以让生成错误,不能获得如何在Windows到Linux使用远程研究与开发与NetBeans。我在做什么错了?

The sql part works fine with linking and all, but only including the boost filesystem is enough to get a build error, can't get how to use remote developement with netbeans on windows to Linux. What am I doing wrong?

一个新的尝试没有NetBeans中,只是在Ubuntu从提高文件系统的链接 ...
与编译命令:
    G ++ -pthread mr.cpp -lboost_filesystem-MT -lboost_system-MT
输出为
    /tmp/ccIZaqeX.o:在功能上的boost ::文件系统:: FILE_SIZE(升压::文件系统::路径常量和放大器;):
    mr.cpp: (.text._ZN5boost10filesystem9file_sizeERKNS0_4pathE[boost::filesystem::file_size(boost::filesystem::path常量和放大器;)] +的0x19):未定义引用
的boost ::文件系统::详细:: FILE_SIZE(升压::文件系统::路径常量和放大器;,提振::系统::错误_ code *)'
    /tmp/ccIZaqeX.o:在功能上的boost ::文件系统::路径::路径&LT;字符*&GT;(char * const的&放大器;, boost::enable_if<boost::filesystem::path_traits::is_pathable<boost::decay<char*>::type>,无效&GT; ::键入*)':
    mr.cpp: (.text._ZN5boost10filesystem4pathC2IPcEERKT_PNS_9enable_ifINS0_11path_traits11is_pathableINS_5decayIS4_E4typeEEEvE4typeE[_ZN5boost10filesystem4pathC5IPcEERKT_PNS_9enable_ifINS0_11path_traits11is_pathableINS_5decayIS4_E4typeEEEvE4typeE]+0x22):未定义的引用
的boost ::文件系统::路径:: codeCVT()
    collect2:劳工处返回1退出状态

A new try without netbeans, just on Ubuntu with the example from Boost filesystem link ... and with compile command: g++ -pthread mr.cpp -lboost_filesystem-mt -lboost_system-mt the output is /tmp/ccIZaqeX.o: In function 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 toboost::filesystem::detail::file_size(boost::filesystem::path const&, boost::system::error_code*)' /tmp/ccIZaqeX.o: In function boost::filesystem::path::path<char*>(char* const&, boost::enable_if<boost::filesystem::path_traits::is_pathable<boost::decay<char*>::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 toboost::filesystem::path::codecvt()' collect2: ld returned 1 exit status

我不明白这一点。

推荐答案

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

I got the same problem just yesterday:

如何解决:

第一:如果你通过源代码安装升压,确保您编译它向您正在使用NetBeans的在正确的编译器工具集。举例来说,我使用MinGW @ Windows 8的升压/ MingW平台进行了测试。

First: if you installed Boost by source, make sure you are compiling it to right compiler toolset that you are using at netbeans. For instance, I tested it with MinGW @ Windows 8 Boost/MingW.

二:在Netbeans的(我用7.4版),我增加了图书馆我想通过手:

Second: In Netbeans (I used 7.4 version), I added the libraries I want by hand:

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

Project Properties > Linker > Libraries > Add Library > Select the .a files.

编辑:

此链接可能是有用的:<一href=\"http://stackoverflow.com/questions/14767550/c-netbeans-7-2-1-linking-boost-libraries-correctly\">undefined与升压,当我尝试编译参考

This link maybe be useful: undefined reference with boost when I try to compile

这篇关于c + +通过远程Netbeans的发展论坛在Linux上提升:未定义的引用,以提高文件系统:: ::路径:: codeCVT()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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