[CMake] String error Cmake

Andreas Pakulat apaku at gmx.de
Tue Apr 3 15:02:10 EDT 2012


On 03.04.12 15:46:08, Mauricio Klein 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".

I think you're mis-interpreting the error. The problem is not that it
cannot find the string class, it finds that alright. The problem is
rather that wherever the function is implemented, the file is not part
of the target thats being compiled.

I'm guessing either you have some kind of mismatch between declaration
and implementation or the file is really not in the list of sources to
compile. If you can't find it and you can post the code, add the
Executor.h and Executor.cpp files to your next mail.

Andreas



More information about the CMake mailing list