I don't know if this is the right forum for this question but I'll give it a shot anyway.

I'm trying to connect to a Sql Server database using c++. But everytime I compile, I get a linking error, and the compiler says that some of the functions I used, such as SQLConnect and SQLAllocStmt are undefined references. I've pretty much figured out that I need to link the library libodbc32.a into this program. I'm using Cygwin on Windows 98. My Cygwin libraries, which include libodbc32.a, are in C:\Cygwin\lib\w32api directory. And my c++ application is in C:\Project\src directory. Now I've a lot of ways of linking but nothing seems to be working, i.e.

g++ -l C:\Cygwin\lib\w32api\libodbc32.a -o main.exe main.cpp

or

g++ -l \c\Cygwin\lib\w32api\libodbc32.a -o main.exe main.cpp
where \c is the mounted windows file system which maps to C:\.

And with these commands, the compiler always says it can't find that library. Anybody no what I'm doing wrong. Any help will be appreciated. Thanks.