0

I installed shogun following the tutorial shogun quick start and tried this simple example

However, when I run this:g++ -lshogun minimal.cpp I got this:

/tmp/ccAIVbZB.o: In function main:

minimal.cpp:(.text+0x24): undefined reference to shogun::init_shogun(void (*)(_IO_FILE*, char const*), void (*)(_IO_FILE*, char const*), void (*)(_IO_FILE*, char const*), void (*)(bool&, bool&))'
minimal.cpp:(.text+0x29): undefined reference toshogun::exit_shogun()' collect2: error: ld returned 1 exit status

And as is suggested, i ran ldconfig which gave the same output.

I have googled this question but got no helpful answer. Your kindly help will be definitely appreciated!

IronMan007
  • 105
  • 4
  • 14
will Ji
  • 1
  • 1
  • put `-lshogun` after `minimal.cpp` – M.M Mar 14 '16 at 05:02
  • And I wonder why? What's the difference between g++ -lshogun minimal.cpp -o minimal and g++ minimal.cpp -lshogun -o minimal ? – will Ji Mar 14 '16 at 06:55
  • g++ defaults to only making one pass over the objects, and the first way it passes -lshogun before passing your object – M.M Mar 14 '16 at 07:30
  • Great Thanks ! Really helpful! ^_^ – will Ji Mar 14 '16 at 11:08
  • Possible duplicate of [What is an undefined reference/unresolved external symbol error and how do I fix it?](https://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix) – iglesias Apr 27 '18 at 16:26

0 Answers0