c++ - undefined reference to `DhcpEnumSubnets' -


i'm trying information dhcp server using windows api, keep getting undefined references.

according msdn dhcpenumsubnets in dhcpsapi.lib , have verified prototype is in dhcpsapi.h file , (by simple text search) is in .lib

as can see below linking against lib, still linker errors. have ideas me ?

here compile log: i'm using dev-c++ 4.9.9.2 on windows xp sp2, latest windows platform sdk

"microsoft® windows® software development kit (sdk) windows server 2008 , .net framework 3.5"
"this release of windows sdk supports x86, x64, , ia64 platforms building , running applications on windows xp sp2, windows server 2003 r2, windows vista, , windows server 2008."


compiler: default compiler building makefile: "c:\projects\dhcptest\makefile.win" executing make clean rm -f main.o dhcptest.exe

g++.exe -c main.cpp -o main.o -i"c:/dev-cpp/lib/gcc/mingw32/3.4.2/include" -i"c:/dev-cpp/include/c++/3.4.2/backward" -i"c:/dev-cpp/include/c++/3.4.2/mingw32" -i"c:/dev-cpp/include/c++/3.4.2" -i"c:/dev-cpp/include" -i"c:/program files/microsoft sdks/windows/v6.1/include"

g++.exe main.o -o "dhcptest.exe" -l"c:/dev-cpp/lib" -l"c:/program files/microsoft sdks/windows/v6.1/lib" "../../program files/microsoft sdks/windows/v6.1/lib/ws2_32.lib" "../../program files/microsoft sdks/windows/v6.1/lib/dhcpsapi.lib"

main.o(.text+0x128):main.cpp: undefined reference 'dhcpgetversion' main.o(.text+0x1d7):main.cpp: undefined reference 'dhcpenumsubnets' main.o(.text+0x2b2):main.cpp: undefined reference 'dhcpenumsubnetclients'

collect2: ld returned 1 exit status

make.exe: * [dhcptest.exe] error 1

execution terminated


edit: solved problem impdef/implib-ing dhcpsapi.dll , linking against library. have no idea whats lib supplied in ms platform sdk.

i'm seeing -l options in command-line specify additional library paths, i'm not seeing -l specify library to link against.

i try following :

g++.exe main.o -o "dhcptest.exe" -l"c:/dev-cpp/lib" -l"c:/program files/microsoft sdks/windows/v6.1/lib" -lws2_32 -ldhcpsapi


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -