简体   繁体   English

Geany有什么问题?

[英]What's wrong with Geany?

#include <cini.h>

  int main() {
int a ;
a = 21 ;
printf(a);

return 0;
  }

Questions : 1) on the toolbar, once I've written the code, the "execute" or "compile" functions on Geany (a C compiler) seem to be disabled 2) what's wrong with my code ? 问题:1)在工具栏上,一旦我编写代码,Geany(C编译器)上的“执行”或“编译”功能似乎被禁用2)我的代码有什么问题? I'm about to learn C, so please be nice with a rookie. 我即将学习C,所以请和一个新手相处。

Geany is an editor, not a compiler. Geany是一个编辑器,而不是编译器。 If the compile and execute functions are disabled it could be because it is unable to find your actual compiler (make sure you have one installed), or because you haven't saved your file as C code. 如果禁用编译和执行函数,可能是因为它无法找到您的实际编译器(确保您已安装了一个),或者因为您尚未将文件保存为C代码。

The first argument to printf must be the format string. printf的第一个参数必须是格式字符串。 If you want to print an integer as decimal, you need to use the %d conversion specifier, like this: 如果要将整数打印为十进制,则需要使用%d转换说明符,如下所示:

printf("%d\n", a);

The \\n after the %d prints the linefeed character to the output. %d后的\\n将换行符打印到输出。 You can read about the printf function here . 您可以在这里阅读printf函数。

You need to include at least stdio.h , because printf is declared in that header. 您需要至少包含stdio.h ,因为printf是在该标头中声明的。 The only reference I could find to cini.h was this header here which won't work in a C program because it is C++ code. 我能找到cini.h的唯一参考是这个头文件,它在C程序中不起作用,因为它是C ++代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM