Page 1 of 1

Unresolved externals using db2api

Posted: Sat Apr 09, 2011 6:39 pm
by atrichtch
Hi,

I'm trying to make a small DLL to make simple administrative manipulations on DB2 (create/drop database, display active databases etc.). I did include sqlenv.h, and did specify the SQLLIB/lib and db2api.lib in the linking. Still, this is what I get:

Code: Select all

$ gcc -Wall -L"/home/alex/sqllib/lib" "/home/alex/sqllib/lib/db2api.lib" -share
d  dboperations.o -o dbops.dll
dboperations.o:dboperations.cpp:(.text+0x53): undefined reference to `sqlecrea_a
pi@32'
dboperations.o:dboperations.cpp:(.text+0xac): undefined reference to `sqledosd_a
pi@16'
dboperations.o:dboperations.cpp:(.text+0xfd): undefined reference to `sqlengne_a
pi@12'
collect2: ld returned 1 exit status
Is anybody familiar with DB2?
Thanks.

Re: Unresolved externals using db2api

Posted: Wed Apr 20, 2011 10:29 am
by atrichtch
OK, DB2 libraries can only be linked in Visual Studio. Also, it's necessary to specify "Link library dependencies" in the linker option; otherwise you'll keep wondering what's wrong.