How can I setup a plain c++ project and continue developing it using qt creator and qmake build system (in windows!)
My Qt Creator works perfectly fine with qt projects. I am using MSVC2017-64 as my compiler.
I tried to setup a project like this
myproject.pro
CONFIG -= qt
CONFIG += c++17
DEFINES -= UNICODE QT_LARGEFILE_SUPPORT
SOURCES += \
main.cpp
HEADERS += \
main.h
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
main.cpp
#include "main.h"
#include <iostream>
int main(int argsCount, char** argsArray) {
puts("Hello, World!");
return 0;
}
main.h
#ifndef MAIN_H
#define MAIN_H
#endif // MAIN_H
And here is how my project page looks like:
But after all this when I try to build/compile I get this error:
MSVCRTD.lib(exe_winmain.obj):-1: error: LNK2019: unresolved external symbol WinMain referenced in function "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ)
debug\\WAVE2.exe:-1: error: LNK1120: 1 unresolved externals
What am I missing here?
I believe you need to specify that this is a console application. You can do this by adding CONFIG += console
or CONFIG += cmdline
. The latter superseeds the former for cross-platform. See the qmake variable reference .
Alternatively, if your application is indeed a GUI application (but through other means than Qt), you would specify CONFIG += windows
.
Both these variables will add appropriate libraries, which you are currently missing.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.