jason
jason

Reputation: 321

Codelite C++ program not compiling and running

I installed codellite 7.0 yesterday and have been trying to work with it. But there seem to be some problem. I cannot run any code. For now code is pretty simple.

#include <stdio.h>

int main(int argc, char **argv)
{
   printf("hello world\n");
return 0;
}

however, it returns following and output is blank with Press any key to continue

Current working directory: D:\ .....

Running program: le_exec.exe ./1

Program exited with return code: 0

Upvotes: 1

Views: 7188

Answers (1)

Hatted Rooster
Hatted Rooster

Reputation: 36463

Your program is running fine, the only problem is that after the printf the program returns 0 and shuts down immediately, it does run and print out "hello world", you just don't have the time to see it.

To make the program wait for user input so that you can see the output use cin.get() :

#include <stdio.h>
#include <iostream>

int main(int argc, char **argv)
{
   printf("hello world\n");
   std::cin.get();
return 0;
}

Upvotes: 2

Related Questions