1

I'm trying to use the boost library on CodeBlocks, but I'm new to it and I can't seem to be able to link it properly.

The boost folder(version 1.70) is in the same folder of my main.cpp, and the library I'm trying to access is libboost_filesystem-mgw92-mt-x64-1_70.a;

Here is my code:

#include <iostream>
#include <boost/filesystem.hpp>


int main()
{

    boost::filesystem::path l_path("C:\\Hello.txt");
    if(boost::filesystem::exists(l_path))
        {
        std::cout<<"exists!"<<std::endl;
        }
        else
        {
        std::cout<<"no";
        }
    return 0;
}

And some screenshots of my settings and of the error

The linker settings

The search Directories for compiler an linker(both the same)

And a screenshot of the error

Thank you!

David
  • 123
  • 1
  • 10
  • [What is an undefined reference/unresolved external symbol error and how do I fix it?](https://stackoverflow.com/q/12573816/5910058) – Jesper Juhl Dec 31 '19 at 10:03
  • 1
    I know what an undefined reference is, I'd like some tangible help if possible. I've done everything possible to provide informations on what I'm doing, and I'm happy to provide more on request. – David Dec 31 '19 at 10:08

1 Answers1

1

Undefined reference to _Unwind_Resume suggests that you build Boost with different compiler than your project or you choose different type of exception handling.

Check if you're using the same compiler in both cases.

It might be also caused by building your project using gcc instead of g++. You should check that as well. In this case switch to g++ or explicitly link against libstdc++, by adding -lstdc++ to compiler flags.

chwala
  • 199
  • 10
  • Thank you for your answer! You are right on the fact that I've used different compilers, so probably that is the cause. I'm using Visual Studio now, and as soon as I get confident with it, I'll try again, this time I'll be very careful to use the same compiler and I'll see if the error pops up again – David Jan 05 '20 at 11:21