Using boost::filesystem::path causes program to crash

Trying to use boost with Qt and having a problem with filesystem::path, I'm using QFileDialog::getExistingDirectory to return the directory I want to use and store it in a QString, then convert the QString with .toStdString() and store it in a string and then use that string with boost::filesystem::path.

The problem is that the program crashes when boost::filesystem::path p(file.c_str()); executes, the program crashes. If I comment out that line, everything is fine. Not sure whats going on.

I see nothing wrong here. Instead of comment/uncomment this line, try to run it in debug and see in the call stack where it crashes.
If the debugger still points you to that particular line, I suggest you remove your build and recompile it. And then if this still doesn't work, maybe try to reinstall boost.
It's really hard to tell what's the matter here. I hope the debug will output something useful.

@ValentinMichelet
I guess that the single backslash and 'c' will be comined to some phony character which is possibly valid.
Never used the boost filesystem routines and therefore do not know what this contructor actually does. You may want to check the small test with a valid path. Basically I just saw the issue and thought to note it.

Your problem looks quite strange to me. The current state seems to be a bit of trial and error only. Probably you had tried already, but "rebuild all" for the project sometimes solves problems "magically".