c++ OSX 10.6.6 上提升 1_46_1。不链接

发布于 2024-10-21 15:58:05 字数 13603 浏览 1 评论 0原文

我下载了c++ boost 1_46_1。解压它并按照安装说明进行操作。

我试图获得一个基本的增强程序来编译和链接,但到目前为止还没有运气。

这是 boost 程序

#include <boost/program_options.hpp>
namespace po = boost::program_options;

#include <iostream>
#include <iterator>
using namespace std;

int main(int ac, char* av[])
{
  try {

    po::options_description desc("Allowed options");
    desc.add_options()
    ("help", "produce help message")
    ("compression", po::value<int>(), "set compression level")
    ;

    po::variables_map vm;        
    po::store(po::parse_command_line(ac, av, desc), vm);
    po::notify(vm);    

    if (vm.count("help")) {
        cout << desc << "\n";
        return 1;
    }

    if (vm.count("compression")) {
        cout << "Compression level was set to " 
        << vm["compression"].as<int>() << ".\n";
    } else {
        cout << "Compression level was not set.\n";
    }
}
catch(exception& e) {
    cerr << "error: " << e.what() << "\n";
    return 1;
}
catch(...) {
    cerr << "Exception of unknown type!\n";
}

return 0;
}

这是我的 makefile

# compiler to use
CC = c++

INC = -I ~/usr/local/boost_1_46_1 
#-I /usr/include/c++/4.2.1
LIB=-L~/usr/local/boost_1_46_1/stage/lib
#LIB =-Lusr/local/lib 
#LIBNAME =-libboost_program_options.dylib
SOURCE = main.cpp

OUTPUT = out
all:
    $(CC) $(INC) $(SOURCE) -o $(OUTPUT) -v $(LIB) -dynamic 

这是我得到的错误

Using built-in specs. Target: i686-apple-darwin10 Configured with: /var/tmp/gcc/gcc-5664~89/src/configure
--disable-checking --enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/
--with-slibdir=/usr/lib --build=i686-apple-darwin10 --program-prefix=i686-apple-darwin10- --host=x86_64-apple-darwin10 --target=i686-apple-darwin10 --with-gxx-include-dir=/include/c++/4.2.1 Thread model: posix gcc version 4.2.1 (Apple Inc. build 5664)  /usr/libexec/gcc/i686-apple-darwin10/4.2.1/cc1plus
-quiet -v -I /Users/smith/usr/local/boost_1_46_1
-imultilib x86_64 -D__DYNAMIC__ main.cpp -fPIC -quiet -dumpbase main.cpp -mmacosx-version-min=10.6.6
-m64 -mtune=core2 -auxbase main -version -D__private_extern__=extern -o /var/folders/y7/y7wCKCc3HJWLBAK5YLrg5E+++TI/-Tmp-//ccumV5Oo.s ignoring nonexistent directory "/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../../../i686-apple-darwin10/include" ignoring nonexistent directory "/Users/smith/usr/local/boost_1_46_1"
#include "..." search starts here:
#include <...> search starts here:  /usr/include/c++/4.2.1  /usr/include/c++/4.2.1/i686-apple-darwin10/x86_64 /usr/include/c++/4.2.1/backward  /usr/local/include  /usr/lib/gcc/i686-apple-darwin10/4.2.1/include /usr/include  /System/Library/Frameworks (framework directory)  /Library/Frameworks (framework directory) End of search list. GNU C++ version 4.2.1 (Apple Inc. build 5664) (i686-apple-darwin10)     compiled by GNU C version 4.2.1 (Apple Inc. build 5664). GGC heuristics: --param ggc-min-expand=150
--param ggc-min-heapsize=131072 Compiler executable checksum: 35e7c8ac2c3562481c35a1833320fc34  /usr/libexec/gcc/i686-apple-darwin10/4.2.1/as
-arch x86_64 -force_cpusubtype_ALL -o /var/folders/y7/y7wCKCc3HJWLBAK5YLrg5E+++TI/-Tmp-//cce6AA55.o /var/folders/y7/y7wCKCc3HJWLBAK5YLrg5E+++TI/-Tmp-//ccumV5Oo.s /usr/libexec/gcc/i686-apple-darwin10/4.2.1/collect2
-dynamic -arch x86_64 -dynamic -macosx_version_min 10.6.6 -weak_reference_mismatches non-weak -o out -lcrt1.10.6.o
-L~/usr/local/boost_1_46_1/stage/lib -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/x86_64
-L/usr/lib/gcc/i686-apple-darwin10/4.2.1/x86_64
-L/usr/lib/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1
-L/usr/lib/gcc/i686-apple-darwin10/4.2.1
-L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../../i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../.. /var/folders/y7/y7wCKCc3HJWLBAK5YLrg5E+++TI/-Tmp-//cce6AA55.o
-lstdc++ -lSystem -lgcc -lSystem ld: warning: directory '~/usr/local/boost_1_46_1/stage/lib' following -L not found Undefined symbols:   "boost::program_options::operator<<(std::basic_ostream<char, std::char_traits<char> >&, boost::program_options::options_description const&)", referenced from:
      _main in cce6AA55.o   "vtable for boost::program_options::variables_map", referenced from:
      boost::program_options::variables_map::~variables_map()in cce6AA55.o   "boost::program_options::detail::cmdline::set_additional_parser(boost::function1<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>)", referenced from:
      boost::program_options::basic_command_line_parser<char>::extra_parser(boost::function1<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>)in cce6AA55.o   "typeinfo for boost::program_options::validation_error", referenced from:
      typeinfo for boost::exception_detail::error_info_injector<boost::program_options::validation_error>in cce6AA55.o
      typeinfo for boost::program_options::invalid_option_valuein cce6AA55.o   "boost::program_options::detail::cmdline::cmdline(std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)", referenced from:
      boost::program_options::basic_command_line_parser<char>::basic_command_line_parser(int, char const* const*)in cce6AA55.o   "boost::program_options::options_description_easy_init::operator()(char const*, char const*)", referenced from:
      _main in cce6AA55.o   "boost::program_options::value_semantic_codecvt_helper<char>::parse(boost::any&, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, bool) const", referenced from:
      vtable for boost::program_options::typed_value<int, char>in cce6AA55.o   "boost::program_options::detail::cmdline::style(int)", referenced from:
      boost::program_options::basic_command_line_parser<char>::style(int)in cce6AA55.o   "boost::program_options::to_internal(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
      std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > boost::program_options::to_internal<std::basic_string<char, std::char_traits<char>, std::allocator<char> >
