link fail against boost_filesystem on FreeBSD 5 with gcc 3.3.3
It's my first time using boost I'm using boost 1.30.2 with FreeBSD 5, where gcc version is 3.3.3 following is my code, quite simple <code> #include <boost/filesystem/operations.hpp> #include <boost/filesystem/fstream.hpp> #include <string> #include <iostream> namespace fs = boost::filesystem; const std::string LogFileName = "ggyy"; int main(void) { fs::ifstream LogFile(LogFileName); return 0; } </code> it compiles well, but failed on linking : <error> g++ -L/usr/local/lib -lboost_filesystem -o LogParser LogParser.o LogParser.o: In function `main': LogParser.o(.text+0x27): undefined reference to `boost::filesystem::path::path(std::string const&)' LogParser.o(.text+0x51): undefined reference to `boost::filesystem::path::native_file_string() const' *** Error code 1 </error> My boost is built from the ports system, and I'm sure I have libboost_filesystem.a and other related boost libraries TEST [/usr/local/lib] -ijliao- ls -al *boost* -r--r--r-- 1 root wheel 4058 Dec 1 11:51 libboost_date_time.a -r-xr-xr-x 1 root wheel 4524 Dec 1 11:51 libboost_date_time.so -r--r--r-- 1 root wheel 66680 Dec 1 11:51 libboost_filesystem.a -r--r--r-- 1 root wheel 23888 Dec 1 11:51 libboost_prg_exec_monitor.a -r-xr-xr-x 1 root wheel 15524 Dec 1 11:51 libboost_prg_exec_monitor.so -r--r--r-- 1 root wheel 524054 Dec 1 11:51 libboost_regex.a -r-xr-xr-x 1 root wheel 352124 Dec 1 11:51 libboost_regex.so -r--r--r-- 1 root wheel 3861324 Dec 1 11:51 libboost_regex_debug.a -r-xr-xr-x 1 root wheel 496028 Dec 1 11:51 libboost_regex_debug.so -r--r--r-- 1 root wheel 167428 Dec 1 11:51 libboost_signals.a -r-xr-xr-x 1 root wheel 82980 Dec 1 11:51 libboost_signals.so -r--r--r-- 1 root wheel 192482 Dec 1 11:51 libboost_test_exec_monitor.a -r-xr-xr-x 1 root wheel 106912 Dec 1 11:51 libboost_test_exec_monitor.so -r-xr-xr-x 1 root wheel 31636 Dec 1 11:51 libboost_thread.so -r-xr-xr-x 1 root wheel 53920 Dec 1 11:51 libboost_threadd.so -r--r--r-- 1 root wheel 185892 Dec 1 11:51 libboost_unit_test_framework.a -r-xr-xr-x 1 root wheel 103008 Dec 1 11:51 libboost_unit_test_framework.so so... could someone tell me how to solve this problem ? -- KISS : Keep It Simple, Stupid.
On Thu, Dec 04, 2003 at 16:21:34 +0800, Ying-Chieh Liao wrote:
g++ -L/usr/local/lib -lboost_filesystem -o LogParser LogParser.o
after posting this message, I've noticed that I made a big mistake I have to put -L and -l at the end of the command line argument g++ -o LogParser LogParser.o -L/usr/local/lib -lboost_filesystem works well sorry for bothering -- Allocate four digits for the year part of a date : a new millennium is coming. --- David Huber
participants (1)
-
Ying-Chieh Liao