I’ve run into a problem with printf and cout when using boost/filesystem.hpp
I created a c++ project in eclipse juno with mingw settings
objectfile.hpp contains declarations and #include “boost/filesystem.hpp”
objectfile.cpp contains definitions and usage of boost:: filesystem:: exists(…)
mainfile.cpp contains the following code:
#include <stdio.h>
using namespace std;
int main() {
printf("asdf\n");
cout <<"asdf"<<endl;
return 0;
}
mainfile.cpp doesn’t include the header of objectfile.hpp but gets linked in the linking stage. Also boost_system and boost_filesystem are linked.
Problem: output is empty. There is no output whatsoever until I remove boost/filesystem.hpp and the corresponding code and then recompile.
I haven’t tested with other boost libraries yet. Maybe someone else has had a similar problem?
Windows 7 64 bit
Eclipse Juno 64 bit -std=c++11 compiler option
Boost 1.51 multi threaded dynamically linked
UPDATE
I rebuilt Boost 1.51 with these options:
-j8 toolset=gcc cxxflags=-std=gnu++0x variant=release optimization=speed link=static threading=multi –layout=system –prefix=boost install
and now it works.
thank you Marshall Clow. Submit an answer and I’ll accept it.
Resubmitting as an answer:
Is it possible that you built the boost libraries with different compiler options than your program? Specifically, I would check
std=c++11.