2010-01-22 5 views
1

J'utilise Visual Studio 2003 et j'obtiens l'erreur suivante lien dans mon projet:Visual Studio reliant LNK2005 d'erreur et LNK2020

Linking... 
LINK : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/INCREMENTAL:NO' specification 
msvcrtd.lib(MSVCR71D.dll) : error LNK2005: _fprintf already defined in LIBCMTD.lib(fprintf.obj) 
C:\Documents and Settings\mz07\Desktop\project\HLconsoleExample\Debug\HLconsoleExample.exe : fatal error LNK1169: one or more multiply defined symbols found 

I inclus puis LIBCMTD.LIB en ligne « ignorer bibliothèque spécifique » et a obtenu une autre erreur:

Linking... 
LINK : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/INCREMENTAL:NO' specification 
LINK : error LNK2020: unresolved token (0A000037) _CxxThrowException 
LINK : error LNK2020: unresolved token (0A000039) delete 
LINK : fatal error LNK1120: 2 unresolved externals 

Ceci est le début de ma classe principale:

#include <cstdio> 
#include <iostream> 

#if defined(WIN32) 
# include <conio.h> 
#else 
# include "conio.h" 
#endif 

#include <HL/hl.h> 
#include <HD/hd.h> 

#include <HDU/hduVector.h> 
#include <HDU/hduError.h> 
... 
int main(int argc, char *argv[]) 
{ 
    HHD hHD; 
    HHLRC hHLRC; 
    HDErrorInfo error; 
... 
} 

I inclus toutes les bibliothèques que j'utilise dans les propriétés du Linker. Voici la sortie de ligne de commande de celui-ci:

/OUT:"C:\Documents and Settings\mz07\Desktop\project\HLconsoleExample\Debug\HLconsoleExample.exe" /INCREMENTAL /NOLOGO /NODEFAULTLIB:"libcmtd.lib" /DEBUG /ASSEMBLYDEBUG /PDB:"C:\Documents and Settings\mz07\Desktop\project\HLconsoleExample\Debug/HLconsoleExample.pdb" /FIXED:No hl.lib hd.lib HDUD.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib "\Program Files\SensAble\3DTouch\lib\hl.lib" "\Program Files\SensAble\3DTouch\lib\hd.lib" "\Program Files\SensAble\3DTouch\utilities\src\Hdu\Debug\HDUD.lib" 

Je suis nouveau à C++ et je ne comprends pas vraiment comment fonctionne :) donc lier toute aide est appréciée.

Répondre

3

Vous liez un fichier .lib dont le code a été compilé avec un paramètre de compilateur incompatible. Le problème est Project + Propriétés, C/C++, Génération de code, Bibliothèque d'exécution./MD n'est pas compatible avec/MT. Vous devrez soit reconstruire le .libs pour correspondre à votre paramètre de projet .exe ou l'inverse.

+0

merci beaucoup. Je vais essayer demain – Student