>(std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)in cce6AA55.o   "boost::program_options::notify(boost::program_options::variables_map&)", referenced from:
      _main in cce6AA55.o   "boost::program_options::options_description_easy_init::operator()(char const*, boost::program_options::value_semantic const*, char const*)", referenced from:
      _main in cce6AA55.o   "boost::program_options::store(boost::program_options::basic_parsed_options<char> const&, boost::program_options::variables_map&, bool)", referenced from:
      _main in cce6AA55.o   "boost::program_options::arg", referenced from:
      boost::program_options::typed_value<int, char>::name() constin cce6AA55.o
      boost::program_options::typed_value<int, char>::name() constin cce6AA55.o   "vtable for boost::program_options::value_semantic_codecvt_helper<char>", referenced from:
      boost::program_options::value_semantic_codecvt_helper<char>::value_semantic_codecvt_helper()in cce6AA55.o
      boost::program_options::value_semantic_codecvt_helper<char>::~value_semantic_codecvt_helper()in cce6AA55.o   "typeinfo for boost::program_options::value_semantic_codecvt_helper<char>", referenced from:
      typeinfo for boost::program_options::typed_value<int, char>in cce6AA55.o   "boost::program_options::options_description::add_options()", referenced from:
      _main in cce6AA55.o   "boost::program_options::validation_error::validation_error(boost::program_options::validation_error::kind_t, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
      std::basic_string<char, std::char_traits<char>, std::allocator<char> > const& boost::program_options::validators::get_single_string<char>(std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, bool)in cce6AA55.o
      std::basic_string<char, std::char_traits<char>, std::allocator<char> > const& boost::program_options::validators::get_single_string<char>(std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, bool)in cce6AA55.o   "vtable for boost::program_options::validation_error", referenced from:
      boost::program_options::validation_error::~validation_error()in cce6AA55.o
      boost::program_options::validation_error::~validation_error()in cce6AA55.o
      boost::program_options::validation_error::validation_error(boost::program_options::validation_error const&)in cce6AA55.o   "boost::program_options::validation_error::what() const", referenced from:
      vtable for boost::exception_detail::error_info_injector<boost::program_options::validation_error>in cce6AA55.o
      vtable for boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::program_options::validation_error>
