PDA

View Full Version : QtCore4.dll error when starting the program from cd



circass
14th June 2010, 14:43
Hello,
i have a program that i wrote and i want to put it into a cd or dvd. i made all the needed things. i wrote an autorun.exe, this copies the program files under c:/temp/myProgram/ directory. all the things are ok until here. after the copy operation ends i try to start the myprogram.exe with using QProcess. but it is not starting. it gaves an error and says something about qtcore4.dll but it doesnt say it is missing or can not be found. all the dll files are in the same directory with the exe file. and i also copy the qtcore4.dll under the system32 directory too. but it didnt make any changes. I try to start the myprogram.exe directly when the cd rom is started but it gaves me the same error too.
What can be the problem ? How can i success to start that program ?...

Thanks

high_flyer
14th June 2010, 14:49
it gaves an error and says something about qtcore4.dll
Post the exact error you get.

circass
14th June 2010, 15:18
Problem signature:
Problem Event Name: APPCRASH
Application Name: DVCDVersion.exe
Application Version: 0.0.0.0
Application Timestamp: 4c1617fc
Fault Module Name: QtCore4.dll
Fault Module Version: 4.6.0.0
Fault Module Timestamp: 4b0d63e9
Exception Code: c0000005
Exception Offset: 0001e89f
OS Version: 6.1.7600.2.0.0.256.1
Locale ID: 1055
Additional Information 1: 0a9e
Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
Additional Information 3: 0a9e
Additional Information 4: 0a9e372d3b4ad19135b953a78882e789

This is the exact error code. When i try to run it with double click it is running but it is not when i try to run it with an external program using QProcess.
Thanks

high_flyer
14th June 2010, 15:58
Is this all you get?
Isn't there a message string either in a popup message box or at the beginning of the one you posted?

circass
14th June 2010, 16:07
Yep thats all i get. it is not poped up also. windows says me only this sentence "Program stoped wroking" - > Cloase Program. -> Debug Program -> Send Error Message and there is a link on that form that says see the detailed info about that problem, when i clicked it, the message that i sent is shown in a form. Thats all. The weard things is why it is working when i clicked twice but not working when i want to start it with an external program !!! i cant see any reason yet...
Thanks

high_flyer
14th June 2010, 16:19
Please show the code you are using.

circass
14th June 2010, 16:29
QProcess *proc = new QProcess(NULL); // no parents cause i dont want to bind those two applications, i just want to start it without parent....
QString programPath = "myProgram.exe"; // these two programs are in the same directory and it tries to start the program but program is crashing when the trigger comes from a program which is in cd. it is working in local too.
proc->start(programPath);

let me explain the situation in details. First i tried to start the program directly with autorun.inf. It gaves me that qtcore4.dll error. Then i wrote an other exe that copies the files of my real exe into a directory and then starts the program. it gaves the same error. But if i try it in harddisks it is working too. After that i thought if i add an other exe file and i copy it with the real exe into computers harddisk and if i satrt that little exe from cd then maybe i can start the real exe too. But it gaves me the exact same error. Cause the problem is starts with the CD/DVD thing.
Thanks

high_flyer
14th June 2010, 16:48
QProcess *proc = new QProcess(NULL); // no parents cause i dont want to bind those two applications, i just want to start it without parent....


It looks like you are using a local pointer 'proc'.
At the end of the function it will be destroyed - no wonder the application crashes.

You have to make your QProcess pointer a member, and it has to live as long as the process you are running with it lives.

circass
14th June 2010, 16:55
I think you are wrong about that, i dont want to kill real exe when the other one killed. And pointers are not destroyed if they have no parents and if you dont delete them or directly the pointer. That is the deal here. I want to start the program and close the other one. And as i said it is working if i start the autorun.exe in my harddisk.
AutoRun.exe -> copies the files and Starts ApplicaitonRunner.exe
ApplicationRunner.exe -> starts MyProgram.exe
MyProgram.exe -> Crashes when qtcore4.dll is tried to be load...
Thanks.

high_flyer
14th June 2010, 17:03
And pointers are not destroyed if they have no parents and if you dont delete them or directly the pointer.
LOL.
You better read some basic C++ tutorials about pointers.
The only thing that does not get destroyed in a case of a local pointer is the allocated memory.
The pointer variable gets destroyed,and in fact causes a memory leak,which will be cleaned up only when the allocating process is destroyed.


This might not be the cause of your crash, but since you didn't post much code, its hard to say.

circass
14th June 2010, 17:13
And pointers are not destroyed if they have no parents and if you dont delete them or directly the pointer.

Hehehe i think you have to read those tutorials(espacially QtAssistan -> QProcess -> Constructor parameters and their meanings) or what i wrote but anyway thanx for your tries. Better if you try to write some basic examples what we are talking about. You can see what i m talking about clearly with that way.

high_flyer
14th June 2010, 17:26
Hehehe i think you have to read those tutorials(espacially QtAssistan -> QProcess -> Constructor parameters and their meanings)
I think that after about 8 year of Qt programming I got the idea.
It has nothing to do with QProcess but C++ basics, see below:


void MyClass::foo()
{
QProcess *pProcess = new QProcess();
.....

}

At the end of foo() the pointer pProcess is destroyed. period.
And you can't access that instance of QProcess anymore (unless you saved the address in another pointer that lives beyond the scope of foo() such as a member variable.)

It is well possible that your crash has nothing to do with QProcess, but with some out of scope pointer, but without seeing your code its hard to say.

borisbn
15th June 2010, 05:48
circass, did you deployed a CRT of your compiler (vc_redist for MSVC) ?

circass
16th June 2010, 08:17
Ok,
i found the problem. This is what i got:::

If you are trying to open an external program and if that program uses some extra files for loading then you have to set the working path of that program.

QProcess->setWorkingDirectory(Program'sDirectory);

The real problem was a xml file that must be load at the begining of the program. when it couldnt load it gave that rediciolus error QtCore4.dll thing. I was searching for a wrong thing from the begining... Well i solved my problem.
Thank you for all your efforts.

Circass