我正在尝试在我正在编写的一些代码中使用boost/filesystem库.我似乎很难将其编译.我正在运行Debian Wheezy,并且升级版本为1.49(如果你使用apt-get安装就会出现这种情况).我正在尝试编译文档中提供的示例
#include <iostream>
#include <boost/filesystem.hpp>
using namespace boost::filesystem;
int main(int argc, char* argv[])
{
if (argc < 2)
{
std::cout << "Usage: tut1 path\n";
return 1;
}
std::cout << argv[1] << " " << file_size(argv[1]) << '\n';
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我使用以下命令:
g++ temp.cc -o temp /usr/lib/libboost_filesystem.a
Run Code Online (Sandbox Code Playgroud)
我收到一些错误,例如:
/usr/lib/libboost_filesystem.a(operations.o): In function `boost::filesystem3::detail::dir_itr_close(void*&, void*&)':
(.text+0x4d): undefined reference to `boost::system::system_category()'
/usr/lib/libboost_filesystem.a(operations.o): In function `boost::filesystem3::detail::directory_iterator_increment(boost::filesystem3::directory_iterator&, boost::system::error_code*)':
(.text+0xe3): undefined reference to `boost::system::system_category()'
Run Code Online (Sandbox Code Playgroud)
这可能是一些链接错误对吗?关于如何解决它的任何想法?
更新#1:我尝试使用-lboost_filesyste和-L/usr/lib运行它.它给了我以下错误:
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
Run Code Online (Sandbox Code Playgroud) 有一个简单的方法来评估的2个矩阵列明智的点积(让我们称之为A和B,类型Eigen::MatrixXd),它们的尺寸mxn,不评估A*B或无需诉诸for循环?得到的矢量需要具有1xn或的尺寸nx1.另外,我正在尝试用C++中的Eigen做到这一点