The command that I used was:

 g++ -I[pathtoboostrootdirectory] -L[pathtoboostlibraries] testboost.cpp -o testboost -lboost_system-gcc41-mt-1_44 -lboost_filesystem-gcc41-mt-1_44

g++ (GCC) version that I am using is: 4.1.2 20080704


More Observations:

if I use gcc optimization flag i.e. -O or -O1 or -O2 or -O3, then the application is builds successfully. here is the command that I use:

 g++ -O -I[pathtoboostrootdirectory] -L[pathtoboostlibraries] testboost.cpp -o testboost -lboost_system-gcc41-mt-1_44 -lboost_filesystem-gcc41-mt-1_44


thanks


Asif



-----------------------------------------------------

Subject: Re: [Boost-users] boost 1.44.0 undefined reference to boost::filesystem2::no_check
From: Cedric Laczny (cedric.laczny_at_[hidden])
Date: 2010-10-05 10:48:07

Hi, 

it seems to me that the linker is missing the library (e.g. -lboost_filesystem) 
Could you please send the command-line you use to compile the simple program? 

Best, 

Cedric 

On Tuesday, 5. October 2010 13:15:59 Asif Fayyaz wrote: 
> Hi, 

> I am compiling a very simple application using boost filesystem. However it 
> is giving following error message: 

> "undefined reference to 
> `boost::filesystem2::no_check(std::basic_string<char, 
> std::char_traits<char>, std::allocator<char> > const&)'" 

> Here is the simple application source: 
> --------------------------------Sample application source: 
> #include <stdio.h> 
> #include <boost/filesystem.hpp> 

> int main() 
> { 
> std::string m_FileName(boost::filesystem::path("testfile1.txt", 
> boost::filesystem::no_check).native_file_string()); 

> printf("Testboost.....%s\n", m_FileName.c_str()); 
> return 0; 
> } 
> -------------------------------- 

> More Details: 
> Libraries being used: 
> libboost_filesystem-gcc41-mt-1_44.a 
> libboost_system-gcc41-mt-1_44.a 

> Boost version: 
> 1.44.0 

> Boost was build using command: 
> bjam --build-type=complete --layout=versioned 

> Operating System: 
> Linux CentOS5.2 


> Any help in this regard will be appreciated. 


> Asif