pacman -R mingw-w64-x86_64-qt5-static
pacman -S mingw-w64-x86_64-qt5
and, also,
Looking at the GCC command you issued in example 1, it looks like you are using pieces of the regular qt5 package and also pieces of the qt5-static package. You should decide which package you want to use and then just stick to using only that one package. It might be a good idea to uninstall the other package just so you don't get confused. Specifically, it looks like you are using the "Qt5Core" include directory from the regular Qt5 package, which would probably define qVersion to a be function imported from a DLL. But then at link time you are actually linking to the static version of Qt, which means qVersion would be a function that comes from a static library, not a DLL.--DavidOn Sun, Jul 26, 2020 at 8:07 AM Il'dar Al'Miev <ialm...@yandex.ru> wrote:Dear All,hello,Windows 7 (64-bit), Msys2-Mingw64 are installed in my computer.i installed Qt using the command,pacman -S mingw-w64-x86_64-qt-creator
and
pacman -S mingw-w64-x86_64-qt
i am a newbie in Qt programming. i discovered two examples in Internet._______________________________________________example1.cpp---------------------------------------#include <QtCore>#include <iostream>
int main() {
std::cout << "Qt version: " << qVersion() << std::endl;
}
in order to compile the example1.cpp, i used a command found in Internet,g++ -o example1.exe example1.cpp -I/C:/msys64/mingw64/include/QtCore -I/C:/msys64/mingw64/qt5-static/include/QtCore -L/C:/msys64/mingw64/qt5-static/lib -lQt5Core -fPIC
however, compilation comes with an error message,
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\msys64\tmp\ccpq7uZL.o:my_qt_program2.cpp:(.text+0x2c): undefined reference to `__imp_qVersion'
collect2.exe: error: ld returned 1 exit status
may be i have not installed all Qt-packages required in Msys2-Mingw64 ?
example2.cpp
-----------------------------
#include <QApplication>
#include <QWidget>int main(int argc, char *argv[]) {
QApplication app(argc, argv);
QWidget window; window.resize(250, 150); window.setWindowTitle("Simple example"); window.show(); return app.exec();}
that file i saved in a separate directory, and as it was recomended in Internet i used the following commands,qmake -project
qmake
make
after that the separate directory "release" was created (inside), where the executable "example2.exe" was created. however, when i try to execute that file in Mingw64 console, nothing is happened, that is the windows "Simple example" does not appear.
i would appreciate someone(s) in the Forum to explain me, where i made a compilation error; or it is associated with Mingw64-Msys2 ?
Thank you.
Msys2-users mailing list
Msys2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/msys2-users
_______________________________________________ Msys2-users mailing list Msys2-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/msys2-users