0
votes

I want to use boost filesystem functions and I searched my build log and find these lines:

1> Searching C:\local\boost_1_55_0\stage\lib\libboost_filesystem-vc90-mt-1_55.lib: 1> Searching C:\local\boost_1_55_0\stage\lib\libboost_system-vc90-mt-1_55.lib: 1> Searching C:\local\boost_1_55_0\stage\lib\boost_system-vc90-1_55.lib:

so it did find the libs.

what I med are:

proc1.obj : error LNK2001: unresolved external symbol "unsigned __int64 __cdecl boost::filesystem::detail::file_size(class boost::filesystem::path const &,class boost::system::error_code *)" (?file_size@detail@filesystem@boost@@YA_KAEBVpath@23@PEAVerror_code@system@3@@Z)

how to solve this?

my test code:

#include <stdlib.h>
#include <string>
#include <iostream>
#include <boost/filesystem.hpp>
#include <boost/foreach.hpp> 

using namespace std;
namespace fs = boost::filesystem;  


int main()
{
    string filepath( "H:\\DataSets\\xxx" );
    int a = fs::file_size(filepath.c_str());

}
1
Exactly which libs are you linking?Avery3R
C:\local\boost_1_55_0\stage\lib\libboost_filesystem-vc90-mt-1_55.libCoderzelf

1 Answers

0
votes

As you said in your comment, you are only linking with boost::filesystem. boost::filesystem depends on boost::system so you must also link to boost::system