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

Reply via email to