Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
3086 connectés 

  FORUM HardWare.fr
  Programmation
  C++

  |VC++] error LNK2001: unresolved external symbol

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

|VC++] error LNK2001: unresolved external symbol

n°345691
cezium
Posté le 27-03-2003 à 17:14:53  profilanswer
 

salut a tous
 
g déja parcouru le forum
 
et g vu que ce problème était résolu en ajoutant des librairies
le problème c que je n'ai pas la MSDN d'installé donc je ne sais pas a kelle librairie correspondent les fonctions
 
voila le log
 
Linking...
LINK : warning LNK4098: defaultlib "LIBC" conflicts with use of other libs; use /NODEFAULTLIB:library
visu.obj : error LNK2001: unresolved external symbol _Sleep
mlib_debug.lib(videoddraw.obj) : error LNK2001: unresolved external symbol _IID_IDirectDraw4
mlib_debug.lib(videoddraw.obj) : error LNK2001: unresolved external symbol _DirectDrawCreate@12
mlib_debug.lib(videoddraw.obj) : error LNK2001: unresolved external symbol _DirectDrawEnumerateExA@12
mlib_debug.lib(getdxver.obj) : error LNK2001: unresolved external symbol _IID_IDirectDrawSurface4
mlib_debug.lib(getdxver.obj) : error LNK2001: unresolved external symbol _IID_IDirectDrawSurface3
mlib_debug.lib(getdxver.obj) : error LNK2001: unresolved external symbol _IID_IDirectDraw2
mlib_debug.lib(timerwin.obj) : error LNK2001: unresolved external symbol __imp__timeGetTime@0
mlib_debug.lib(main.obj) : error LNK2001: unresolved external symbol _Main
Debug/visu_voisin.exe : fatal error LNK1120: 9 unresolved externals
Error executing link.exe.
 
 
voila si kelk1 pouvait me donner les librairies a ajouter :)
 
 
merci d'avance ;)

mood
Publicité
Posté le 27-03-2003 à 17:14:53  profilanswer
 

n°345704
Harkonnen
Modérateur
Un modo pour les bannir tous
Posté le 27-03-2003 à 17:19:36  profilanswer
 

Le MSDN est dispo en ligne : http://msdn.microsoft.com
 
Apparemment, tu as besoin du SDK de DirectX, sur le site de Crosoft aussi.
 
Pour info, le topic pour résoudre les LNK2001
 
http://forum.hardware.fr/forum2.php3?post=19176&cat=10


---------------
J'ai un string dans l'array (Paris Hilton)
n°345739
gatorette
Posté le 27-03-2003 à 17:35:00  profilanswer
 

Cezium a écrit :

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


 
Tu dois utiliser d'autres libs qui ont été liées avec une autre version de la bibliothèque CRT (C RunTime Library). Vérifie que tu choisis bien les mêmes options dans "Project"->"Settings"->"C++"->"Code generation"->"Use runtime library" pour ton application et pour les librairies dont elle dépend. Si par exemple tu as une librairie qui utilise la version "Single threaded" et que ton application utilise la version "MultiThreaded", tu auras ce message.
 

Cezium a écrit :

visu.obj : error LNK2001: unresolved external symbol _Sleep
mlib_debug.lib(videoddraw.obj) : error LNK2001: unresolved external symbol _IID_IDirectDraw4
mlib_debug.lib(videoddraw.obj) : error LNK2001: unresolved external symbol _DirectDrawCreate@12
mlib_debug.lib(videoddraw.obj) : error LNK2001: unresolved external symbol _DirectDrawEnumerateExA@12
mlib_debug.lib(getdxver.obj) : error LNK2001: unresolved external symbol _IID_IDirectDrawSurface4
mlib_debug.lib(getdxver.obj) : error LNK2001: unresolved external symbol _IID_IDirectDrawSurface3
mlib_debug.lib(getdxver.obj) : error LNK2001: unresolved external symbol _IID_IDirectDraw2
mlib_debug.lib(timerwin.obj) : error LNK2001: unresolved external symbol __imp__timeGetTime@0


 
Ces erreurs doivent pouvoir se résoudre en téléchargeant le dernier SDK DirectX et en ajoutant les ".lib" correspondant à ton projet ("Project"->"Settings"->"Link"->"Object/Library Modules" ). Pour savoir quels sont les ".lib", consulte la MSDN (par exemple "timeGetTime" nécessite "winmm.lib" ).


