请问关于线程的问题
我创造了一个线程类如下#ifndef THREAD1_H_#define THREAD1_H_#include <iostream>using namespace std;class thread1:public QThread{ Q_OBJECTpublic: thread1();protected: void run();};#endif #include "thread1.h"#include "windows.h"thread1::thread1(){}// place your code herevoid thread1::run(){ QString text="A"; while(true) { cout << qPrintable(text); Sleep(1); }}当我调用的时候 创建一个thread1的对象thread1 t1;t1.start();之后出现了内存错误当我这样创建的时候没有错误,请问这是为什么thread1 *t1=new thread1();t1->start();第一种方法是在C++ GUI Programming with Qt4 Book 例程中看到的 不知道他的为什么就好用请各位前辈点拨