Code::Blocks Forums

User forums => Help => Topic started by: Trafficjunky on July 12, 2013, 06:55:27 pm

Title: compiled program doesn't work
Post by: Trafficjunky on July 12, 2013, 06:55:27 pm
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 ???
Title: Re: compiled program doesn't work
Post by: BlueHazzard on July 12, 2013, 07:24:21 pm
code?

what about executing it from cmd/terminal?
Title: Re: compiled program doesn't work
Post by: Trafficjunky on July 12, 2013, 07:29:34 pm
With cmd its the same.

Code is a simple Hello world exe.

Code
#include <stdio.h>

int main(void)
{
    printf("Hallo world");
    return 0;
}
Title: Re: compiled program doesn't work
Post by: BlueHazzard on July 12, 2013, 07:37:45 pm
With cmd its the same.

Code is a simple Hello world exe.

Code
#include <stdio.h>

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

what means the same? it prints Hello World and quits?
Title: Re: compiled program doesn't work
Post by: Trafficjunky on July 12, 2013, 07:44:57 pm
I dont know if it does its to fast^^ how i wrote its just for a few milisecounds on the screen
Title: Re: compiled program doesn't work
Post by: oBFusCATed on July 12, 2013, 07:46:27 pm
Put one getchar(); before the return statement and it will "work"...
Title: Re: compiled program doesn't work
Post by: Trafficjunky on July 12, 2013, 07:51:41 pm
I allready tried getch(); scanf(); delay(); and system("pause"); ... nope
Title: Re: compiled program doesn't work
Post by: 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
Title: Re: compiled program doesn't work
Post by: Trafficjunky on July 12, 2013, 08:09:46 pm
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)
Title: Re: compiled program doesn't work
Post by: stahta01 on July 12, 2013, 08:12:06 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 (http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F)
Title: Re: compiled program doesn't work
Post by: Trafficjunky on July 12, 2013, 08:15:44 pm
oh sry
Code
-------------- 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?
Title: Re: compiled program doesn't work
Post by: stahta01 on July 12, 2013, 09:05:21 pm
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.
Title: Re: compiled program doesn't work
Post by: Trafficjunky on July 12, 2013, 09:32:52 pm
no didn't ...

Code
-------------- 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)
 
Title: Re: compiled program doesn't work
Post by: stahta01 on July 12, 2013, 11:25:57 pm
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.
Title: Re: compiled program doesn't work
Post by: Trafficjunky on July 13, 2013, 12:54:23 pm
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.