Re: Noobie, please help!
Gal Rubinstein <[email protected]>
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <[email protected]> |
the dev-c++ created a FreeTDS.DLL file and the libFreeTDS.a. so now the g++ line looks like this: g++.exe ../common.o ../t0001.o -o "t0001.exe" -L"C:/MinGW/lib" -L"C:/Dev-Cpp/lib" -L"C:/Gal/tmp/freetds-0.82/win32/dev-cpp" -lkernel32 -luser32 -lwinspool -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lFreeTDS but still, I get the same result trace, Thanks a lot for the help On Mon, Mar 9, 2009 at 5:14 PM, James K. Lowden <[email protected]>wrote: > Gal Rubinstein wrote: > > g++.exe ../common.o ../t0001.o -o "t0001.exe" -L"C:/MinGW/lib" > > -L"C:/Dev-Cpp/lib" -L"C:/Gal/tmp/freetds-0.82/win32/dev-cpp" -lkernel32 > > -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 > > -loleaut32 -luuid ../../../../win32/dev-cpp/libFreeTDS.a > > > > ../common.o:common.c:(.text+0xa4): undefined reference to `tds_basename' > > ../common.o:common.c:(.text+0x5d7): undefined reference to > > `dbgetuserdata' ../common.o:common.c:(.text+0x797): undefined reference > > to `dbgetuserdata' ../common.o:common.c:(.text+0x867): undefined > > reference to `dbdead' ../t0001.o:t0001.c:(.text+0x88): undefined > > reference to `dbinit' > > OK, that's actually pretty good. All you need to do is tell the linker > about the db-lib dynamic library you want to use. > > You'll have to fill me in here. What is the name of the db-lib file in > this environment? And what kind of a file is libFreeTDS.a? > > In a unixy environment, the static linker resolves a library's symbols > from the .so. That is, the static linker uses a copy of the .so that will > be available at runtime to verify that the .so contains all the symbols > needed be the executable. > > In Win32, those jobs are divided: an "import library" (.lib) describes the > .dll to the static linker. You "link" the .lib when building, and at > runtime the, um, runtime linker loads the matching DLL. > > The basic question is: How does one tell g++.exe about a DLL that the > executable will use at runtime? I don't know what g++.exe produces when > you're done building what's in src/dblib, i.e., the name of the DLL and > import library, if any. I would guess it produces a .dll and no .lib, and > that the .dll (not the .a) needs to be mentioned when linking the > executable (e.g. t0001.exe). > > You use two arguments to tell the linker about any library, static or > dynamic: -L for its location, and -l for its name. If the DLL is > C:/Gal/tmp/freetds-0.82/win32/dev-cpp/FreeTDS.DLL, then, if my guess is > correct: > > -L"C:/Gal/tmp/freetds-0.82/win32/dev-cpp" -lFreeTDS > > Answer the basic question, and you're nearly home. The only other gotcha > is you'll need some stuff from src/replacements, specifically > tds_basename(). I don't know if the project you're using produces a > dynamic or static library for replacements. I hope it's static. You'll > need to add that to your linker command, too. > > BTW, you can drop some of the other libraries you're linking to, at least > for simple things like t0001.exe. For instance, I doubt gdi32 or comdlg32 > are needed. Adding them is no harm, but reducing the linker command to > its minimum helps clarify what's happening. > > HTH. > > --jkl > _______________________________________________ > FreeTDS mailing list > [email protected] > http://lists.ibiblio.org/mailman/listinfo/freetds >