From my terminal session:
Go Trojans >make all
g++ -static -I/usr/include/boost -I/usr/include/boost/filesystem get_sys_info.cpp
/tmp/cc6nK9EV.o: In function `__static_initialization_and_destruction_0(int, int)':
get_sys_info.cpp:(.text+0x13a): undefined reference to `boost::system::generic_category()'
get_sys_info.cpp:(.text+0x146): undefined reference to `boost::system::generic_category()'
get_sys_info.cpp:(.text+0x152): undefined reference to `boost::system::system_category()'
collect2: ld returned 1 exit status
make: *** [all] Error 1
Go Trojans >
The C++ code importing the Boost C++ Filesystem library:
#include <iostream>
#include <string>
#include <stdio.h>
#include <stdlib.h>
// Include Boost C++ libraries
#include <boost/filesystem.hpp>
using namespace boost::filesystem;
using namespace std;
int main() {
string my_str = "This is a string.";
cout << my_str << endl;
/*
my_str = system("pwd");
my_str.append("\b\b\b\b\b\b\b\b extra");
cout << my_str << "a\b\b\b\b\b\b=" << endl;
*/
path p(".");
cout << p << "==" << endl;
return 0;
}
Snippets from the Terminal session at the directory where my Boost C++ libraries are located.
Go Trojans >pwd
/usr/include/boost
Go Trojans >ls -al
total 1308
drwxr-xr-x 86 root root 12288 Jan 29 09:30 .
drwxr-xr-x 119 root root 20480 Feb 4 08:08 ..
...
drwxr-xr-x 5 root root 4096 Jan 29 09:30 filesystem
-rw-r--r-- 1 root root 1340 Jan 5 2012 filesystem.hpp
How do I resolve the undefined references? Am I importing the Boost C++ Filesystem Library correctly? Am I also compiling the code correctly?
What are my mistakes? Can you please kindly help me?
Thank you very much, and have an awesome day! Ciao!