|
17 Jan 2003, 08:22
|
#1
|
Rawr rawr
Join Date: Dec 2000
Location: Upside down
Posts: 5,300
|
Linker warning
I linked a jpeg library yesterday with my code, but since I'm getting a linker warning:
LINK : warning LNK4098: defaultlib "LIBC" conflicts with use of other libs; use /NODEFAULTLIB:library
What does this warning mean? Any way of getting rid of it?
|
|
|
17 Jan 2003, 08:47
|
#2
|
Bitch
Join Date: Jun 2002
Location: North Yorkshire
Posts: 3,848
|
My crystal ball (google) says...
Quote:
in your project settings, besides "amulet.lib" and "winmm.lib", you also need to include
/nodefaultlib:"libc"
|
__________________
ACHTUNG!!!
Das machine is nicht fur gefingerpoken und mittengrabben. Ist easy
schnappen der springenwerk, blowenfusen und corkenpoppen mit
spitzensparken. Ist nicht fur gewerken by das dummkopfen. Das
rubbernecken sightseeren keepen hands in das pockets. Relaxen und vatch
das blinkenlights!!!
|
|
|
17 Jan 2003, 09:18
|
#3
|
Rawr rawr
Join Date: Dec 2000
Location: Upside down
Posts: 5,300
|
Nope.... now I get duplicated symbol errors...
|
|
|
17 Jan 2003, 09:22
|
#4
|
Bitch
Join Date: Jun 2002
Location: North Yorkshire
Posts: 3,848
|
Hmmm...
This is the relevant MDSN page (from microsoft.com)
Quote:
Linker Tools Warning LNK4098
defaultlib "library" conflicts with use of other libs; use /NODEFAULTLIB:library
You are trying to link with incompatible libraries.
Important The run-time libraries now contain directives to prevent mixing different types. You’ll receive this warning if you try to use different types or debug and non-debug versions of the run-time library in the same program. For example, if you compiled one file to use one kind of run-time library and another file to use another kind (for example, single-threaded versus multithreaded) and tried to link them, you’ll get this warning. You should compile all source files to use the same run-time library. See the Use Run-Time Library (MD, /ML, /MT, /LD) compiler options for more information.
You can use the linker’s /VERBOSE:LIB switch to determine which libraries the linker is searching. If you receive LNK4098 and want to create an executable file that uses, for example, the single-threaded, non-debug run-time libraries, use the /VERBOSE:LIB option to find out which libraries the linker is searching. The linker should print LIBC.LIB and not LIBCMT.LIB, MSVCRT.LIB, LIBCD.LIB, LIBCMTD.LIB, or MSVCRTD.LIB as the libraries searched. You can tell the linker to ignore the the incorrect run-time libraries by typing the incorrect libraries in the Ignore Libraries text box on the Link tab of the Settings dialog box in Developer’s Studio or by using the /NODEFAULTLIB:library option with LINK for each library you want to ignore. See the Ignore Libraries (/NODEFAULTLIB) linker option for more information.
The table below shows which libraries should be ignored depending on which run-time library you want to use.
To use this run-time library
Ignore these libraries
Single-threaded (libc.lib)
libcmt.lib, msvcrt.lib, libcd.lib, libcmtd.lib, msvcrtd.lib
Multithreaded (libcmt.lib)
libc.lib, msvcrt.lib, libcd.lib, libcmtd.lib, msvcrtd.lib
Multithreaded using DLL (msvcrt.lib)
libc.lib, libcmt.lib, libcd.lib, libcmtd.lib, msvcrtd.lib
Debug Single-threaded (libcd.lib)
libc.lib, libcmt.lib, msvcrt.lib, libcmtd.lib, msvcrtd.lib
Debug Multithreaded (libcmtd.lib)
libc.lib, libcmt.lib, msvcrt.lib, libcd.lib, msvcrtd.lib
Debug Multithreaded using DLL (msvcrtd.lib)
libc.lib, libcmt.lib, msvcrt.lib, libcd.lib, libcmtd.lib
For example, if you received this warning and you want to create an executable file that uses the non-debug, single-threaded version of the run-time libraries, you could use the following options with the linker:
/NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:libcd.lib /NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB:msvcrtd.lib
|
__________________
ACHTUNG!!!
Das machine is nicht fur gefingerpoken und mittengrabben. Ist easy
schnappen der springenwerk, blowenfusen und corkenpoppen mit
spitzensparken. Ist nicht fur gewerken by das dummkopfen. Das
rubbernecken sightseeren keepen hands in das pockets. Relaxen und vatch
das blinkenlights!!!
|
|
|
17 Jan 2003, 09:42
|
#5
|
Rawr rawr
Join Date: Dec 2000
Location: Upside down
Posts: 5,300
|
yes \o/
I added libc.lib to my IGNORE list of my project and it works...
Anyway, how can I ignore a lib in-code? Don't want to adjust all my projects when I use my texture loader
|
|
|
17 Jan 2003, 09:46
|
#6
|
Bitch
Join Date: Jun 2002
Location: North Yorkshire
Posts: 3,848
|
Unfortunately I have no idea whatsoever
You could always just live with the warning I suppose.
__________________
ACHTUNG!!!
Das machine is nicht fur gefingerpoken und mittengrabben. Ist easy
schnappen der springenwerk, blowenfusen und corkenpoppen mit
spitzensparken. Ist nicht fur gewerken by das dummkopfen. Das
rubbernecken sightseeren keepen hands in das pockets. Relaxen und vatch
das blinkenlights!!!
|
|
|
17 Jan 2003, 09:54
|
#7
|
Rawr rawr
Join Date: Dec 2000
Location: Upside down
Posts: 5,300
|
Quote:
Originally posted by Gayle28uk
Unfortunately I have no idea whatsoever
You could always just live with the warning I suppose.
|
Definately not... it's sloppy... When I compile my project and I see a warning it just doesn't "feel" right.
|
|
|
17 Jan 2003, 10:02
|
#8
|
Bitch
Join Date: Jun 2002
Location: North Yorkshire
Posts: 3,848
|
Quote:
Originally posted by Structural Integrity
Definately not... it's sloppy... When I compile my project and I see a warning it just doesn't "feel" right.
|
Somehow I KNEW you were going to say that
As far as I can see the only way of doing it is top make sure that all the files in your project use the same library, i.e. if one uses libc, they all have to use libc. Would I be right in assuming you have something somewhere that uses msvcrt? if so everything else has to use it as well, not libc.
Apologies if I'm wrong in my assumption.
__________________
ACHTUNG!!!
Das machine is nicht fur gefingerpoken und mittengrabben. Ist easy
schnappen der springenwerk, blowenfusen und corkenpoppen mit
spitzensparken. Ist nicht fur gewerken by das dummkopfen. Das
rubbernecken sightseeren keepen hands in das pockets. Relaxen und vatch
das blinkenlights!!!
|
|
|
17 Jan 2003, 10:14
|
#9
|
Rawr rawr
Join Date: Dec 2000
Location: Upside down
Posts: 5,300
|
Quote:
Originally posted by Gayle28uk
Somehow I KNEW you were going to say that
As far as I can see the only way of doing it is top make sure that all the files in your project use the same library, i.e. if one uses libc, they all have to use libc. Would I be right in assuming you have something somewhere that uses msvcrt? if so everything else has to use it as well, not libc.
Apologies if I'm wrong in my assumption.
|
msvcrt isn't linked explicitly in the project settings (neither is libc) but I assume it is linked. What I do now is defining in my project file to ignore the libc library completely on linking, so I assume it automatically takes msvcrt instead (as I didn't see any runtime/linker errors (yet)).
|
|
|
17 Jan 2003, 10:39
|
#10
|
Rawr rawr
Join Date: Dec 2000
Location: Upside down
Posts: 5,300
|
weeee.... I got it:
#pragma comment(linker, "/nodefaultlib:libc.lib")
#pragma comment(linker, "/nodefaultlib:libcd.lib")
|
|
|
17 Jan 2003, 10:39
|
#11
|
Bitch
Join Date: Jun 2002
Location: North Yorkshire
Posts: 3,848
|
\o/
__________________
ACHTUNG!!!
Das machine is nicht fur gefingerpoken und mittengrabben. Ist easy
schnappen der springenwerk, blowenfusen und corkenpoppen mit
spitzensparken. Ist nicht fur gewerken by das dummkopfen. Das
rubbernecken sightseeren keepen hands in das pockets. Relaxen und vatch
das blinkenlights!!!
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
|
All times are GMT +1. The time now is 11:04.
| |