0

I am building some test cases for a library. There a function is declared and used throughout the library. lib.a.

I then built up some test cases and implemented those functions, which are not declared in that library in a executable tests.exe

When I build test.exe it gives the error "Undefined reference to ....." How do I link correctly, I am using Eclipse and CppUnit. I have linked to the .a library and that .a library is building fine, I just can't link the two.

user1876942
  • 1,411
  • 2
  • 20
  • 32
  • Post the build log that contains the linker's error messages. – Mike Kinghan Jan 15 '14 at 10:48
  • There is nothing more than a long list of "undefined reference to `function'" – user1876942 Jan 15 '14 at 12:40
  • @user1876942 Your question is impossible to answer as stated. You need to provide *concrete* function name that gets unresolved, explain where it is defined, and show your link command line. Your link command line is most likely wrong, perhaps due to this: http://stackoverflow.com/a/7783411/50617 – Employed Russian Jan 16 '14 at 04:32
  • I just need to know how to link when I have declared a function in a .a library and implemented that in the exe. How can the .a file know about the implementation in the exe? – user1876942 Jan 16 '14 at 07:34
  • @EmployedRussian Is there a Russian proverb = "You can lead a horse to water but you can't make it drink"? – Mike Kinghan Jan 16 '14 at 23:47
  • Simple solution: move the implementation of that function from the executable to another library? – Henry Hu Apr 21 '14 at 23:13

0 Answers0