News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

compiled program doesn't work

Started by Trafficjunky, July 12, 2013, 06:55:27 PM

Previous topic - Next topic

Trafficjunky

Hey guys

I got a problem. I compiled programs with CB for about 3 years. Everthing worked fine and without troubles. Than I updated it to the last version and I can't run my compiled exe files anymore. Not even a simple "Hello World" works. If I run the program with CB it works but if i run the exe file it just pops up for some milisecounds and nothing more happens. What did I wrong ???

BlueHazzard

code?

what about executing it from cmd/terminal?

Trafficjunky

With cmd its the same.

Code is a simple Hello world exe.

#include <stdio.h>

int main(void)
{
    printf("Hallo world");
    return 0;
}

BlueHazzard

Quote from: Trafficjunky on July 12, 2013, 07:29:34 PM
With cmd its the same.

Code is a simple Hello world exe.

#include <stdio.h>

int main(void)
{
    printf("Hallo world");
    return 0;
}


what means the same? it prints Hello World and quits?

Trafficjunky

I dont know if it does its to fast^^ how i wrote its just for a few milisecounds on the screen

oBFusCATed

Put one getchar(); before the return statement and it will "work"...
(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!]

Trafficjunky

I allready tried getch(); scanf(); delay(); and system("pause"); ... nope

BlueHazzard

if you execute it in the cmd it wont flash away... the cmd will stay open... If not you will get some segfault error...
please rebuild and post the !full! build log

greetings

Trafficjunky

Checking for existence: C:\Users\-\Documents\HalloWorld\bin\Release\HalloWorld.exe
Executing: "C:\Program Files (x86)\CodeBlocks/cb_console_runner.exe" "C:\Users\-\Documents\HalloWorld\bin\Release\HalloWorld.exe"  (in C:\Users\-\Documents\HalloWorld\.)
Process terminated with status 0 (0 minutes, 1 seconds)

stahta01

Quote from: BlueHazzard on July 12, 2013, 08:06:46 PM
if you execute it in the cmd it wont flash away... the cmd will stay open... If not you will get some segfault error...
please rebuild and post the !full! build log

greetings

http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

Trafficjunky

#10
oh sry

-------------- Clean: Release in HalloWorld (compiler: GNU GCC Compiler)---------------

Cleaned "HalloWorld - Release"

-------------- Build: Release in HalloWorld (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe -Wall -fexceptions  -O2  -Wextra   -IC:\SDL\SDL-1.2.13\include -IC:\SDL\SDL_image-1.2.12\include -IC:\Users\-\Documents\SDLmenu\lib -IC:\Users\-\Documents\SDLmenu\include  -c C:\Users\-\Documents\HalloWorld\main.cpp -o obj\Release\main.o
mingw32-g++.exe -LC:\SDL\SDL-1.2.13\lib -LC:\SDL\SDL_image-1.2.12\lib -LC:\Users\-\Documents\SDLmenu\lib  -o bin\Release\HalloWorld.exe obj\Release\main.o   -s -lmingw32 -lSDLmain -lSDL  "C:\Program Files (x86)\CodeBlocks\MinGW\lib\libSDLmain.a" "C:\Program Files (x86)\CodeBlocks\MinGW\lib\libSDL.dll.a" "C:\Program Files (x86)\CodeBlocks\MinGW\lib\libmingw32.a" "C:\Program Files (x86)\CodeBlocks\MinGW\lib\SDL_image.lib" "C:\Program Files (x86)\CodeBlocks\MinGW\lib\libwinmm.a"
Output size is 9.50 KB
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings (0 minutes, 0 seconds)



is that what you are looking for?

stahta01

Get rid of all the SDL stuff and maybe a simple "Hello World" will work!

1. Remove all the SDL from the Project Compiler/Linker Settings.
2. Remove all the SDL from the Global Compiler/Linker Settings.

Tim S.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

Trafficjunky

no didn't ...


-------------- Clean: Release in HalloWorld (compiler: GNU GCC Compiler)---------------

Cleaned "HalloWorld - Release"

-------------- Build: Release in HalloWorld (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe -Wall -fexceptions  -O2  -Wextra    -c C:\Users\-\Documents\HalloWorld\main.cpp -o obj\Release\main.o
mingw32-g++.exe  -o bin\Release\HalloWorld.exe obj\Release\main.o   -s 
Output size is 9.50 KB
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings (0 minutes, 0 seconds)


stahta01

Compile and Link an EXE from the command line, does it work?

If yes, post the commands you used on the command line.
(Likely a CB toolchain setting issue)

If no, your Compiler has an issues?

Tim S.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

Trafficjunky

Okay I thank you all! Just found the problem. I've installed MinGW twice and CB's auto search took the false one. Now everything works like it did before.