4
votes

I have googled the error for hours on end now and have not gotten much of anywhere. I have linked the project in my Visual Studios (2010 & 2012) project as that seems to have resolved everyone else's issue that was similar to this. However I am still unable to get my sample code from boost's website to work and keep getting that error. The file libboost_filesystem-vc100-mt-gd-1_47.lib is in my C:\Program Files (x86)\boost\boost_1_47\lib path. Here is the code I am trying to test and get boost up and running.

#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;
}
3
Usually it helps if you include the errors you're getting.Collin Dauphinee
The only reason is that it cannot find (or it is not added in Linker->Additional Library Directories) the path to boost libs.SChepurin
Here is the error: 1>LINK : fatal error LNK1104: cannot open file 'libboost_filesystem-vc100-mt-gd-1_47.lib' Here is where the file is located: C:\Program Files (x86)\boost\boost_1_47\lib\libboost_filesystem-vc100-mt-gd-1_47.lib Here is what I have put in Linker->General->Additional Library Directories: C:\Program Files (x86)\boost\boost_1_47\lib\boost_filesystem-vc100-mt-gd-1_47.lib I have also tried this in the linker C:\Program Files (x86)\boost\boost_1_47\lib\ None of this has worked and has given me the same errorOakleyMaster
@OakleyMaster put in AdditonalLibraryDirectory - > "C:\Program Files (x86)\boost\boost_1_47\lib\" and in Input -> Library, write the library nameAshish Negi

3 Answers

2
votes

Enter:

[boost_path]\stage\lib 

In setting under Linker->General->Additional Library directories.

0
votes

As mentionned by SChepurin it could be that you didn't add the path to boost to Linker->Additional Library Directories.

It could also be the case that you are trying to compile for x64 target whereas, given the install path for your boost libraries, you have only the 32 bits boost libraries installed on your system and therefore should either switch to x86 target or get 64 bits boost libraries, You can find binariy release from Boost 1.50 if you can use a moe recent version than 1.47 otherwise you will have to compile them yourself (see boost official documentation for more info on that)

Best

0
votes

I had the same error and i followed the SourceForge. The link will take you to a folder of zipped lib and dll files for version of boost.You can download and unzip related library and when copied it to the related location everything gonna be alright ;)