Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/60.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C 使用gnuplot的编译警告_C_Compilation_Gnuplot_Compiler Warnings - Fatal编程技术网

C 使用gnuplot的编译警告

C 使用gnuplot的编译警告,c,compilation,gnuplot,compiler-warnings,C,Compilation,Gnuplot,Compiler Warnings,我想在Linux的代码中使用gnuplot,所以我写了这行: FILE *gnuplotPipe = popen ("gnuplot -persistent", "w"); 编译器给了我这个警告: warning: initialization makes pointer from integer without a cast 有人能解释一下这个警告是什么吗?我该怎么做才能正确地做呢?你忘了把 #include <stdio.h> #包括 在文件的顶部 头文件包含函数的定义,

我想在Linux的代码中使用gnuplot,所以我写了这行:

FILE *gnuplotPipe = popen ("gnuplot -persistent", "w");
编译器给了我这个警告:

warning: initialization makes pointer from integer without a cast
有人能解释一下这个警告是什么吗?我该怎么做才能正确地做呢?

你忘了把

#include <stdio.h>
#包括
在文件的顶部

头文件包含函数的定义,包括
popen()
的定义。它告诉编译器
popen()
返回一个
文件*


如果不包括头文件,编译器将采用默认返回值,即
int
。因此,可以解释警告:编译器认为
popen()
返回一个
int
,然后想把它分配给一个
文件*

你确定警告来自这一行吗?你是否在顶部包含了
#include
。@SouravGhosh很可能是这样。@paramagneticscroissant是的,对,虽然没有转发声明[头文件],但我包含了stdio.hI和stdio.h