---------------
each day I don't die is cheating
n°345798
theshockwa​ve
I work at a firm named Koslow
Posté le 27-03-2003 à 18:07:06  profilanswer
 

ou alors tu passes par la mnière violente :
 
options de link : /nodefaultlib:libc.lib
et tu ajoutes la lib : libcmt.lib dans la liste des libs aue tu linkes ...
 
Bon courage ! ;)

n°345814
cezium
Posté le 27-03-2003 à 18:24:20  profilanswer
 

merci pour vos infos :)
 
j'suis en train de dl la sdk de dx9 :/  
222 Mo !!!

n°345923
cezium
Posté le 27-03-2003 à 21:00:02  profilanswer
 

bon ba g dl la sdk, ca va mieux :)
 
mais g encore kelke erreur :/
 
--------------------Configuration: visu_voisin - Win32 Debug--------------------
Linking...
LINK : warning LNK4098: defaultlib "LIBC" conflicts with use of other libs; use /NODEFAULTLIB:library
visu.obj : error LNK2001: unresolved external symbol _Sleep
mlib_debug.lib(main.obj) : error LNK2001: unresolved external symbol _Main
Debug/visu_voisin.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.
Creating browse info file...
 
visu_voisin.exe - 3 error(s), 1 warning(s)
 
 
g bien essayé de changer dans
"Project"->"Settings"->"C++"->"Code generation"->"Use runtime library"
 
mais ca me fé toujours la meme chose
 
et y'a aussi la fonction sleep qui est pas défini, ca doit etre une fonction concernant les thread mais g pas trouvé a kelle librairie elle se rapportait
 
vous avez une idée ? :)

n°345924
cezium
Posté le 27-03-2003 à 21:04:08  profilanswer
 

theShOcKwAvE a écrit :

ou alors tu passes par la mnière violente :
 
options de link : /nodefaultlib:libc.lib
et tu ajoutes la lib : libcmt.lib dans la liste des libs aue tu linkes ...
 
Bon courage ! ;)


 
ca marche avec ca :)
mais il me reste encore kelke erreur :/
 
--------------------Configuration: visu_voisin - Win32 Debug--------------------
Linking...
visu.obj : error LNK2001: unresolved external symbol _Sleep
mlib_debug.lib(main.obj) : error LNK2001: unresolved external symbol _Main
Debug/visu_voisin.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.
 
visu_voisin.exe - 3 error(s), 0 warning(s)
 
 
si kelk1 a une idée :)

n°345943
cezium
Posté le 27-03-2003 à 21:44:53  profilanswer
 

humm
j'précise que ce prog tourne en principe sous linux (c un TP :/)
et g un pote qui m'a dit que la fonction sleep serait une fonction system de linux donc que sous windows ca fonctionne
 
c'est vrai ca ?

n°346029
VisualC++
J'va y penser ...
Posté le 27-03-2003 à 22:52:33  profilanswer
 


Sleep
The Sleep function suspends the execution of the current thread for a specified interval.  
 
VOID Sleep(
  DWORD dwMilliseconds   // sleep time in milliseconds
);
 
Parameters
dwMilliseconds  
Specifies the time, in milliseconds, for which to suspend execution. A value of zero causes the thread to relinquish the remainder of its time slice to any other thread of equal priority that is ready to run. If there are no other threads of equal priority ready to run, the function returns immediately, and the thread continues execution. A value of INFINITE causes an infinite delay.  
Return Values
This function does not return a value.  
 
