From: SourceForge.net <no...@so...> - 2007-05-31 00:25:36
|
Bugs item #1728660, was opened at 2007-05-31 11:44 Message generated for change (Comment added) made by dannysmith You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=102435&aid=1728660&group_id=2435 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: ld Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Tkatseres (tedkat) Assigned to: Danny Smith (dannysmith) Summary: functions in winnetwk.h will not link using ld Initial Comment: OS version XP gcc version 3.4.5 ld version ( GNU ld version 2.17.50 20060824 ) mingw version ( MinGW-5.1.3.exe ) build environment ( PATH=c:\MinGW\bin;C:\WINDOWS\system32;C:\WINDOWS\System32\Wbem; ) mingw-runtime version ( #define __MINGW32_VERSION 3.12 ) w32api version ( #define __W32API_VERSION 3.9 ) cat > net.cpp <<EOF #include <windows.h> #include <winnetwk.h> #include <iostream> #pragma comment( lib, "Mpr" ) using namespace std; int main() { char *res = "\\\\THEBOX\\ADMIN$"; NETRESOURCE nr; nr.dwType = RESOURCETYPE_DISK; nr.lpLocalName = NULL; nr.lpRemoteName = res; nr.lpProvider = NULL; char *passw = "pass", *usern = "Chris"; int ret = WNetAddConnection2(&nr, passw, usern, 0); if (ret == NO_ERROR) cout << "WORKS!"; WNetCancelConnection2(res, 0, true); cin.ignore(); return 0; } EOF C:\WINDOWS\system32\> g++ -lmpr net.cpp OUTPUT C:\DOCUME~1\katsert\LOCALS~1\Temp/ccG2baaa.o:net.cpp:(.text+0x175): undefined reference to `WNetAddConnection2A@16' C:\DOCUME~1\katsert\LOCALS~1\Temp/ccG2baaa.o:net.cpp:(.text+0x1b0): undefined reference to `WNetCancelConnection2A@12' collect2: ld returned 1 exit status I've tried may things but I can not get past this linking problem. ---------------------------------------------------------------------- >Comment By: Danny Smith (dannysmith) Date: 2007-05-31 12:25 Message: Logged In: YES user_id=11494 Originator: NO You did this; C:\WINDOWS\system32\> g++ -lmpr net.cpp Do this instead: C:\WINDOWS\system32\> g++ net.cpp -lmpr hey, cis trans boom la la search for "order matters" in FAQ ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=102435&aid=1728660&group_id=2435 |