>in cce6AA55.o
      vtable for boost::exception_detail::error_info_injector<boost::program_options::invalid_option_value>in cce6AA55.o
      vtable for boost::program_options::invalid_option_valuein cce6AA55.o
      vtable for boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::program_options::invalid_option_value>
>in cce6AA55.o   "boost::program_options::variables_map::variables_map()", referenced from:
      _main in cce6AA55.o   "boost::program_options::options_description::options_description(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, unsigned int)", referenced from:
      _main in cce6AA55.o   "boost::program_options::detail::cmdline::run()", referenced from:
      boost::program_options::basic_command_line_parser<char>::run() in cce6AA55.o   "boost::program_options::invalid_option_value::invalid_option_value(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
      void boost::program_options::validate<int, char>(boost::any&, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, int*, long)in cce6AA55.o   "boost::program_options::options_description::m_default_line_length", referenced from:
      _main in cce6AA55.o
      _main in cce6AA55.o   "boost::program_options::detail::cmdline::set_options_description(boost::program_options::options_description const&)", referenced from:
      boost::program_options::basic_command_line_parser<char>::options(boost::program_options::options_description const&)in cce6AA55.o   "boost::program_options::validators::check_first_occurrence(boost::any const&)", referenced from:
      void boost::program_options::validate<int, char>(boost::any&, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, int*, long)in cce6AA55.o   "boost::program_options::abstract_variables_map::operator[](std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const", referenced from:
      boost::program_options::variables_map::operator[](std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) constin cce6AA55.o ld: symbol(s) not found collect2: ld returned 1 exit status make: *** [all] Error 1

i downloaded c++ boost 1_46_1. unzipped it and followed the installation instructions.

i have tried to get a basic boost program to compile and link, but with no luck so far.

here it the boost program

#include <boost/program_options.hpp>
namespace po = boost::program_options;

#include <iostream>
#include <iterator>
using namespace std;

int main(int ac, char* av[])
{
  try {

    po::options_description desc("Allowed options");
    desc.add_options()
    ("help", "produce help message")
    ("compression", po::value<int>(), "set compression level")
    ;

    po::variables_map vm;        
    po::store(po::parse_command_line(ac, av, desc), vm);
    po::notify(vm);    

    if (vm.count("help")) {
        cout << desc << "\n";
        return 1;
    }

    if (vm.count("compression")) {
        cout << "Compression level was set to " 
        << vm["compression"].as<int>() << ".\n";
    } else {
        cout << "Compression level was not set.\n";
    }
}
catch(exception& e) {
    cerr << "error: " << e.what() << "\n";
    return 1;
}
catch(...) {
    cerr << "Exception of unknown type!\n";
}

return 0;
}

here is my makefile

# compiler to use
CC = c++

INC = -I ~/usr/local/boost_1_46_1 
#-I /usr/include/c++/4.2.1
LIB=-L~/usr/local/boost_1_46_1/stage/lib
#LIB =-Lusr/local/lib 
#LIBNAME =-libboost_program_options.dylib
SOURCE = main.cpp

OUTPUT = out
all:
    $(CC) $(INC) $(SOURCE) -o $(OUTPUT) -v $(LIB) -dynamic 

here is the error i get

