Author Topic: compiled program doesn't work  (Read 25287 times)

Offline Trafficjunky

  • Single posting newcomer
  • *
  • Posts: 8
compiled program doesn't work
« 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 ???

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: compiled program doesn't work
« Reply #1 on: July 12, 2013, 07:24:21 pm »
code?

what about executing it from cmd/terminal?

Offline Trafficjunky

  • Single posting newcomer
  • *
  • Posts: 8
Re: compiled program doesn't work
« Reply #2 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;
}

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: compiled program doesn't work
« Reply #3 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?

Offline Trafficjunky

  • Single posting newcomer
  • *
  • Posts: 8
Re: compiled program doesn't work
« Reply #4 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

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: compiled program doesn't work
« Reply #5 on: July 12, 2013, 07:46:27 pm »
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!]

Offline Trafficjunky

  • Single posting newcomer
  • *
  • Posts: 8
Re: compiled program doesn't work
« Reply #6 on: July 12, 2013, 07:51:41 pm »
I allready tried getch(); scanf(); delay(); and system("pause"); ... nope

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: compiled program doesn't work
« Reply #7 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

Offline Trafficjunky

  • Single posting newcomer
  • *
  • Posts: 8
Re: compiled program doesn't work
« Reply #8 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)

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: compiled program doesn't work
« Reply #9 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
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Trafficjunky

  • Single posting newcomer
  • *
  • Posts: 8
Re: compiled program doesn't work
« Reply #10 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?
« Last Edit: July 12, 2013, 08:22:32 pm by Trafficjunky »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: compiled program doesn't work
« Reply #11 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.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Trafficjunky

  • Single posting newcomer
  • *
  • Posts: 8
Re: compiled program doesn't work
« Reply #12 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)
 

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: compiled program doesn't work
« Reply #13 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.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Trafficjunky

  • Single posting newcomer
  • *
  • Posts: 8
Re: compiled program doesn't work
« Reply #14 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.