Pelles C forum

Pelles C => General discussions => Topic started by: Jeliel on December 15, 2007, 06:39:15 PM

Title: Pelles C does not work
Post by: Jeliel on December 15, 2007, 06:39:15 PM
Hi!

I have just started to work with pelles c but it does not work. After typing a programm like "Hello World" it is not possible to compile the programm and run it as console application. Can somebody help me? Does somebody knows where I could find an instruction manuel about pelles c in the web?

Greetings

Judith
Title: Re: Pelles C does not work
Post by: Christian on December 15, 2007, 07:11:19 PM
Could you please tell us the error a little bit more precise?

Do you have any error messages?

Or, is it possible, that the program only appears for the part of a secound, because Windows closes the command window after running a console program?
Title: Re: Pelles C does not work
Post by: Jeliel on December 15, 2007, 10:28:06 PM
Hi!

That is right, the console window only opens for a few seconds and than close before showing the programm. I don't have any error messenges. Do you know, what I should do against the window closing?

Greetings

Judith
Title: Re: Pelles C does not work
Post by: Robert on December 16, 2007, 12:41:20 AM
Put

getch();

at the end of your code  For example

#include <stdio.h>
#include <conio.h>
#include <string.h>

main()
{
  char ch[12];
  strcpy( ch, "Hello Judith" );
  printf( "Your string is: %s", ch );
  getch();
}

Robert Wishlaw
Title: Re: Pelles C does not work
Post by: Jeliel on December 16, 2007, 10:35:27 AM
Dear Robert!

Allthough I used your code, with getch() at the end, the project does not work. I typed the code an then compiled it, but nothing happend. Even if I go on the assmeble button (I hope this is the right word), the programm does not work.

Judith
Title: Re: Pelles C does not work
Post by: Christian on December 16, 2007, 06:47:58 PM
Hello,

just try to compile the program, and then open the program from a cmd-screen. (Start->Execute->cmd.exe, then search for the path with cd c:\path\to\the\file...\, then helloworldorwhatelse.exe)

Do you see your hello world?
Title: Re: Pelles C does not work
Post by: Ngan Lo on December 18, 2007, 03:04:57 PM
try add the following code at the end ( replace getch() ) :

system("pause");

this will pause the console screen & wait for you to press a key
Title: Re: Pelles C does not work
Post by: severach on December 22, 2007, 12:21:11 AM
Pause and getch() are unnecessary with Pelles because it does stop at the end of execution.

Pelles-C does not compile directly from sources. You must create a project.

File New Project Empty Projects: Win32 Console Program
File New Project Win32 Application.
Title: Re: Pelles C does not work
Post by: Robert on December 23, 2007, 06:38:54 AM

Pause and getch() are unnecessary with Pelles because it does stop at the end of execution.


If you are running the executable from a file manager, for example Windows Explorer, the command line window of the console program vanishes at the end of the program unless pause or getch() are used. If your program is very short, all you will see, maybe, is a blip.

Robert Wishlaw