my main.cpp
:
#include <iostream>
int foo(int arg);
using namespace std;
int main()
{
int x = foo(22);
cout << x;
return 0;
}
compile command line (Ubuntu 13.10):
g++-4.8 -L. -lfoo main.cpp -o main_app
libfoo.a
contains int foo(int)
but I always get the same compiler error:
/tmp/cciAyTSP.o: In function `main':
main.cpp:(.text+0x19): undefined reference to `foo(int)'
collect2: error: ld returned 1 exit status