Creating a Static Lib 
Author Message
 Creating a Static Lib

I'm having difficulty using lib.exe to create a single lib file for a bunch
of common functions used by my projects.

This is my first attempt at creating a static library.  Although I'll
probably end up using a DLL, I'd like to have that as my option.

Do I need two versions for both debug and release versions?
If so, I guess it'll get a different name and there's no problem.

If not, in attempting to add the second object file, say the release obj, I
get:
LNK4006 _FOO already defined...

Attempting to build a release using the debug lib file (wrong, I know)
throws the following:

LIBCD.lib(dbgheap.obj) : error LNK2005: _malloc already defined in
LIBC.lib(malloc.obj)
LIBCD.lib(dbgheap.obj) : error LNK2005: __nh_malloc already defined in
LIBC.lib(malloc.obj)
LIBCD.lib(dbgheap.obj) : error LNK2005: __heap_alloc already defined in
LIBC.lib(malloc.obj)
LIBCD.lib(dbgheap.obj) : error LNK2005: _free already defined in
LIBC.lib(free.obj)
LINK : warning LNK4098: defaultlib "LIBCD" conflicts with use of other libs;
use /NODEFAULTLIB:library
Release/MyBar.exe : fatal error LNK1169: one or more multiply defined
symbols found
Error executing link.exe.

Using the lib file built from the release obj file in a debug configuration
yields the following warning:

LINK : warning LNK4098: defaultlib "LIBC" conflicts with use of other libs;
use /NODEFAULTLIB:library

and, obviously, there is no debug info.  I tried the /DEBUGTYPE switch
which, as expected, did not seem to affect this static lib.

Any help would be greatly appreciated.

Fred



Tue, 20 Feb 2001 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Creating a static lib with inline functions?

2. How to create a static lib from dll settings?

3. Creating static .lib and dynamic .dll

4. Creating CProperty Page in a Static Lib

5. create static lib wth mfc classes

6. Creating static lib which is dependent on other static lib?

7. Differentiate LIB file for static library and LIB file for DLL

8. Static library linked within other Static LIB?

9. Using Lib to create a .lib for linking

10. Creating a static class from non static Framework classes

11. C problem involving creating creating your own .LIB file

12. view C static runtime lib

 

 
Powered by phpBB® Forum Software