
I wrote a few lines of code just for start with a library of boost (program_options). Before I did it I had built boost library as prescribed and *.a and *.so files were created in my /home/krzysztof/Documents/Projects/boost/lib directory. However, compilation fails because of undefined references of some external symbols which belongs to program_options library. Could anyone help me with it? Below, there is the code and g++ output. (Linux 64b, Qt Creator and Code::Blocks used as IDE) #include "boost/program_options.hpp" using namespace boost::program_options; using namespace std; int main(int argc, char *argv[]) { options_description opd; opd.add_options() ("help","Display help") ("input_file,if",value<string>(),"Specifies input file") ("fet_file",value<string>(),"definitions file") ("output_file,of",value<string>(),"file after edition"); } g++ -o fetxedit main.o -L/usr/lib -L/home/krzysztof/Documents/Projects/boost/lib -lQtCore -lpthread main.o: In function `main': /home/krzysztof/Documents/Projects/fetxedit-build-desktop/../fetxedit/main.cpp:8: undefined reference to `boost::program_options::options_description::m_default_line_length' /home/krzysztof/Documents/Projects/fetxedit-build-desktop/../fetxedit/main.cpp:8: undefined reference to `boost::program_options::options_description::m_default_line_length' /home/krzysztof/Documents/Projects/fetxedit-build-desktop/../fetxedit/main.cpp:8: undefined reference to `boost::program_options::options_description::options_description(unsigned int, unsigned int)' /home/krzysztof/Documents/Projects/fetxedit-build-desktop/../fetxedit/main.cpp:14: undefined reference to `boost::program_options::options_description::add_options()' /home/krzysztof/Documents/Projects/fetxedit-build-desktop/../fetxedit/main.cpp:14: undefined reference to `boost::program_options::options_description_easy_init::operator()(char const*, char const*)' ... and so on -- Regards Krzysztof Jasieński

AMDG On 04/26/2011 12:16 PM, Krzysztof wrote:
I wrote a few lines of code just for start with a library of boost (program_options). Before I did it I had built boost library as prescribed and *.a and *.so files were created in my /home/krzysztof/Documents/Projects/boost/lib directory. However, compilation fails because of undefined references of some external symbols which belongs to program_options library. Could anyone help me with it? Below, there is the code and g++ output. (Linux 64b, Qt Creator and Code::Blocks used as IDE)
<snip>
g++ -o fetxedit main.o -L/usr/lib -L/home/krzysztof/Documents/Projects/boost/lib -lQtCore -lpthread main.o: In function `main': /home/krzysztof/Documents/Projects/fetxedit-build-desktop/../fetxedit/main.cpp:8: undefined reference to `boost::program_options::options_description::m_default_line_length'
You're missing -lboost_program_options. In Christ, Steven Watanabe
participants (2)
-
Krzysztof
-
Steven Watanabe