Remarks
A thread can relinquish the remainder of its time slice by calling this function with a sleep time of zero milliseconds.  
 
You have to be careful when using Sleep and code that directly or indirectly creates windows. If a thread creates any windows, it must process messages. Message broadcasts are sent to all windows in the system. If you have a thread that uses Sleep with infinite delay, the system will deadlock. Two examples of code that indirectly creates windows are DDE and COM CoInitialize. Therefore, if you have a thread that creates windows, use MsgWaitForMultipleObjects or MsgWaitForMultipleObjectsEx, rather than Sleep.
 
QuickInfo
  Windows NT: Requires version 3.1 or later.
  Windows: Requires Windows 95 or later.
  Windows CE: Requires version 1.0 or later.
  Header: Declared in winbase.h.
  Import Library: Use kernel32.lib.
 
See Also
Processes and Threads Overview, Process and Thread Functions, MsgWaitForMultipleObjects, MsgWaitForMultipleObjectsEx, SleepEx  
 

n°346078
cezium
Posté le 28-03-2003 à 00:05:26  profilanswer
 

merci, ca marche
 
g donc ajouter le include pour winbase.h
 
par contre la que des erreur dans le .h
 
c:\program files\microsoft visual studio\vc98\include\winbase.h(216) : error C2061: syntax error : identifier 'DWORD'
c:\program files\microsoft visual studio\vc98\include\winbase.h(217) : error C2061: syntax error : identifier 'InternalHigh'
c:\program files\microsoft visual studio\vc98\include\winbase.h(217) : error C2059: syntax error : ';'
c:\program files\microsoft visual studio\vc98\include\winbase.h(218) : error C2061: syntax error : identifier 'Offset'
c:\program files\microsoft visual studio\vc98\include\winbase.h(218) : error C2059: syntax error : ';'
c:\program files\microsoft visual studio\vc98\include\winbase.h(219) : error C2061: syntax error : identifier 'OffsetHigh'
c:\program files\microsoft visual studio\vc98\include\winbase.h(219) : error C2059: syntax error : ';'
c:\program files\microsoft visual studio\vc98\include\winbase.h(220) : error C2061: syntax error : identifier 'hEvent'
c:\program files\microsoft visual studio\vc98\include\winbase.h(220) : error C2059: syntax error : ';'
c:\program files\microsoft visual studio\vc98\include\winbase.h(221) : error C2059: syntax error : '}'
c:\program files\microsoft visual studio\vc98\include\winbase.h(224) : error C2061: syntax error : identifier 'DWORD'
c:\program files\microsoft visual studio\vc98\include\winbase.h(225) : error C2061: syntax error : identifier 'lpSecurityDescriptor'
c:\program files\microsoft visual studio\vc98\include\winbase.h(225) : error C2059: syntax error : ';'
c:\program files\microsoft visual studio\vc98\include\winbase.h(227) : error C2059: syntax error : '}'
c:\program files\microsoft visual studio\vc98\include\winbase.h(230) : error C2061: syntax error : identifier 'HANDLE'
c:\program files\microsoft visual studio\vc98\include\winbase.h(231) : error C2061: syntax error : identifier 'hThread'
c:\program files\microsoft visual studio\vc98\include\winbase.h(231) : error C2059: syntax error : ';'
c:\program files\microsoft visual studio\vc98\include\winbase.h(232) : error C2061: syntax error : identifier 'dwProcessId'
c:\program files\microsoft visual studio\vc98\include\winbase.h(232) : error C2059: syntax error : ';'
c:\program files\microsoft visual studio\vc98\include\winbase.h(233) : error C2061: syntax error : identifier 'dwThreadId'
c:\program files\microsoft visual studio\vc98\include\winbase.h(233) : error C2059: syntax error : ';'
c:\program files\microsoft visual studio\vc98\include\winbase.h(234) : error C2059: syntax error : '}'
c:\program files\microsoft visual studio\vc98\include\winbase.h(241) : error C2061: syntax error : identifier 'DWORD'
 
 
g oublié de faire kelkechose ? :/

