Re: re:Re: Xcode 3 and boost-1_35
Re: re:Re: Xcode 3 and boost-1_35
- Subject: Re: re:Re: Xcode 3 and boost-1_35
- From: Sandy Martel <email@hidden>
- Date: Sun, 18 May 2008 17:46:27 -0700
Hi Tom,
like I said, I had the debug problem before, so it was easy for me to pinpoint it. But the release problem was new to me, I just took your code example, look at the generated command-line when compiling release and debug and tried to aligned both to use the same options. I got your code example to work correctly in both debug and release. The option that was causing problem seems to be "-fvisibility=hidden", are you sure that it's not there when you compile in release?
Anyway, I don't know anything more, I was just curious because we use boost a lot but haven't switch to Xcode 3 yet...
Sandy.
On Monday, May 19, 2008, at 04:26AM, "Tom Lenaerts" <email@hidden> wrote:
>>
>Dear Sandy
>
>
>Thansk for the quick reply. The debug problem makes sense.
>Yet the option "Symbols hidden by default" is already unchecked in my project file. Checking or unchecking it does not resolve that problem. The strangest thing is that when compiling
>from command-line the thing works just fine. So there has to some other option set in Xcode
>that screws things up. Do you have any suggestions?
>
>kind regards
>
>Tom
>
>
>
>
>>The debug case is easy, Xcode 3 seems to define these when compiling
>>in debug:
>>
>>_GLIBCXX_DEBUG
>>_GLIBCXX_DEBUG_PEDANTIC
>>
>>which mean that your code is using the debug version of all STL
>>containers, macports is not, so they can't link together... Had the
>>same problem on Tiger when using trying to use STL debug containers
>>(but they are not on by default in Tiger).
>>
>>For the release case, there seems to be a problem with the option
>>"Symbols Hidden by Default" (?) Uncheck this and it will work. Maybe
>>it would worth investigating and filling a bug report...
>>
>>Sandy.
>>
>>Le 08-05-18 à 21:12, Tom Lenaerts a écrit :
>>
>>> Hi everyone,
>>>
>>> I recently obtained a new Mackbook pro with Os X leopard on it. I
>>> installed the latest Boost library using Macports .
>>> Yet when I take my previous projects (build on Os X tiger with
>>> Xcode 2.5 and Boost -1_34_1) I have problems with the
>>> programming_options library.
>>>
>>> So I created a simple C++ command line project (see main in the end
>>> of this mail) to track down the problem and found that Xcode is
>>> having problems with strings in the program options.
>>> I'm writing Xcode because when I compile the same code from command
>>> line using g++ there are no problems at all. So it has to be
>>> somewhere in the specifications.
>>>
>>> I'm pretty sure that I specified where to look for the header files
>>> and the libraries. I added the libprogram_options_mt-1_35.dylib as
>>> a framework
>>> to the Xcode project. The code compiles in Release configuration
>>> but when I try to run it I get :
>>>
>>>>>> ./test -R 1 -L 1 -A 20 -S data.in -O result.txt
>>> terminate called after throwing an instance of 'boost::bad_any_cast'
>>> what(): boost::bad_any_cast: failed conversion using boost::any_cast
>>> Abort trap
>>>
>>> The problem arises as soon as the code starts to process the
>>> vector<string> arguments.
>>>
>>> When I then try to compile the same code in Debug model I get three
>>> errors:
>>>
>>> mkdir /Users/tlenaert/Desktop/test/build/Debug
>>> cd /Users/tlenaert/Desktop/test
>>> /Developer/usr/bin/g++-4.0 -o /Users/tlenaert/Desktop/test/build/
>>> Debug/test -L/Users/tlenaert/Desktop/test/build/Debug -L/opt/local/
>>> lib -L/opt/local/lib -F/Users/tlenaert/Desktop/test/build/Debug -
>>> filelist /Users/tlenaert/Desktop/test/build/test.build/Debug/
>>> test.build/Objects-normal/i386/test.LinkFileList -
>>> lboost_program_options-mt-1_35 -arch i386 -mmacosx-version-min=10.5 -
>>> isysroot /Developer/SDKs/MacOSX10.5.sdk
>>> Undefined symbols:
>>> "boost
>>> ::program_options
>>> ::value_semantic_codecvt_helper<char>::parse(boost::any&,
>>> __gnu_debug_def::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<__gnu_debug_def::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> > > >, char>in main.o
>>> vtable for boost::program_options::typed_value<int, char>in main.o
>>> vtable for boost::program_options::typed_value<double, char>in
>>> main.o
>>> "boost
>>> ::program_options
>>> ::detail
>>> ::cmdline::cmdline(__gnu_debug_def::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**)in main.o
>>> "boost::program_options::validate(boost::any&,
>>> __gnu_debug_def::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&, std::basic_string<char,
>>> std::char_traits<char>, std::allocator<char> >*, int)", referenced
>>> from:
>>> void boost::program_options::validate<std::basic_string<char,
>>> std::char_traits<char>, std::allocator<char> >, char>(boost::any&,
>>> __gnu_debug_def::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&,
>>> __gnu_debug_def::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> > > >*, int)in main.o
>>> ld: symbol(s) not found
>>> collect2: ld returned 1 exit status
>>>
>>> "boost
>>> ::program_options
>>> ::value_semantic_codecvt_helper<char>::parse(boost::any&,
>>> __gnu_debug_def::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<__gnu_debug_def::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> > > >, char>in main.o
>>> vtable for boost::program_options::typed_value<int, char>in
>>> main.o
>>> vtable for boost::program_options::typed_value<double,
>>> char>in main.o
>>>
>>> "boost
>>> ::program_options
>>> ::detail
>>> ::cmdline::cmdline(__gnu_debug_def::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**)in main.o
>>> "boost::program_options::validate(boost::any&,
>>> __gnu_debug_def::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&, std::basic_string<char,
>>> std::char_traits<char>, std::allocator<char> >*, int)", referenced
>>> from:
>>> void
>>> boost::program_options::validate<std::basic_string<char,
>>> std::char_traits<char>, std::allocator<char> >, char>(boost::any&,
>>> __gnu_debug_def::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&,
>>> __gnu_debug_def::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> > > >*, int)in main.o
>>> ld: symbol(s) not found
>>> collect2: ld returned 1 exit status
>>> Build failed (3 errors)
>>>
>>>
>>> IS there anyone here who came across a similar problem or who can
>>> help me out?
>>>
>>> Thanks a lot
>>>
>>> Tom
>>>
>>>
>>>
>>>
>>>
>>>
>>> ====================
>>> main.cpp
>>> ===================
>>> #include <iostream>
>>> #include <vector>
>>> #include <string>
>>> #include <boost/program_options.hpp>
>>> namespace po = boost::program_options;
>>>
>>> using namespace std;
>>>
>>> int main (int argc, char * argv[]) {
>>> //setting up the simulation
>>> double run;
>>> double additional;
>>> int limit;
>>>
>>> po::options_description desc("Allowed options");
>>> desc.add_options()
>>> ("help", "produce help message")
>>> ("run,R", po::value<double>(&run)->default_value(1000),
>>> "identification of run")
>>> ("limit,L", po::value<int>(&limit)->default_value(1), "threshold
>>> for stochastic and deterministic dynamics")
>>> ("additional,A", po::value<double>(&additional)-
>>> >default_value(20), "Additional years to run after threshold is
>>> reached")
>>> ("settings,S",po::value<vector<string> >(),"File with simulation
>>> settings")
>>> ("output,O",po::value<vector<string> >(),"Output file");
>>>
>>>
>>> po::variables_map vm;
>>> po::store(po::parse_command_line(argc, argv, desc), vm);
>>> po::notify(vm);
>>>
>>> if (vm.count("help")) {
>>> cout << desc << "n";
>>> return 1;
>>> }
>>>
>>> string inputfname;
>>> if(vm.count("settings")){
>>> inputfname = (vm["settings"].as<vector<string> >())[0];
>>> cout << "Input file is "<< inputfname << endl;
>>> }
>>>
>>> string ouputfname;
>>> if(vm.count("output")){
>>> ouputfname = (vm["output"].as<vector<string> >())[0];
>>> cout << "Output file is "<< ouputfname << endl;
>>> }
>>>
>>>
>>> return 0;
>>> }
>>>
>>>
>>> _______________________________________________
>>> Do not post admin requests to the list. They will be ignored.
>>> Xcode-users mailing list (email@hidden)
>>> Help/Unsubscribe/Update your Subscription:
>>>
>>> This email sent to email@hidden
>>
>>
>
>
>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden