DEV Community

sydney
sydney

Posted on

Compiles, won't execute

I have a book of c algorithm projects where I entered the relevant files into a project. The program uses stdio. It compiles OK, but when I execute the program I get absolutely nothing, not even a momentary command line (MS DOS) window. Going into a MS DOS window and running the exe file from the command line, I also get nothing. I should see the output from the stdio library here! Putting a System("pause") line in front of the main return I don't think will help either. Since I am a newbie to the DevC++ IDE I believe that there is something wrong with how I set up the project. So I need advice on getting the code to work.
syd/wt1v

Top comments (2)

Collapse
 
syd_71 profile image
sydney

include

include

include

int main(int argc, char** argv) {
fprintf(stdout, "testing helloC/n");
system("PAUSE");
return 0;
}
I made this small test program which is a small snippet of my program that doesn't work and this one works! In this project I did select a command prompt window while making the project, so I tried to go back and find out what I selected in the original project that I made. Unfortunately, I can find no way of figuring out what I originally selected making the project. So I think all I can do is create a new duplicate project where I will know that I have the command prompt window selected, then erase the original project. The includes are stdio, stdlib, and string. I don't know why they don't show up in the preview.
syd

Collapse
 
syd_71 profile image
sydney

include

include

include

int main(int argc, char** argv) {
fprintf(stdout, "testing helloC/n");
system("PAUSE");
return 0;
}
this small test program ( a snippet from the non working program worked)