I successfully compiled Boost with MinGW (GCC 4.4.0 - it came
> installed with the Qt SDK) with all the settings on, so it has
> generated both dynamic and static libraries, debug and release
> versions, multithreaded and non-multithreaded runtimes etc. I tried to
> compile a small program that uses the serialization library
> and tried to link it statically with these libraries (in different
> compilations):
LIBS += "D:/CD_LAP_TRINH/cach_su_dung_thu_vien_boost/Boost_Mingw/lib/libboost_filesystem-mgw34-mt.lib"
LIBS += "D:/CD_LAP_TRINH/cach_su_dung_thu_vien_boost/Boost_Mingw/lib/libboost_system-mgw34-mt.lib"
LIBS += "D:/CD_LAP_TRINH/cach_su_dung_thu_vien_boost/Boost_Mingw/lib/libboost_thread-mgw34-mt.lib"
Each time I compiled, it would always give me linker errors like so:
> undefined reference to `__gxx_personality_sj0'
> undefined reference to `_Unwind_SjLj_Register'
> undefined reference to `_Unwind_SjLj_Unregister'
> undefined reference to `_Unwind_SjLj_Resume'
#include <boost/filesystem/operations.hpp>
#include <iostream>
namespace fs = boost::filesystem;
int main( int argc, char* argv[] )
{
if ( argc != 2 )
{
std::cout << "Usage: file_size path\n";
return 1;
}
std::cout << "sizeof(intmax_t) is " << sizeof(boost::intmax_t) << '\n';
fs::path p( argv[1], fs::native );
if ( !fs::exists( p ) )
{
std::cout << "not found: " << argv[1] << std::endl;
return 1;
}
if ( !fs::is_regular( p ) )
{
std::cout << "not a regular file: " << argv[1] << std::endl;
return 1;
}
std::cout << "size of " << argv[1] << " is " << fs::file_size( p )
<< std::endl;
return 0;
}
#include <boost/filesystem/operations.hpp>
#include <iostream>
namespace fs = boost::filesystem;
int main( int argc, char* argv[] )
{
if ( argc != 2 )
{
std::cout << "Usage: file_size path\n";
return 1;
}
std::cout << "sizeof(intmax_t) is " << sizeof(boost::intmax_t) << '\n';
fs::path p( argv[1], fs::native );
if ( !fs::exists( p ) )
{
std::cout << "not found: " << argv[1] << std::endl;
return 1;
}
if ( !fs::is_regular( p ) )
{
std::cout << "not a regular file: " << argv[1] << std::endl;
return 1;
}
std::cout << "size of " << argv[1] << " is " << fs::file_size( p )
<< std::endl;
return 0;
}
To copy to clipboard, switch view to plain text mode
Bookmarks