• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Xcode 3 and boost-1_35
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Xcode 3 and boost-1_35


  • Subject: Re: Xcode 3 and boost-1_35
  • From: Sandy Martel <email@hidden>
  • Date: Sun, 18 May 2008 23:29:36 +1000


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


References: 
 >Xcode 3 and boost-1_35 (From: Tom Lenaerts <email@hidden>)

  • Prev by Date: Xcode 3 and boost-1_35
  • Next by Date: Re: Conditional dependencies (and linked libraries) in a Xcode project?
  • Previous by thread: Xcode 3 and boost-1_35
  • Next by thread: re:Re: Xcode 3 and boost-1_35
  • Index(es):
    • Date
    • Thread