Using built-in specs. Target: i686-apple-darwin10 Configured with: /var/tmp/gcc/gcc-5664~89/src/configure
--disable-checking --enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/
--with-slibdir=/usr/lib --build=i686-apple-darwin10 --program-prefix=i686-apple-darwin10- --host=x86_64-apple-darwin10 --target=i686-apple-darwin10 --with-gxx-include-dir=/include/c++/4.2.1 Thread model: posix gcc version 4.2.1 (Apple Inc. build 5664)  /usr/libexec/gcc/i686-apple-darwin10/4.2.1/cc1plus
-quiet -v -I /Users/smith/usr/local/boost_1_46_1
-imultilib x86_64 -D__DYNAMIC__ main.cpp -fPIC -quiet -dumpbase main.cpp -mmacosx-version-min=10.6.6
-m64 -mtune=core2 -auxbase main -version -D__private_extern__=extern -o /var/folders/y7/y7wCKCc3HJWLBAK5YLrg5E+++TI/-Tmp-//ccumV5Oo.s ignoring nonexistent directory "/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../../../i686-apple-darwin10/include" ignoring nonexistent directory "/Users/smith/usr/local/boost_1_46_1"
#include "..." search starts here:
#include <...> search starts here:  /usr/include/c++/4.2.1  /usr/include/c++/4.2.1/i686-apple-darwin10/x86_64 /usr/include/c++/4.2.1/backward  /usr/local/include  /usr/lib/gcc/i686-apple-darwin10/4.2.1/include /usr/include  /System/Library/Frameworks (framework directory)  /Library/Frameworks (framework directory) End of search list. GNU C++ version 4.2.1 (Apple Inc. build 5664) (i686-apple-darwin10)     compiled by GNU C version 4.2.1 (Apple Inc. build 5664). GGC heuristics: --param ggc-min-expand=150
--param ggc-min-heapsize=131072 Compiler executable checksum: 35e7c8ac2c3562481c35a1833320fc34  /usr/libexec/gcc/i686-apple-darwin10/4.2.1/as
-arch x86_64 -force_cpusubtype_ALL -o /var/folders/y7/y7wCKCc3HJWLBAK5YLrg5E+++TI/-Tmp-//cce6AA55.o /var/folders/y7/y7wCKCc3HJWLBAK5YLrg5E+++TI/-Tmp-//ccumV5Oo.s /usr/libexec/gcc/i686-apple-darwin10/4.2.1/collect2
-dynamic -arch x86_64 -dynamic -macosx_version_min 10.6.6 -weak_reference_mismatches non-weak -o out -lcrt1.10.6.o
-L~/usr/local/boost_1_46_1/stage/lib -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/x86_64
-L/usr/lib/gcc/i686-apple-darwin10/4.2.1/x86_64
-L/usr/lib/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1
-L/usr/lib/gcc/i686-apple-darwin10/4.2.1
-L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../../i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../.. /var/folders/y7/y7wCKCc3HJWLBAK5YLrg5E+++TI/-Tmp-//cce6AA55.o
-lstdc++ -lSystem -lgcc -lSystem ld: warning: directory '~/usr/local/boost_1_46_1/stage/lib' following -L not found Undefined symbols:   "boost::program_options::operator<<(std::basic_ostream<char, std::char_traits<char> >&, boost::program_options::options_description const&)", referenced from:
      _main in cce6AA55.o   "vtable for boost::program_options::variables_map", referenced from:
      boost::program_options::variables_map::~variables_map()in cce6AA55.o   "boost::program_options::detail::cmdline::set_additional_parser(boost::function1<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>)", referenced from:
      boost::program_options::basic_command_line_parser<char>::extra_parser(boost::function1<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>)in cce6AA55.o   "typeinfo for boost::program_options::validation_error", referenced from:
      typeinfo for boost::exception_detail::error_info_injector<boost::program_options::validation_error>in cce6AA55.o
      typeinfo for boost::program_options::invalid_option_valuein cce6AA55.o   "boost::program_options::detail::cmdline::cmdline(std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)", referenced from:
      boost::program_options::basic_command_line_parser<char>::basic_command_line_parser(int, char const* const*)in cce6AA55.o   "boost::program_options::options_description_easy_init::operator()(char const*, char const*)", referenced from:
      _main in cce6AA55.o   "boost::program_options::value_semantic_codecvt_helper<char>::parse(boost::any&, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, bool) const", referenced from:
      vtable for boost::program_options::typed_value<int, char>in cce6AA55.o   "boost::program_options::detail::cmdline::style(int)", referenced from:
      boost::program_options::basic_command_line_parser<char>::style(int)in cce6AA55.o   "boost::program_options::to_internal(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
      std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > boost::program_options::to_internal<std::basic_string<char, std::char_traits<char>, std::allocator<char> >
