Boost logo

Boost Users :

Subject: [Boost-users] boost build problem?...
From: Krzysztof (kj_at_[hidden])
Date: 2011-04-26 15:16:36


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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net