
Dear All, I have a simple test using program_options but even if I set BOOST_ALL_NO_LIB=1 the linker gives me errors. Any idea? Regards Gianni

What errors? Just because you ask it not to link to any boost library doesn't mean that program_options can work without its compiled parts... You'll have to link against somehting... Best, Dee On Wed, Mar 9, 2011 at 16:56, Gianni Ambrosio <gianni.ambrosio@vi-grade.com> wrote:

Hi Diederick, it seems link errors directly related to program_options lib. I used property tree lib without the need of any lib to link against. So, which is the benefit of using BOOST_ALL_NO_LIB if I need to link against boost libs? Anyway, here are the errors: error LNK2001: unresolved external symbol "void __cdecl boost::program_options::validators::check_first_occurrence(class boost::any const &)" (?check_first_occurrence@validators@program_options@boost@@YAXABVany@3@@Z) error LNK2001: unresolved external symbol "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl boost::program_options::operator<<(class std::basic_ostream<char,struct std::char_traits<char> > &,class boost::program_options::options_description const &)" (??6program_options@boost@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@AAV23@ABVoptions_description@01@@Z) error LNK2001: unresolved external symbol "public: __thiscall boost::program_options::invalid_option_value::invalid_option_value(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0invalid_option_value@program_options@boost@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) error LNK2001: unresolved external symbol "public: class boost::program_options::variable_value const & __thiscall boost::program_options::abstract_variables_map::operator[](class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)const " (??Aabstract_variables_map@program_options@boost@@QBEABVvariable_value@12@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) error LNK2001: unresolved external symbol "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > boost::program_options::arg" (?arg@program_options@boost@@3V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@A) error LNK2001: unresolved external symbol "public: void __thiscall boost::program_options::detail::cmdline::set_additional_parser(class boost::function1<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &>)" (?set_additional_parser@cmdline@detail@program_options@boost@@QAEXV?$function1@U?$pair@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@@std@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@4@@Z) error LNK2001: unresolved external symbol "public: class std::vector<class boost::program_options::basic_option<char>,class std::allocator<class boost::program_options::basic_option<char> > > __thiscall boost::program_options::detail::cmdline::run(void)" (?run@cmdline@detail@program_options@boost@@QAE?AV?$vector@V?$basic_option@D@program_options@boost@@V?$allocator@V?$basic_option@D@program_options@boost@@@std@@@std@@XZ) error LNK2001: unresolved external symbol "public: void __thiscall boost::program_options::detail::cmdline::set_options_description(class boost::program_options::options_description const &)" (?set_options_description@cmdline@detail@program_options@boost@@QAEXABVoptions_description@34@@Z) error LNK2001: unresolved external symbol "public: void __thiscall boost::program_options::detail::cmdline::style(int)" (?style@cmdline@detail@program_options@boost@@QAEXH@Z) error LNK2001: unresolved external symbol "public: __thiscall boost::program_options::detail::cmdline::cmdline(class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > const &)" (??0cmdline@detail@program_options@boost@@QAE@ABV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@@Z) error LNK2001: unresolved external symbol "public: class boost::program_options::options_description_easy_init __thiscall boost::program_options::options_description::add_options(void)" (?add_options@options_description@program_options@boost@@QAE?AVoptions_description_easy_init@23@XZ) error LNK2001: unresolved external symbol "public: __thiscall boost::program_options::options_description::options_description(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned int)" (??0options_description@program_options@boost@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@I@Z) error LNK2001: unresolved external symbol "public: class boost::program_options::options_description_easy_init & __thiscall boost::program_options::options_description_easy_init::operator()(char const *,char const *)" (??Roptions_description_easy_init@program_options@boost@@QAEAAV012@PBD0@Z) error LNK2001: unresolved external symbol "public: class boost::program_options::options_description_easy_init & __thiscall boost::program_options::options_description_easy_init::operator()(char const *,class boost::program_options::value_semantic const *,char const *)" (??Roptions_description_easy_init@program_options@boost@@QAEAAV012@PBDPBVvalue_semantic@12@0@Z) error LNK2001: unresolved external symbol "private: virtual void __thiscall boost::program_options::value_semantic_codecvt_helper<char>::parse(class boost::any &,class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > const &,bool)const " (?parse@?$value_semantic_codecvt_helper@D@program_options@boost@@EBEXAAVany@3@ABV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@_N@Z) error LNK2001: unresolved external symbol "public: __thiscall boost::program_options::variables_map::variables_map(void)" (??0variables_map@program_options@boost@@QAE@XZ) error LNK2001: unresolved external symbol "public: static unsigned int const boost::program_options::options_description::m_default_line_length" (?m_default_line_length@options_description@program_options@boost@@2IB) error LNK2001: unresolved external symbol "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl boost::program_options::to_internal(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?to_internal@program_options@boost@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV34@@Z) error LNK2001: unresolved external symbol "public: virtual char const * __thiscall boost::program_options::validation_error::what(void)const " (?what@validation_error@program_options@boost@@UBEPBDXZ) error LNK2001: unresolved external symbol "void __cdecl boost::program_options::notify(class boost::program_options::variables_map &)" (?notify@program_options@boost@@YAXAAVvariables_map@12@@Z) error LNK2001: unresolved external symbol "void __cdecl boost::program_options::store(class boost::program_options::basic_parsed_options<char> const &,class boost::program_options::variables_map &,bool)" (?store@program_options@boost@@YAXABV?$basic_parsed_options@D@12@AAVvariables_map@12@_N@Z) Regards Gianni Il 3/9/2011 9:59 AM, Diederick C. Niehorster ha scritto:

