dev c++

AliM

Beta member
Messages
3
hi im new to c++ amd im having some problems.
I have got the dev C++ compiler.
The problem is that i do what the tutorial says in the help menu,

#include <stdin.h>
main()
{
printf("Hello World\n");
}

but when i go and compile it and run it tells me to save which i do what the help says by saving it as 'hello.c' then a box appears then disappears really fast.then nothing happens. but at the bottom when it has all them things like:
compiler,resources and compile log ect. it says that 'stdin.h' is not a directoriy.
i also found out that you can use 'iostream' to go there but it also says there is no such file or directory.

so please can someone help me start off i am so keen nto learn the language i have just finished 'html' and i want to learn this next.
thanks for any help i get marshall :)
 
Hi, let's go from the top, Ok?

Step 1: Start a new project, name it, select console and make sure it is a C project.

Step 2: Enter the source code as what is shown below exactly.
Code:
[SIZE=3] 
#include <stdio.h> /*Comment: stdin.h doesn't exist as a standard!*/
#include <stdlib.h>

int main(void)
{
     printf("Hello, World!\n");
     system("pause"); /* Comment: You need this to hold the screen open to 
                                 see its output. */
     return(0); /* Required from main under C */
}
[/SIZE]

Step 3: Save everything, preferrably in the same directory together.

Step 4: From the Execute menu select Compile and Run. A dialog box should come up, stuff grinds a bit then the program window (a console) should pop
up and display your message and "Press any key to continue...". When you press a key, it should close.

There are a couple of things that could be wrong if the above doesn't work.
The easiest way to fix the most common thing is to click the Tools menu, select Compiler options and click the default button. It should reset all the directory paths to what is normal for the install. Next, if it is still misbehavin', go to the directory dev-cpp\includes and see that there are a lot of .h files hangin' out in there. Then check the dev-cpp\lib for a bunch of .a files. If all that is correct, it should work. Hope this gets it straightened out for you.
 
hi yeah thanks for help so far one last thing does it matter wot directory i save it in can i save it in my own folder in my documents
 
Yes, but as you make new programs most programmers find it useful to create a new folder per project or tutorial and put things in there. Where you put the source will usually be the default path that the executables are built in and making new directories keeps them accessable and separate. Glad it worked out.
 
Back
Top Bottom