One more information:<div><br></div><div>Andreas, i'm compiling at least 10 .cpp codes, many of them using string without problems.</div><div><br></div><div>The error is occurring just in this function, but i've assured that string libraries are included.<br>
<br><div class="gmail_quote">On Tue, Apr 3, 2012 at 3:46 PM, Mauricio Klein <span dir="ltr"><<a href="mailto:mauricio.klein.msk@gmail.com">mauricio.klein.msk@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The complete error is the following:<div><br></div><div>----------------------------</div><div><div>CMakeFiles/MonitoraITSchedulerAgent.dir/SourceCode/src/Executor.cpp.o: In function `Executor::execute(Service*, unsigned int)':</div>
<div>Executor.cpp:(.text+0x8c): undefined reference to `Executor::runCommand(char const*, unsigned int, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)'</div><div>CMakeFiles/MonitoraITSchedulerAgent.dir/SourceCode/src/ServiceProvider.cpp.o: In function `ServiceProvider::sendDiscovery()':</div>
<div>ServiceProvider.cpp:(.text+0x9b6): undefined reference to `Executor::runCommand(char const*, unsigned int, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)'</div><div>
collect2: ld returned 1 exit status</div><div>make[2]: *** [MonitoraITSchedulerAgent] Error 1</div><div>make[1]: *** [CMakeFiles/MonitoraITSchedulerAgent.dir/all] Error 2</div><div>make: *** [all] Error 2</div></div><div>
----------------------------</div><div><br></div><div>The function header that is generating the error is:</div><div><br></div><div>----------------------------</div><div>int runCommand(const char* command, unsigned int timeout, string& output);</div>
<div>----------------------------</div><div><br></div><div>I've already included "<string>" and declared "using namespace std".</div><div><br></div><div>Thanks for any reply!<div><div class="h5">
<br><br><div class="gmail_quote">
On Tue, Apr 3, 2012 at 3:37 PM, Andreas Pakulat <span dir="ltr"><<a href="mailto:apaku@gmx.de" target="_blank">apaku@gmx.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>On 03.04.12 14:26:01, Mauricio Klein wrote:<br>
> Hello fellows!<br>
><br>
> I'm compiling my code using CMake and i'm receiving a linker error like<br>
> this:<br>
> std::basic_string<char, std::char_traits<char>, std::allocator<char> ><br>
<br>
</div>When you get errors, post the complete error message and not just a<br>
part. The above is completely useless.<br>
<div><br>
> After few researches on the internet, i realized that this kind of error<br>
> occurs when compiling a C++ code with GCC, instead G++.<br>
><br>
> My question is: how can i force CMake to use G++ as default compiler?<br>
<br>
</div>CMake already does this when you feed it c++ sources. So check you<br>
project wether you maybe disabled C++ support, or wether you maybe have<br>
C++ code in .c files.<br>
<br>
Andreas<br>
<br>
--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
</blockquote></div><br><br clear="all"><div><br></div></div></div><div class="im">-- <br>Best regards,<br><br>Maurício Souza Klein.<br>
</div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Best regards,<br><br>Maurício Souza Klein.<br>
</div>