Correct, and with msvc it's *strongly* recommended that you do not define BOOST_ALL_NO_LIB unless you *really* know what you're doing. The correct fix is to set the library search path to search the location of the libraries built when you built Boost (defaults to stage/lib with msvc) - you did build Boost right? HTH, John.

Il 3/9/2011 1:19 PM, John Maddock ha scritto:
John, obviously the error I get is related to the fact the program_options lib is not reached by the linker. My question at this point is different: can I use program_options as header only library? On the basis of what Diederick told me it seems I can't. Now, could you please tell me where can I find the list of boost libs that can be used as header only? Thanks Gianni

A simple search would give you that See http://www.boost.org/doc/libs/1_46_0/more/getting_started/unix-variants.html or http://www.boost.org/doc/libs/1_46_0/more/getting_started/windows.html, depending on your platform, point 3 for both. Best, Dee On Wed, Mar 9, 2011 at 22:11, Gianni Ambrosio <gianni.ambrosio@vi-grade.com> wrote:

Hi...I've followed your advice, and I have downloaded the new boost asio library, which support the fork(). I've downloaded the simple example at the following link: http://think-async.com/Asio/boost_asio_1_5_2/doc/html/boost_asio/example/for..., but when I'm trying to compile I get the following error: **** Build of configuration Debug for project ServerFork **** make all Building file: ../ServerFork.cpp Invoking: GCC C++ Compiler g++ -I/usr/nuovoboost/boost_asio_1_5_2 -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"ServerFork.d" -MT"ServerFork.d" -o"ServerFork.o" "../ServerFork.cpp" In file included from /usr/nuovoboost/boost_asio_1_5_2/boost/asio/detail/impl/throw_error.ipp:21, from /usr/nuovoboost/boost_asio_1_5_2/boost/asio/detail/throw_error.hpp:52, from /usr/nuovoboost/boost_asio_1_5_2/boost/asio/detail/impl/posix_mutex.ipp:23, from /usr/nuovoboost/boost_asio_1_5_2/boost/asio/detail/posix_mutex.hpp:73, from /usr/nuovoboost/boost_asio_1_5_2/boost/asio/detail/mutex.hpp:25, from /usr/nuovoboost/boost_asio_1_5_2/boost/asio/detail/service_registry.hpp:20, from /usr/nuovoboost/boost_asio_1_5_2/boost/asio/impl/io_service.hpp:19, from /usr/nuovoboost/boost_asio_1_5_2/boost/asio/io_service.hpp:767, from ../ServerFork.cpp:1: /usr/nuovoboost/boost_asio_1_5_2/boost/system/system_error.hpp:22: error: expected initializer before ‘:’ token In file included from /usr/nuovoboost/boost_asio_1_5_2/boost/asio/impl/io_service.hpp:19, from /usr/nuovoboost/boost_asio_1_5_2/boost/asio/io_service.hpp:767, from ../ServerFork.cpp:1: /usr/nuovoboost/boost_asio_1_5_2/boost/asio/detail/service_registry.hpp:38: error: expected ‘}’ before end of line /usr/nuovoboost/boost_asio_1_5_2/boost/asio/detail/service_registry.hpp:38: error: expected ‘}’ before end of line /usr/nuovoboost/boost_asio_1_5_2/boost/asio/detail/service_registry.hpp:38: error: expected declaration before end of line /usr/nuovoboost/boost_asio_1_5_2/boost/asio/detail/throw_error.hpp:27: warning: inline function ‘void boost::asio::detail::do_throw_error(const boost::system::error_code&)’ used but never defined /usr/nuovoboost/boost_asio_1_5_2/boost/asio/detail/throw_error.hpp:29: warning: inline function ‘void boost::asio::detail::do_throw_error(const boost::system::error_code&, const char*)’ used but never defined /usr/nuovoboost/boost_asio_1_5_2/boost/system/error_code.hpp:214: warning: ‘boost::system::posix_category’ defined but not used /usr/nuovoboost/boost_asio_1_5_2/boost/system/error_code.hpp:215: warning: ‘boost::system::errno_ecat’ defined but not used /usr/nuovoboost/boost_asio_1_5_2/boost/system/error_code.hpp:216: warning: ‘boost::system::native_ecat’ defined but not used make: *** [ServerFork.o] Error 1 any ideas? thanks... ________________________________ Da: Diederick C. Niehorster <dcnieho@gmail.com> A: boost-users@lists.boost.org Inviato: Mer 9 marzo 2011, 15:27:42 Oggetto: Re: [Boost-users] program_options and BOOST_ALL_NO_LIB=1 A simple search would give you that See http://www.boost.org/doc/libs/1_46_0/more/getting_started/unix-variants.html or http://www.boost.org/doc/libs/1_46_0/more/getting_started/windows.html, depending on your platform, point 3 for both. Best, Dee On Wed, Mar 9, 2011 at 22:11, Gianni Ambrosio <gianni.ambrosio@vi-grade.com> wrote:
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

No. RTFM ;-)
The getting started guide is always the place to look for stuff like that: http://www.boost.org/doc/libs/1_46_0/more/getting_started/windows.html#heade... Oh, it'll tell you how to build the program_options binaries too ;-) HTH, John.
participants (5)
-
Diederick C. Niehorster
-
Gianni Ambrosio
-
John Maddock
-
John Reid
-
Marco Piacentini