0

I have been trying to compile the kobuki_keyop example in ROS Indigo from source on Ubuntu 14.04, I basically wrote a simple cpp file like the following:

#include "/opt/ros/indigo/include/kobuki_keyop/include/keyop_core/keyop_core.hpp"  
using namespace keyop_core;
int main()
{
KeyOpCore keyy;
}

then I compiled with the following:

g++ test.cpp -L/opt/ros/indigo/lib/kobuki_keyop -o test

but it keeps giving me the same old holy grail of cpp errors:

/tmp/ccsh6f87.o: In function `main':
test.cpp:(.text+0x25): undefined reference to `keyop_core::KeyOpCore::KeyOpCore()'  
test.cpp:(.text+0x34): undefined reference to `keyop_core::KeyOpCore::~KeyOpCore()'

Update:

as was pointed out by @Danh, there are solutions in the following link:
What is an undefined reference/unresolved external symbol error and how do I fix it?
however, my question is ROS related, I did not write the header files that might cause the problem, and I can't poke around all of the interlinked ones hoping to find a needle in the haystack, I was just hoping someone with background in ROS who had a similar problem might pick this up and point me to their solution.

Thank You.

Community
  • 1
  • 1
Aly Shmahell
  • 511
  • 2
  • 7
  • 18
  • Possible duplicate of [What is an undefined reference/unresolved external symbol error and how do I fix it?](http://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix) – Danh Dec 21 '16 at 03:52
  • I don't think so @Danh, while I did consider the library linking cause in my question, but my question is more ROS related than it is C++ related. notice that my source file is pretty small, non of the solutions pointed out in that duplicate work for it, and I can't go poking around all the linked header files written by the ROS developers/community. I was just hoping someone from that background would pick this question up and help me figure the problem out. – Aly Shmahell Dec 21 '16 at 11:41
  • Only the path of library is specified in `g++ test.cpp -L/opt/ros/indigo/lib/kobuki_keyop -o test` . Where is the library specified for linking? Use can use `g++ -v` to see if the library having code for the `class KeyOpCore` is getting linked. – sameerkn Dec 21 '16 at 11:55

0 Answers0