CPP file runs, but doesn't work when compiled to exe - c++

I have created a cpp file using Microsoft Visual Studio 2010 and Allegro. It runs perfectly fine in the Visual Studio interface, but when I compile it into an exe, it says:
"The program can't start because allegro-5.0.10-monolith-md-debug.dll is missing from your computer. Try reinstalling the program to fix this problem."
I am running the exe on the same computer I used to write the code and debug it, so it shouldn't be the fault of a missing dll. Should it? That doesn't make sense to me.... I have compiled other exes before, and they do run on other computers, and the Allegro one works just fine while it's a cpp file, but when the Allegro file is run as an exe, it says I don't have the monolith thing.
Why is the file failing as an exe, but not a cpp?

This is what worked for me:
When in Configuration Properties -> Debugging
- Add PATH=c:\allegro\bin;%PATH% to the Environment Variable.
I had the exact same error, the program was telling me that it couldn't find the monolith DLL file. What I had noticed is instead of PATH=c:\allegro\bin;%PATH% I had put PATH=c:\allegro\bin:%PATH%. The difference is not easy to spot.
I put a : instead of a ; between bin and %PATH%
it was an easy mistake, however it caused me about 3 hours of heartache to fix.

Related

0xc000007b error in Visual Studio project

I've created my C++ aplication that loads 2 DLLs: 1 wrriten in MASM assembler and the second written in C++. It uses Windows Forms' UI and works fine, but only on my computer.
On computers of all of my friends it causes 0xc000007b error that I'm unable to solve. I read everything I found about this error. Nothing helps.
I tried to do anything with manifests options in linker section, I tried to add lot of different DLLs to folder with project, I tried to use Debug and Release versions, I tried to change it to x64 version (without success).
I used dependency walker, it shows lot of DLLs missing (even though on my computer program works.) - I don't know what to do with this.
Do you have any idea? In my application I use only Windows Forms, fstream, msclr\marshal_cppstd.h and my DLLs.

Stand-alone app with wxWidgets

I've got a problem with my app, when it comes to executing it in compiled .exe form. I am new in this and I don't know where the problem is. I already tried to search this problem on Google & this site but nothing what I found helped me.
I am using Code::Blocks IDE with MinGW and wxWidgets 2.8.X installed.
Everything works fine inside IDE, but when I try to run it as exe - already compiled - I get an error like this:
The program can not start because the computer is missing wxmsw28u_gcc_custom.dll.
Try to solve this problem by reinstalling the program.
When I copy this .dll file right next to my .exe then it will execute without any errors.
Any clues how to fix it ? I guess it's easy to fix but I really don't know how ...
It needs the DLL file to execute. You can either ship that with your app, or compile wxWidgets as a static library, so that it will be shipped in your .exe file (thus making it bigger).

My C++ program gets" ... .exe has stopped working" windows 7 error

I have written a C++ program in Visual Studio 2010. It builds and runs fine in the IDE (even when running without debugger, in Release mode). However, whenever I run the executable from the command prompt, I get an "... .exe has stopped working" error message.
How can I figure out what's causing it to crash? Do I have to include something else in the command line if I use additional libraries/headers? Are there errors that make it through the Visual Studio IDE, but cause problems when running the program on the outside?
I'm not including my code, because there's way to much of it...
Help is greatly appreciated.
If your program had been rendered in Debug mode, try rendering it in Release mode and then retry.
The problem was incomplete directories for the files I was loading. I neglected to check for a successful open or use try/catch. It was running fine in the IDE because the file directory was in a subdirectory of the working directory. When I tried to run it from the command prompt, the relative directory was no longer valid. I changed the filenames to their complete directories, and everything worked fine.

Qt5Cored.dll missing when trying to run application

I'm using Visual Studio 2013 Ultimate.
My Qt version is 5.2.1
Am using a specific build for VS2013 which I obtained from here.
Now, what I did:
Created a new Qt Application from Visual Studio.
Typed in my logic and the code.
Built it successfully in x64 Debug mode.
Ran the application successfully.
Everything good so far.
Now the problem:
I restart my Visual Studio and load the project.
It is built successfully (in x64 Debug).
Now, am unable to run it. I get the error:
The program can't start because Qt5Cored.dll is missing from your computer.
Try reinstalling the program to fix this problem.
It ran the first time when I created the application. Now it won't run.
I tried simulating the problem, and this happens everytime. Runs the first time, and doesn't run after Visual Studio restart.
Please help me resolve this issue.
Thanks in advance.
From project properties you have to go to debugging -> Environment -> and write PATH=qt5 dll paths Or you have to put the dlls next to the exe.
The first time you in debug mode. Probably in that case Qt5Cored.dll (with a d in the name) was used. Maybe in the second build, you build in release mode, and for some reason Qt5Core.dll is not found in the PATH.
here is what i did and it worked :D
first : make sure you are building a release version not a debug version
second : it asked for the qt5core.dll when you copy it to the same path of your program it may ask for other *.dll files so i put the program in the folder containing all the dlls :D
which is
C:\Qt\Qt5.7.0\5.7\mingw53_32\bin
or according to your installation ..it worked well
any way this folder (as i think) contains all DLL libraries you may need with your program
so to know what exactly you need from it try to start your program many times in another location and in every time you will know another dll needed according to your programming ..
that method worked but i think there may be a more cleaver solutions we have to dig for :)

Tried to embed python in a visual studio 2010 c++ file, exits with code 1

I am trying to embed some python code in a c++ application i am developing with ms visual studio c++ 2010. But when i run the program, it exits with code 0x01 when i call Py_initialize().
I dont know how to find out what went wrong. the help file says, Py_Initialize can't return an error value, it only fails fataly.
But, why did it fail?
I am using a self-compiled python27_d.dll, which i created with the msvs project files in the source downloads from python.org.
Is there simple 'hello world' type example of the Py_Initilize code in the python sdk you can start with?
That will at least tell you if you have the compiler environment setup correctly, or if the error is in your usage.
Well, i finally found out what went wrong.
I did compile my python27_d.dll with the same VC10 as my program itself.
But my program is normally compiled as 64 bit executable. I just forgot to compile the dll for x64, too. I didnt think this would lead to such annoying behavoiur, as i believed i would get a linkr error then.