Author Topic: Can't execute my own .exe  (Read 385 times)

Offline darkonaito_

  • Single posting newcomer
  • *
  • Posts: 2
Can't execute my own .exe
« on: June 16, 2020, 05:05:00 pm »
When I compile a c++ program, I can run it inside CodeBlocks, but when i try to execute it by starting the .exe in the bin subfolder of the project, it doesn't work:

Before, Windows would tell me that 3 .dll file were missing, and after I downloaded them and copied them into system32, when I attempt to run the program Windows gives me error 0xc000007b.
« Last Edit: June 16, 2020, 05:07:16 pm by darkonaito_ »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6947
    • My Best Post
Re: Can't execute my own .exe
« Reply #1 on: June 16, 2020, 05:10:27 pm »
When I compile a c++ program, I can run it inside CodeBlocks, but when i try to execute it by starting the .exe in the bin subfolder of the project, it doesn't work:

Before, it would tell me that 3 .dll file were missing, and after i downloaded them and copied them into system32, when I attempt to run the program, windows gives me error 0xc000007b

Unless you are an Windows expert you should never copy DLLs by hand into the system32 folder!!!

Randomly downloading DLLs is a way to get your computer infected!!!

You should find the DLLs that are missing on your computer under the Compiler installation in most cases.
Copy those DLLs to where the exe is located or copy them to a non-system folder that is in the PATH.

Tim S.

C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline darkonaito_

  • Single posting newcomer
  • *
  • Posts: 2
Re: Can't execute my own .exe
« Reply #2 on: June 16, 2020, 05:14:18 pm »
Also, it's the first time I have this problem..

I'm not using any strange library or stuff like that, so...

Also, I get that error if i try to run my .exe on any computer.

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2251
Re: Can't execute my own .exe
« Reply #3 on: June 16, 2020, 07:10:01 pm »
Reasons for Windows error code 0xc000007b
The error code means an invalid image format.

You may be attempting to start an application which is designed to run on 64-bit operating system, but your computer is running 32-bit Windows.

Or you may have clobbered a system dll.

From an administrative mode command prompt (cmd.exe) run "sfc /scannow" to validate your system. It will try to fix clobbered system files. Be patient, this will take a lot of time.

Google search is your friend; and a programmers buddy.
 
« Last Edit: June 16, 2020, 07:14:44 pm by Pecan »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12695
    • Travis build status
Re: Can't execute my own .exe
« Reply #4 on: June 16, 2020, 07:33:00 pm »
Also, it's the first time I have this problem..

I'm not using any strange library or stuff like that, so...

Also, I get that error if i try to run my .exe on any computer.
Inspect the lib folder of your compiler for the missing dlls. When you find them copy them next to the executable. C::B modifies the PATH variable for you, and so "hides" problems like these. Another option is to find a compiler which provides static runtime and so you can build a standalone executable. If you need to know more please read about DLLs in MSDN it has plenty of info.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]