MinGW (Win) - undefined reference
-
Benutze den neusten MinGW Compiler mit der IDE Codeblocks.
Mein aktueller Quellcode (funktioniert in VC++)
Habe das define extra noch hingeschrieben, wegen der Bedingung siehe unten.#include <windows.h> #include "Shlobj.h" #define _WIN32_IE 0x0400 int main() { char cPath[255] = {0}; SHGetSpecialFolderPathW(NULL,(LPWSTR)cPath,CSIDL_APPDATA,0); return 0; }In dem "Shlobj.h" Header steht
#if (_WIN32_IE >= 0x0400) BOOL WINAPI SHGetSpecialFolderPathA(HWND,LPSTR,int,BOOL); BOOL WINAPI SHGetSpecialFolderPathW(HWND,LPWSTR,int,BOOL); #endif /* SHGetFolderPath in shfolder.dll on W9x, NT4, also in shell32.dll on W2K */ HRESULT WINAPI SHGetFolderPathA(HWND,int,HANDLE,DWORD,LPSTR); HRESULT WINAPI SHGetFolderPathW(HWND,int,HANDLE,DWORD,LPWSTR);Der Compiler gibt aus:
C:\Documents and Settings\-\My Documents\C\FuncHelp\main.c||In function `main':| C:\Documents and Settings\-\My Documents\C\FuncHelp\main.c|9|warning: implicit declaration of function `SHGetSpecialFolderPathW'| obj\Release\main.o:main.c:(.text+0x54)||undefined reference to `SHGetSpecialFolderPathW'| ||=== Build finished: 1 errors, 1 warnings ===|
-
Gegen die Shell32.lib linken. Bzw bei Mingw libshell32.a
-
Hat leider zum gleichen Fehler geführt !
obj\Release\main.o:main.c:(.text+0x54)||undefined reference to `SHGetSpecialFolderPathW'|Sowie bei Ansi und Unicode..