[CMake] String error Cmake

Mauricio Klein mauricio.klein.msk at gmail.com
Tue Apr 3 14:48:28 EDT 2012


One more information:

Andreas, i'm compiling at least 10 .cpp codes, many of them using string
without problems.

The error is occurring just in this function, but i've assured that string
libraries are included.

On Tue, Apr 3, 2012 at 3:46 PM, Mauricio Klein <mauricio.klein.msk at gmail.com
> wrote:

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



-- 
Best regards,

Maurício Souza Klein.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120403/50971914/attachment.htm>


More information about the CMake mailing list