我正在使用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);
}
Run Code Online (Sandbox Code Playgroud)
如果我使用命令运行上述程序ac
gcc a.c -o a
a.c:1:20: fatal error: iostream: No such file or directory
#include <iostream>
^
compilation terminated.
Run Code Online (Sandbox Code Playgroud)
我不知道这个问题是什么.
使用g ++而不是gcc.gcc可以编译一个c ++文件,如果它有正确的扩展名(例如.cpp)或正确的参数(-x c++)但是添加链接C++库所需的参数太复杂了,以至于无法避免简单的解决方案.
| 归档时间: |
|
| 查看次数: |
6088 次 |
| 最近记录: |