Ok, so it might just be a bug? I thought this is just not possible.
I use 32-bit Windows 7, and for MinGW I just used the one from QtSDK, that I downloaded with QtCreator.
I installed the newest version of MinGW and changed the System path to the new folder. Is that everything that I have to do, to use the newer MinGW. In Qt it still says MinGW4.4 ...
Anyways, it still crashes, at the line with the first #pragma omp.
I created a testcase, that is close to my program:
	
	- #include <QtGui/QApplication> 
- #include "mainwindow.h" 
-   
- int main(int argc, char *argv[]) 
- { 
-     MainWindow w; 
-     w.show(); 
-   
-     return a.exec(); 
- } 
        #include <QtGui/QApplication>
#include "mainwindow.h"
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;
    w.show();
    
    return a.exec();
}
To copy to clipboard, switch view to plain text mode 
  
	
	- #ifndef MAINWINDOW_H 
- #define MAINWINDOW_H 
-   
- #include <QMainWindow> 
-   
- namespace Ui { 
- class MainWindow; 
- } 
-   
- { 
-     Q_OBJECT 
-   
- public: 
-     explicit-  MainWindow (QWidget *- parent  = 0)- ; 
 
-     ~MainWindow(); 
-   
- private slots: 
-     void on_pushButton_clicked(); 
-   
- private: 
-     Ui::MainWindow *ui; 
- }; 
-   
- #endif // MAINWINDOW_H 
        #ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
    Q_OBJECT
    
public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();
    
private slots:
    void on_pushButton_clicked();
private:
    Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H
To copy to clipboard, switch view to plain text mode 
  
	
	- #include "mainwindow.h" 
- #include "ui_mainwindow.h" 
- #include "worker.h" 
- #include <QThread> 
-   
-   
- MainWindow ::MainWindow(QWidget *- parent ) :
-     ui(new Ui::MainWindow) 
- { 
-     ui->setupUi(this); 
- } 
-   
- MainWindow::~MainWindow() 
- { 
-     delete ui; 
- } 
-   
- void MainWindow::on_pushButton_clicked() 
- { 
-     worker* wThread = new worker(this); 
-     wThread->start(); 
- } 
        #include "mainwindow.h"
#include "ui_mainwindow.h"
#include "worker.h"
#include <QThread>
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
}
MainWindow::~MainWindow()
{
    delete ui;
}
void MainWindow::on_pushButton_clicked()
{
    worker* wThread = new worker(this);
    wThread->start();
}
To copy to clipboard, switch view to plain text mode 
  
	
	- #ifndef WORKER_H 
- #define WORKER_H 
-   
- #include <QtCore> 
- #include <QThread> 
-   
- { 
- Q_OBJECT 
-   
- public: 
-     explicit-  worker (QObject *- parent  = 0)- ; 
 
-   
- protected: 
-     void run(); 
-   
- }; 
-   
- #endif // WORKER_H 
        #ifndef WORKER_H
#define WORKER_H
#include <QtCore>
#include <QThread>
class worker : public QThread
{
Q_OBJECT
public:
    explicit worker(QObject *parent = 0);
protected:
    void run();
};
#endif // WORKER_H
To copy to clipboard, switch view to plain text mode 
  
	
	- #include "worker.h" 
- #include "threads.h" 
- #include <QtCore> 
- #include <QThread> 
-   
- { 
- } 
-   
- void worker::run() 
- { 
-     threads thr; 
-     thr.startThreads(); 
- } 
        #include "worker.h"
#include "threads.h"
#include <QtCore>
#include <QThread>
worker::worker(QObject *parent) :
    QThread(parent)
{
}
void worker::run()
{
    threads thr;
    thr.startThreads();
}
To copy to clipboard, switch view to plain text mode 
  
	
	- #ifndef THREADS_H 
- #define THREADS_H 
-   
- class threads 
- { 
- public: 
-     void startThreads(); 
- }; 
-   
- #endif // THREADS_H 
        #ifndef THREADS_H
#define THREADS_H
class threads
{
public:
    void startThreads();
};
#endif // THREADS_H
To copy to clipboard, switch view to plain text mode 
  
	
	- #include "threads.h" 
- #include <QDebug> 
- #include <omp.h> 
- #include <iostream> 
-   
- using namespace std; 
-   
- void threads::startThreads() 
- { 
-   
-     bool finished = false; 
-   
- #pragma omp parallel sections 
-     { 
- #pragma omp section 
-         { 
-             int a=0; 
-             char outBuffer[500]; 
-             while(a<1000){ 
-                 sprintf(outBuffer,"a: %d \n", a); 
-                 qDebug( outBuffer); 
-                 a++; 
-             } 
-             finished = true; 
-   
-         } 
- #pragma omp section 
-         { 
-             int b=0; 
-             char outBuffer[500]; 
-             while( !finished ){ 
-                 sprintf(outBuffer,"b: %d \n", b); 
-                 qDebug( outBuffer); 
-                 b++; 
-             } 
-         } 
-     } 
-   
- } 
        #include "threads.h"
#include <QDebug>
#include <omp.h>
#include <iostream>
using namespace std;
void threads::startThreads()
{
    bool finished = false;
#pragma omp parallel sections
    {
#pragma omp section
        {
            int a=0;
            char outBuffer[500];
            while(a<1000){
                sprintf(outBuffer,"a: %d \n", a);
                qDebug( outBuffer);
                a++;
            }
            finished = true;
        }
#pragma omp section
        {
            int b=0;
            char outBuffer[500];
            while( !finished ){
                sprintf(outBuffer,"b: %d \n", b);
                qDebug( outBuffer);
                b++;
            }
        }
    }
}
To copy to clipboard, switch view to plain text mode 
  
				
			
Bookmarks