Problème avec MFC

DeadlyPredator Messages postés 222 Date d'inscription jeudi 15 janvier 2004 Statut Membre Dernière intervention 30 juin 2008 - 19 juil. 2004 à 03:22
xarier Messages postés 688 Date d'inscription jeudi 26 décembre 2002 Statut Membre Dernière intervention 19 mai 2005 - 19 juil. 2004 à 12:18
Salut,
Je souhaite compiler mon projet MFC en ligne de commande. Donc, j'ai créé la batch suivante :
md Lol
midl /I".\Include" /newtlb /tlb ".\Lol\mcFirstX.tlb" "mcFirstX.odl"
Cl /W3 /GX /O2 /I".\Include" /I".\MFC\Include" /Fo".\Lol\StdAfx.Obj" /Fd".\Lol\StdAfx.Pdb" /FD /c "StdAfx.cpp"
Cl /W3 /GX /O2 /I".\Include" /I".\MFC\Include" /Fo".\Lol\McFirstX.Obj" /Fd".\Lol\McFirstX.Pdb" /FD /c "McFirstX.cpp"
Cl /W3 /GX /O2 /I".\Include" /I".\MFC\Include" /Fo".\Lol\McFirstX.Obj" /Fd".\Lol\McFirstX.Pdb" /FD /c "McFirstX.cpp"
Cl /W3 /GX /O2 /I".\Include" /I".\MFC\Include" /Fo".\Lol\McFirstXCtl.Obj" /Fd".\Lol\McFirstXCtl.Pdb" /FD /c "McFirstXCtl.cpp"
Cl /W3 /GX /O2 /I".\Include" /I".\MFC\Include" /Fo".\Lol\McFirstXPpg.Obj" /Fd".\Lol\McFirstXPpg.Pdb" /FD /c "McFirstXPpg.cpp"
rc /r /fo".\Lol\Ressources.res" /I".\Include" /I".\Lol" /I".\MFC\Include" "mcFirstX.rc"
cvTres /OUT:".\Lol\Ressources.Obj" ".\Lol\Ressources.res"
Link "msvcrt.lib" /LIBPATH:".\MFC\Lib" /LIBPATH:".\Lib" /DEF:"mcFirstX.def" /IMPLIB:".\Lol\mcFirstX.lib" /OUT:".\Lol\MCFIRSTX.OCX" /DLL /INCREMENTAL:NO ".\Lol\McFirstX.obj" ".\Lol\McFirstXPpg.obj" ".\Lol\McFirstXCtl.obj" ".\Lol\StdAfx.obj" ".\Lol\Ressources.obj"


Et ça me donne l'erreur :
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

nafxcw.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) already defined in msvcrt.lib(MSVCRT.dll)
nafxcw.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in msvcrt.lib(MSVCRT.dll)
libc.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in msvcrt.lib(cinitexe.obj)
libc.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in msvcrt.lib(cinitexe.obj)
libc.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in msvcrt.lib(cinitexe.obj)
libc.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in msvcrt.lib(cinitexe.obj)
nafxcw.lib(afxmem.obj) : warning LNK4006: "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) already defined in msvcrt.lib(MSVCRT.dll); second definition ignored
nafxcw.lib(afxmem.obj) : warning LNK4006: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in msvcrt.lib(MSVCRT.dll); second definition ignored
libc.lib(crt0init.obj) : warning LNK4006: ___xc_z already defined in msvcrt.lib(cinitexe.obj); second definition ignored
libc.lib(crt0init.obj) : warning LNK4006: ___xc_a already defined in msvcrt.lib(cinitexe.obj); second definition ignored
libc.lib(crt0init.obj) : warning LNK4006: ___xi_z already defined in msvcrt.lib(cinitexe.obj); second definition ignored
libc.lib(crt0init.obj) : warning LNK4006: ___xi_a already defined in msvcrt.lib(cinitexe.obj); second definition ignored
Creating library .\Lol\mcFirstX.lib and object .\Lol\mcFirstX.exp
LINK : warning LNK4098: defaultlib "libc.lib" conflicts with use of other libs; use /NODEFAULTLIB:library
libc.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
.\Lol\MCFIRSTX.OCX : fatal error LNK1120: 1 unresolved externals

Et si j'enlève le "msvcrt.lib", :
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

Creating library .\Lol\mcFirstX.lib and object .\Lol\mcFirstX.exp
nafxcw.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
nafxcw.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex
.\Lol\MCFIRSTX.OCX : fatal error LNK1120: 2 unresolved externals
Alors que ces symbols ce trouvent dans msvcrt.lib

Que faire pour arranger ce problème?

Merci

VIVE LE QUÉBEC! 8-)
Essayez ça
Dim l As Long: Do Until l -1: l l + 1: Loop

p.s.Si vous l'avez essayé, vous êtes vraiment stupide

3 réponses

xarier Messages postés 688 Date d'inscription jeudi 26 décembre 2002 Statut Membre Dernière intervention 19 mai 2005
19 juil. 2004 à 03:46
ben d'apres ce ke je vois dans code contient plsuieur erreur secondo
pour savoir compilre sous la line de command refer toi a la msdn
Life is Short 8-)
0
DeadlyPredator Messages postés 222 Date d'inscription jeudi 15 janvier 2004 Statut Membre Dernière intervention 30 juin 2008
19 juil. 2004 à 05:30
Ben c'est que CL compile tout très bien mais le problème est dans le linkage. Pi MSDN n'a rien de bon à proposer là dessu (j'ai cherché)

Creating library .\Lol\mcFirstX.lib and object .\Lol\mcFirstX.exp
nafxcw.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
nafxcw.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex
.\Lol\MCFIRSTX.OCX : fatal error LNK1120: 2 unresolved externals

^Ça veut dire qu'il faut que je link avec MSVCRT.LIB (multi-thread) MAIS ÇA DONNE PIRE QUAND JE L'AJOUTE!!!
0
xarier Messages postés 688 Date d'inscription jeudi 26 décembre 2002 Statut Membre Dernière intervention 19 mai 2005
19 juil. 2004 à 12:18
salut j'ai peut pas t'aider pour le trucs de la line de command mais j'ai peut etre une petit solution
si tu utilise la line de commande parceque VCTOOLKIT2003 et free j'ai pour toi une superbre solution que je viend d'installer a l'instant (VISUAL C++ EXPRESS) c free !!!!aller j'eté un coup d'oeil ;)
Life is Short 8-)
0
Rejoignez-nous