Tuesday, 4 May 2010

I'm currently working on porting the simulation to Windows.

How do I get MinGW and Qt ready?

Thankfully, Peter Dimov pointed out that Qt comes with MinGW.

I downloaded and installed Qt 4.6.2 (qt-sdk-win-opensource-2010.02.1.exe).

Now Firefox Portable does not work. I downloaded and installed Firefox 3.6.3 (Firefox Setup 3.6.3.exe).

I opened the Qt Command Prompt (start->All Programs->Qt SDK by Nokia v2010.02.1 (open source)->Qt Command Prompt).

I created hello-c++.cpp
//c
#include <cstdlib>

// c++
#include <iostream>

using namespace
std;
int
main( int argc, char *argv[] )
{

cout << "Hello World!" << endl;
return
EXIT_SUCCESS;
}
I created a Makefile
all:
mingw32-g++ hello-c++.cpp
I compiled hello-c++

mingw32-make

Success!

I ran hello-c++.exe

Success!

I created hello-qt.cpp
#include <QtGui>

int
main(int argc, char *argv[])
{

QApplication app(argc, argv);
QWidget window;
window.resize(320, 240);
window.show();
window.setWindowTitle(
QApplication::translate("toplevel", "Top-level widget"));
return
app.exec();
}
I compiled a Makefile

qmake -project
qmake

I compiled hello-qt.cpp

mingw32-make release

I compiled the release version because I only had the release version of Qt.

Success!

I ran hello-qt.exe

Error: The application has failed to start because mingwm10.dll was not found.

I copied Qt\2010.02.1\mingw\bin\mingwm10.dll

Error: This application has failed to start because libgcc_s_dw2-1.dll was not found.

I copied Qt\2010.02.1\mingw\bin\libgcc_s_dw2-1.dll

Error: This application has failed to start because QtCore4.dll was not found.

I copied Qt\2010.02.1\bin\QtCore4.dll

Error: The procedure entry point _Z5qFreePv could not be located in the dynamic link library QtCore4.dll.

Thankfully, Tymek pointed out that I needed to use a different QtCore4.dll file

I copied Qt\2010.02.1\qt\bin\QtCore4.dll

Error: This application has failed to start because QtGui4.dll was not found.

I copied Qt\2010.02.1\qt\bin\QtGui4.dll

Success!

No comments:

Post a Comment