mood
Publicité
Posté le 28-03-2003 à 00:05:26  profilanswer
 

n°346080
theshockwa​ve
I work at a firm named Koslow
Posté le 28-03-2003 à 00:10:35  profilanswer
 

hum ....
 
tu veux faire du DirectX dans un TP Linux ? C'est mal barré, nan ?

n°346082
cezium
Posté le 28-03-2003 à 00:11:56  profilanswer
 

non pas du tout
 
mais le tp fé appel a la librairie mlib
 
et pour faire fonctionner cette librairie sous windows, il faut avoir le sdk DirectX

n°346091
cezium
Posté le 28-03-2003 à 00:23:05  profilanswer
 

tout compte
 
au lieu d'ajouter le include sur winbase.h, je l'ai fé sur windows.h
 
il me reste pu qu'une erreur :)
ca devient bon :)
 
--------------------Configuration: visu_voisin - Win32 Debug--------------------
Linking...
mlib_debug.lib(main.obj) : error LNK2001: unresolved external symbol _Main
Debug/visu_voisin.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
 
visu_voisin.exe - 2 error(s), 0 warning(s)
 
par contre cette erreur, je vois pas du tout d'où elle pe venir :/

n°346101
gatorette
Posté le 28-03-2003 à 00:37:29  profilanswer
 

Bon, ça veut dire que dans ta librairie mlib_debug.lib, tu as le fichier main.obj (sûrement le fichier main.c à l'origine), qui utilise une fonction Main (définie dans main.h).
 
Je ne connais pas très bien Mlib, mais apparemment il ne faut pas créer de WinMain (il est défini par la librairie dans main.c), mais implémenter la fonction Main qui est appelée par la librairie.
 
Le mieux est encore que tu regardes le fichier main.c de MLib, ce sera sûrement plus clair.


---------------
each day I don't die is cheating
n°346106
cezium
Posté le 28-03-2003 à 00:57:11  profilanswer
 

/**
  This function is the entry point of your application. It's like the standard
  C function main() but main() is already implemented by mlib and call Main()
  after mlib initialisation. Put your code in this function.
*/
void Main(void);
 
 
 
en effet, la fonction est déja définie dans le mlib.h
mais il dise de mettre le code dans cette fonction, j'pige pas trop :/

n°346110
gatorette
Posté le 28-03-2003 à 01:52:41  profilanswer
 

En fait, si tu as une fonction main: int main(int argc, char* argv[]) ou WinMain: int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow ), il faut que tu la remplace par une fonction Main: void Main(void). C'est cette fonction qui va servir de point d'entrée pour ton programme.
 
edit: correction de tags


Message édité par gatorette le 28-03-2003 à 01:53:49

---------------
each day I don't die is cheating
n°346130
cezium
Posté le 28-03-2003 à 08:20:54  profilanswer
 

merci pour votre aide a tous
 
ca fonctionne :)
 
pour la main
suffisait de creer une fonction
 
void Main(void){
 main(1,1);
}
 
 
et voila :)
 
encore merci :)  :bounce:  :bounce:  :bounce:


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  C++

  |VC++] error LNK2001: unresolved external symbol

 

Sujets relatifs
[C] parse error before '&' token [partiellement résolu]HELP : DEV C++ [ Linker error ] : undefined reference to 'WinMain@16'
parse error, unexpected T_CONCAT_EQUAL in....[Mysql] error 127 ???
Problème de Parse Error que j'arrive pas a résoudre...pb en pascal error runtime 100
l'error de la mortParse error: parse error, unexpected T_ECHO ???????
[PHP] file_exists et parse errornumrows error
Plus de sujets relatifs à : |VC++] error LNK2001: unresolved external symbol


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR