Qt: Windows-Funktionen sind nicht aufgelöste externe Symbole
Ich versuche, eine einfache helloworld-artige Nicht-Qt C ++ - Anwendung mit der WinAPI in QtCreator zu kompilieren. Hier ist der Code:
#include <windows.h>
int main()
{
HWND cons = GetConsoleWindow();
SetWindowText(cons, L"I am the console window");
MessageBox(cons, L"Hello world!", L"I am the MessageBox", MB_OK | MB_ICONERROR);
return 0;
}
Sieht sehr einfach aus, aber wenn ich versucht habe, es zu erstellen, schlägt die Kompilierung fehl mit:
main.obj:-1: error: LNK2019: unresolved external symbol __imp__MessageBoxW@16 referenced in function _main
main.obj:-1: error: LNK2019: unresolved external symbol __imp__SetWindowTextW@8 referenced in function _main
Ich fing an zu suchen und fanddiese, aber es hat mir überhaupt nicht geholfen, denn als ich das geschrieben hatte:
LIBS += -L"C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\Lib"
und sogar das:
LIBS += -L"C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\Lib\\shell32.lib"
in meinem.pro
Diese "Symbole" stehen noch ungelöst. Ich lief qmake nachjede Änderung zum.pro
-Inhalt. Also irgendwelche Ideen?