1

我昨天安装了 codellite 7.0 并一直在尝试使用它。但是好像有点问题。我无法运行任何代码。现在代码非常简单。

#include <stdio.h>

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

但是,它返回以下内容并且输出为空白Press any key to continue

当前工作目录:D:\ .....

运行程序:le_exec.exe ./1

程序退出并返回代码:0

4

1 回答 1

2

您的程序运行良好,唯一的问题是printf程序返回 0 并立即关闭后,它确实运行并打印出“hello world”,您只是没有时间查看它。

要让程序等待用户输入以便您可以看到输出,请使用cin.get()

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

int main(int argc, char **argv)
{
   printf("hello world\n");
   std::cin.get();
return 0;
}
于 2015-04-07T17:03:50.330 回答