[context] build error with -std=c++0x

Hi, i'm trying to get boost.context (from boost vault) to build with g++ 4.4.1 and 4.5.1 with -std=c++0x on both compilers i'm getting this error: In function `main': test.cpp:(.text+0x94): undefined reference to `boost::contexts::context::operator=(boost::contexts::context&&)' collect2: ld returned 1 exit status the test case is the following code: ------- test.cpp -------------- #include <boost/context.hpp> #include <iostream> using namespace std; void CallWrapper(void* p) { cout << " inside CallWrapper " << endl; }; int main() { boost::context ctx; boost::context current = boost::context::current(); ctx = boost::context::create(CallWrapper, current , 0 , boost::context::default_stacksize); cout << " after creating the context, before executing it " << endl; current.jump_to(ctx); cout << " after executing the context " << endl; }; ----------------------------------- i built the code with this command line: g++ -std=c++0x `pkg-config --cflags boost-1.43` test.cpp -o xtest `pkg-config --libs boost-context` -lboost_context -lboost_system when i remove -std=c++0x from the command line, the code compiles and runs fine Charles J. Quarra

On Sat, Nov 20, 2010 at 09:05:23AM -0800, Charlls Quarra wrote:
Hi,
i'm trying to get boost.context (from boost vault) to build with g++ 4.4.1 and 4.5.1 with -std=c++0x
on both compilers i'm getting this error:
In function `main': test.cpp:(.text+0x94): undefined reference to `boost::contexts::context::operator=(boost::contexts::context&&)' collect2: ld returned 1 exit status
i built the code with this command line:
g++ -std=c++0x `pkg-config --cflags boost-1.43` test.cpp -o xtest `pkg-config --libs boost-context` -lboost_context -lboost_system
when i remove -std=c++0x from the command line, the code compiles and runs fine
You should most probably build both the library and the application with the same language level. This commonly occurs on platforms where differences in build settings cause more errors, like on VC++ with the different runtimes and other compiler tunables. You're probably looking at an ODR violation, as there tends to be some rather different types resulting from building with and without 0x, particularly if conditionally defined around it. -- Lars Viklund | zao@acc.umu.se

Hi,
De: Lars Viklund <zao@acc.umu.se>
You should most probably build both the library and the application with the same language level.
This commonly occurs on platforms where differences in build settings cause more errors, like on VC++ with the different runtimes and other compiler tunables.
sorry for the replying delay You are right, i was trying to link against boost built without c++0x, so i went back into the build directory and ran: bjam -a architecture=x86 instruction-set=i686 toolset=gcc cxxflags=-std=gnu++0x --with-context stage verified that the library had the appropiate symbols: nm stage/libboost_context.so.1.43 | c++filt | grep '&&' 00002d09 W boost::remove_reference<boost::contexts::context&>::type&& boost::move<boost::contexts::context&>(boost::contexts::context&&&) 00002408 T boost::contexts::context::context(boost::contexts::context&&) 000023d4 T boost::contexts::context::context(boost::contexts::context&&) 0000243c T boost::contexts::context::operator=(boost::contexts::context&&) 00002d5d W std::remove_reference<boost::contexts::context::impl_t*&>::type&& std::move<boost::contexts::context::impl_t*&>(boost::contexts::context::impl_t*&&&) I tried to rebuild the test project exactly as in my first post, but i got this error: boost_1_43_0/stage/libboost_context.so: undefined reference to `boost::contexts::context::context(boost::contexts::context const&)' collect2: ld returned 1 exit status
You're probably looking at an ODR violation, as there tends to be some rather different types resulting from building with and without 0x, particularly if conditionally defined around it.
-- Lars Viklund | zao@acc.umu.se _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Charlls Quarra wrote:
Hi,
sorry for the replying delay
You are right, i was trying to link against boost built without c++0x, so i went back into the build directory and ran:
bjam -a architecture=x86 instruction-set=i686 toolset=gcc cxxflags=-std=gnu++0x --with-context stage
verified that the library had the appropiate symbols:
nm stage/libboost_context.so.1.43 | c++filt | grep '&&' 00002d09 W boost::remove_reference<boost::contexts::context&>::type&& boost::move<boost::contexts::context&>(boost::contexts::context&&&) 00002408 T boost::contexts::context::context(boost::contexts::context&&) 000023d4 T boost::contexts::context::context(boost::contexts::context&&) 0000243c T boost::contexts::context::operator=(boost::contexts::context&&) 00002d5d W std::remove_reference<boost::contexts::context::impl_t*&>::type&& std::move<boost::contexts::context::impl_t*&>(boost::contexts::context::impl_t*&&&)
This concerns the move constructor and assignments.
I tried to rebuild the test project exactly as in my first post, but i got this error:
boost_1_43_0/stage/libboost_context.so: undefined reference to `boost::contexts::context::context(boost::contexts::context const&)' collect2: ld returned 1 exit status
The message is telling you that the copy constructor is undefined, which is normal as a context is not copy contructible. HTH, Vicente -- View this message in context: http://boost.2283326.n4.nabble.com/context-build-error-with-std-c-0x-tp30517... Sent from the Boost - Dev mailing list archive at Nabble.com.

I'll correct this issue in the next release. Currently I'm struggeling with boost.build. Oliver -------- Original-Nachricht --------
Datum: Wed, 24 Nov 2010 20:05:07 -0800 (PST) Von: Vicente Botet <vicente.botet@wanadoo.fr> An: boost@lists.boost.org Betreff: Re: [boost] [context] build error with -std=c++0x
Charlls Quarra wrote:
Hi,
sorry for the replying delay
You are right, i was trying to link against boost built without c++0x,
so
i went back into the build directory and ran:
bjam -a architecture=x86 instruction-set=i686 toolset=gcc cxxflags=-std=gnu++0x --with-context stage
verified that the library had the appropiate symbols:
nm stage/libboost_context.so.1.43 | c++filt | grep '&&' 00002d09 W boost::remove_reference<boost::contexts::context&>::type&& boost::move<boost::contexts::context&>(boost::contexts::context&&&) 00002408 T boost::contexts::context::context(boost::contexts::context&&) 000023d4 T boost::contexts::context::context(boost::contexts::context&&) 0000243c T boost::contexts::context::operator=(boost::contexts::context&&) 00002d5d W std::remove_reference<boost::contexts::context::impl_t*&>::type&&
std::move<boost::contexts::context::impl_t*&>(boost::contexts::context::impl_t*&&&)
This concerns the move constructor and assignments.
I tried to rebuild the test project exactly as in my first post, but i got this error:
boost_1_43_0/stage/libboost_context.so: undefined reference to `boost::contexts::context::context(boost::contexts::context const&)' collect2: ld returned 1 exit status
The message is telling you that the copy constructor is undefined, which is normal as a context is not copy contructible.
HTH, Vicente -- View this message in context: http://boost.2283326.n4.nabble.com/context-build-error-with-std-c-0x-tp30517... Sent from the Boost - Dev mailing list archive at Nabble.com. _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
-- GRATIS! Movie-FLAT mit über 300 Videos. Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome
participants (4)
-
Charlls Quarra
-
Lars Viklund
-
Oliver Kowalke
-
Vicente Botet