>(std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)in cce6AA55.o   "boost::program_options::notify(boost::program_options::variables_map&)", referenced from:
      _main in cce6AA55.o   "boost::program_options::options_description_easy_init::operator()(char const*, boost::program_options::value_semantic const*, char const*)", referenced from:
      _main in cce6AA55.o   "boost::program_options::store(boost::program_options::basic_parsed_options<char> const&, boost::program_options::variables_map&, bool)", referenced from:
      _main in cce6AA55.o   "boost::program_options::arg", referenced from:
      boost::program_options::typed_value<int, char>::name() constin cce6AA55.o
      boost::program_options::typed_value<int, char>::name() constin cce6AA55.o   "vtable for boost::program_options::value_semantic_codecvt_helper<char>", referenced from:
      boost::program_options::value_semantic_codecvt_helper<char>::value_semantic_codecvt_helper()in cce6AA55.o
      boost::program_options::value_semantic_codecvt_helper<char>::~value_semantic_codecvt_helper()in cce6AA55.o   "typeinfo for boost::program_options::value_semantic_codecvt_helper<char>", referenced from:
      typeinfo for boost::program_options::typed_value<int, char>in cce6AA55.o   "boost::program_options::options_description::add_options()", referenced from:
      _main in cce6AA55.o   "boost::program_options::validation_error::validation_error(boost::program_options::validation_error::kind_t, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
      std::basic_string<char, std::char_traits<char>, std::allocator<char> > const& boost::program_options::validators::get_single_string<char>(std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, bool)in cce6AA55.o
      std::basic_string<char, std::char_traits<char>, std::allocator<char> > const& boost::program_options::validators::get_single_string<char>(std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, bool)in cce6AA55.o   "vtable for boost::program_options::validation_error", referenced from:
      boost::program_options::validation_error::~validation_error()in cce6AA55.o
      boost::program_options::validation_error::~validation_error()in cce6AA55.o
      boost::program_options::validation_error::validation_error(boost::program_options::validation_error const&)in cce6AA55.o   "boost::program_options::validation_error::what() const", referenced from:
      vtable for boost::exception_detail::error_info_injector<boost::program_options::validation_error>in cce6AA55.o
      vtable for boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::program_options::validation_error>
>in cce6AA55.o
      vtable for boost::exception_detail::error_info_injector<boost::program_options::invalid_option_value>in cce6AA55.o
      vtable for boost::program_options::invalid_option_valuein cce6AA55.o
      vtable for boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::program_options::invalid_option_value>
>in cce6AA55.o   "boost::program_options::variables_map::variables_map()", referenced from:
      _main in cce6AA55.o   "boost::program_options::options_description::options_description(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, unsigned int)", referenced from:
      _main in cce6AA55.o   "boost::program_options::detail::cmdline::run()", referenced from:
      boost::program_options::basic_command_line_parser<char>::run() in cce6AA55.o   "boost::program_options::invalid_option_value::invalid_option_value(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
      void boost::program_options::validate<int, char>(boost::any&, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, int*, long)in cce6AA55.o   "boost::program_options::options_description::m_default_line_length", referenced from:
      _main in cce6AA55.o
      _main in cce6AA55.o   "boost::program_options::detail::cmdline::set_options_description(boost::program_options::options_description const&)", referenced from:
      boost::program_options::basic_command_line_parser<char>::options(boost::program_options::options_description const&)in cce6AA55.o   "boost::program_options::validators::check_first_occurrence(boost::any const&)", referenced from:
      void boost::program_options::validate<int, char>(boost::any&, std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, int*, long)in cce6AA55.o   "boost::program_options::abstract_variables_map::operator[](std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const", referenced from:
      boost::program_options::variables_map::operator[](std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) constin cce6AA55.o ld: symbol(s) not found collect2: ld returned 1 exit status make: *** [all] Error 1

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

甜妞爱困 2024-10-28 15:58:05

您缺少 -lboost_program_options

all:
    $(CC) $(INC) $(SOURCE) -o $(OUTPUT) $(LIB) -lboost_program_options -dynamic 

You lack -lboost_program_options

all:
    $(CC) $(INC) $(SOURCE) -o $(OUTPUT) $(LIB) -lboost_program_options -dynamic 
就此别过 2024-10-28 15:58:05

您提供的链接器路径错误:

警告:目录 '~/usr/local/boost_1_46_1/stage/lib' 以下 -L 未找到

导致不链接您的对象

you are providing linker with wrong path:

warning: directory '~/usr/local/boost_1_46_1/stage/lib' following -L not found

results in not linking your objects

瑾夏年华 2024-10-28 15:58:05

链接器输出包括以下行:

忽略不存在的目录“/Users/smith/usr/local/boost_1_46_1”

因此您期望库所在的位置与它们实际所在的位置之间存在一些不匹配...

The linker output includes the line:

ignoring nonexistent directory "/Users/smith/usr/local/boost_1_46_1"

so there is some mismatch between where you expect the libraries to be and where they actually are...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文