I wanted to use streams in my code and thought that the upcoming C ++ 0x extensions would be convenient, as they would eventually become the standard. This seemed reliable in the future without the need for additional libraries such as boost :: thread.
Unfortunately, I could not find useful information about which functions regarding streams are currently supported by gcc. I use unique_locks, which do not work yet. This is the result of the linker:
.build_debug/src/core/simulator.o: In function `Simulator::start(int, int, int, int)': simulator.cpp:(.text+0x1fc): undefined reference to `_ZSt4lockISt11unique_lockISt5mutexES2_IEEvRT_RT0_DpRT1_' .build_debug/src/core/simulator.o: In function `Simulator::resume()': simulator.cpp:(.text+0x351): undefined reference to `_ZSt4lockISt11unique_lockISt5mutexES2_IEEvRT_RT0_DpRT1_' .build_debug/src/core/simulator.o: In function `Simulator::pause()': simulator.cpp:(.text+0x417): undefined reference to `_ZSt4lockISt11unique_lockISt5mutexES2_IEEvRT_RT0_DpRT1_' .build_debug/src/core/simulator.o: In function `Simulator::stop()': simulator.cpp:(.text+0x4cd): undefined reference to `_ZSt4lockISt11unique_lockISt5mutexES2_IEEvRT_RT0_DpRT1_'
Does anyone understand these messages? I assume that they reference the use of unique_lock. But why do these errors occur?
My source code is similar to the following:
std::unique_lock<std::mutex> lkIntra(intraMtx, std::defer_lock); std::unique_lock<std::mutex> lkInter(interMtx, std::defer_lock); std::lock(lkIntra, lkInter);
EDIT: I tried to compile this with gcc 4.3.X and 4.4.5. The linker was g ++ 4.3, 4.4, and 4.5.
EDIT2: I just tried using boost equivalents for std streams. After adding the "-lboost_thread" compiler flag, the compilation worked. Without which the binding process led to similar error messages. Now I'm wondering if I need to do something when using standard threads (I already tried "-lpthread").
source share