【发布时间】:2013-11-03 17:10:45
【问题描述】:
我使用的是 Ubuntu 13.10。我收到以下代码的一些错误。
#include <stdlib.h>
#include <stdio.h>
#include <fstream.h>
int main(int argc, char *argv[])
{
error.set_program_name(argv[0]);
if ( argc != 2 )
{
// printf(argv[0] + " usage: fifo_client [string] \n");
/// cout << argv[0] << " usage: fifo_client [string]" << endl;
exit(EXIT_FAILURE);
}
ofstream out(fifo_file);
if(out)
out << argv[1] << endl;
return(EXIT_SUCCESS);
}
如果我使用命令运行上述程序 a.c
gcc a.c -o a
a.c:1:20: fatal error: iostream: No such file or directory
#include <iostream>
^
compilation terminated.
我不知道是什么问题。
【问题讨论】:
-
重命名为
a.cpp,并使用g++命令。 -
您显示的代码也不是
#include <iostream,但您编译的代码可以。所以你没有向我们展示你正在编译的内容。