02. juli 2003 - 14:26
Der er
6 kommentarer og 1 løsning
libkernel32.a linkning
Hej jeg bruger Dev-cpp og skal bruge kernelfunktionerne Process32Next og Process32First Defineret i Tlhelp32.h. Jeg har i min Link-parametre angivet libkernel32.a men jeg får stald en "undefined reference" hvad kan problemet være?? hvordan kan det løses??
Annonceindlæg fra Infor
Har du inkluderet Tlhelp32.h i en header ? Det vil jeg mene er nødvendigt, udover at angive linkparametre til libkernel32.a
Og i øvrigt, på MSDN Library under de nævnte funktioner, er angivet at du skal linke til kernel32.lib: "Library: Use Kernel32.lib."
1) Hvis du postede den præcsie fejl-besked var det nok nemmere at sige hvad du mangler. 2) Du er opmærksom på at libkernel32.a skal angive som: -lkernel32 ?
Jeg har følgende includeringer i min header #include <windows.h> #include <Tlhelp32.h> #include <ddraw.h> #include <time.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <Dbt.h> #include "resource.h" Jeg går ud fra at libkernel32.a er det samme som kernel32.lib Jeg har iøvrigt også prøvet at includeret kernel32.lib fra Codewarrior.. Fejlbeskrivelse: Compiler: Default compiler Building Makefile: "D:\Development\ZionSoft\ZPlayer\V2\ZPlayer2\Makefile.win" Executing make clean rm -f Error.o HelloWin32.o Load.o OEM.o player.o playlist.o Preferences.o Skin.o Text.o Zplayer_private.res Zplayer.exe g++.exe -c Error.cpp -o Error.o -I"D:/Program Files/Dev-Cpp/include/c++" -I"D:/Program Files/Dev-Cpp/include/c++/mingw32" -I"D:/Program Files/Dev-Cpp/include/c++/backward" -I"D:/Program Files/Dev-Cpp/include" g++.exe -c HelloWin32.cpp -o HelloWin32.o -I"D:/Program Files/Dev-Cpp/include/c++" -I"D:/Program Files/Dev-Cpp/include/c++/mingw32" -I"D:/Program Files/Dev-Cpp/include/c++/backward" -I"D:/Program Files/Dev-Cpp/include" g++.exe -c Load.cpp -o Load.o -I"D:/Program Files/Dev-Cpp/include/c++" -I"D:/Program Files/Dev-Cpp/include/c++/mingw32" -I"D:/Program Files/Dev-Cpp/include/c++/backward" -I"D:/Program Files/Dev-Cpp/include" g++.exe -c OEM.cpp -o OEM.o -I"D:/Program Files/Dev-Cpp/include/c++" -I"D:/Program Files/Dev-Cpp/include/c++/mingw32" -I"D:/Program Files/Dev-Cpp/include/c++/backward" -I"D:/Program Files/Dev-Cpp/include" g++.exe -c player.cpp -o player.o -I"D:/Program Files/Dev-Cpp/include/c++" -I"D:/Program Files/Dev-Cpp/include/c++/mingw32" -I"D:/Program Files/Dev-Cpp/include/c++/backward" -I"D:/Program Files/Dev-Cpp/include" g++.exe -c playlist.cpp -o playlist.o -I"D:/Program Files/Dev-Cpp/include/c++" -I"D:/Program Files/Dev-Cpp/include/c++/mingw32" -I"D:/Program Files/Dev-Cpp/include/c++/backward" -I"D:/Program Files/Dev-Cpp/include" g++.exe -c Preferences.cpp -o Preferences.o -I"D:/Program Files/Dev-Cpp/include/c++" -I"D:/Program Files/Dev-Cpp/include/c++/mingw32" -I"D:/Program Files/Dev-Cpp/include/c++/backward" -I"D:/Program Files/Dev-Cpp/include" g++.exe -c Skin.cpp -o Skin.o -I"D:/Program Files/Dev-Cpp/include/c++" -I"D:/Program Files/Dev-Cpp/include/c++/mingw32" -I"D:/Program Files/Dev-Cpp/include/c++/backward" -I"D:/Program Files/Dev-Cpp/include" g++.exe -c Text.cpp -o Text.o -I"D:/Program Files/Dev-Cpp/include/c++" -I"D:/Program Files/Dev-Cpp/include/c++/mingw32" -I"D:/Program Files/Dev-Cpp/include/c++/backward" -I"D:/Program Files/Dev-Cpp/include" windres.exe -i Zplayer_private.rc -I rc -o Zplayer_private.res -O coff g++.exe Error.o HelloWin32.o Load.o OEM.o player.o playlist.o Preferences.o Skin.o Text.o Zplayer_private.res -o "Zplayer.exe" -L"D:/Program Files/Dev-Cpp/lib" -mwindows ZXMLLib.a fmod/fmodlcc.lib fmod/fmodvc.lib "../../../../../Program Files/Dev-Cpp/lib/libdxguid.a" "../../../../../Program Files/Dev-Cpp/lib/libgdi32.a" "../../../../../Program Files/Dev-Cpp/lib/libkernel32.a" "../../../../../Program Files/Dev-Cpp/lib/libddraw.a" "../../../../../Program Files/Dev-Cpp/lib/libuser32.a" HelloWin32.o(.text+0x12d):HelloWin32.cpp: undefined reference to `Process32First@8' HelloWin32.o(.text+0x16e):HelloWin32.cpp: undefined reference to `Process32Next@8' HelloWin32.o(.text+0x1b2):HelloWin32.cpp: undefined reference to `Process32First@8' HelloWin32.o(.text+0x1fe):HelloWin32.cpp: undefined reference to `Process32Next@8' make.exe: *** [Zplayer.exe] Error 1 Execution terminated
libkernel32.a er en cygwin/mingw/dev-cpp variant af kernel32.lib
Prøv at linke med: libth32.a
Når du angiver: -L/dir så kan du i.s.f. /dir/libxxxx.a angive -lxxxx (kunne måske forkorte kommando linien lidt)
Kurser inden for grundlæggende programmering