问题
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
回答1:
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;
}
来源:https://stackoverflow.com/questions/29496999/codelite-c-program-not-compiling-and-running