I created a simple library (static 64 bit -.lib) using Visual Studio 2012 Express. This whole library has one function:
int get_number()
{
return 67;
}
Say the lib created is called NumTestLib64.lib.
I am trying to compile a simple program (let it be called test.cpp) with Cygwin64, which will link NumTestLib64.liband print the result get_number():
#include <stdio.h>
int get_number();
int main()
{
printf("get_number: %d\n", get_number());
return 0;
}
Pretty simple? Obviously not.
Compiling with g++ -o test test.cpp -L. -lTestLibStatic64returns:
/tmp/ccT57qc6.o:test.cpp:(.text+0xe): undefined reference to `get_number()'
/tmp/ccT57qc6.o:test.cpp:(.text+0xe): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `get_number()'
collect2: error: ld returned 1 exit status
and g++ -o test test.cpp TestLibStatic64.libreturns:
/tmp/ccMY8yNi.o:test.cpp:(.text+0xe): undefined reference to `get_number()'
/tmp/ccMY8yNi.o:test.cpp:(.text+0xe): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `get_number()'
collect2: error: ld returned 1 exit status
I am looking for the brave who can provide instructions, both on the side of Visual Studio and on the command line side of Cygwin, on how to do this.
-, , , , . DLL , , , , .
, !