vim菜鸟
-
- 帖子: 3182
- 注册时间: 2006-03-10 15:10
- 来自: xi'an China
- 联系:
- newman0708
- 帖子: 188
- 注册时间: 2007-09-22 13:09
-
- 帖子: 3182
- 注册时间: 2006-03-10 15:10
- 来自: xi'an China
- 联系:
-
- 帖子: 36
- 注册时间: 2007-05-11 19:48
- 来自: 湖北襄樊
第一个C程序问题
我一直都不能完成最基本的C程序!
我想输入一个简单的C程序HELLO WORLD
是这样编译的:
#include <stdio.h>
int main()
{
printf("Hello, world!\n");
return 0;
}
存为并退出:hello.c
在终端输入:gcc -o hello.c vi.c回车
出现:
wangxuyuan@wangxuyuan-laptop:~$ gcc -o hello.c vi.c
gcc: vi.c:No such file or directory
gcc: 没有输入文件
wangxuyuan@wangxuyuan-laptop:~$
这是怎么回事阿,大家能看看我是那里出错了?
C程序我在很多地方找到的都不一样!这是怎么回事?
如:我在书上看到的:
#include<iostream>
int main()
{
std::cout<<"hello world!\n;
return 0;
}
我想输入一个简单的C程序HELLO WORLD
是这样编译的:
#include <stdio.h>
int main()
{
printf("Hello, world!\n");
return 0;
}
存为并退出:hello.c
在终端输入:gcc -o hello.c vi.c回车
出现:
wangxuyuan@wangxuyuan-laptop:~$ gcc -o hello.c vi.c
gcc: vi.c:No such file or directory
gcc: 没有输入文件
wangxuyuan@wangxuyuan-laptop:~$
这是怎么回事阿,大家能看看我是那里出错了?
C程序我在很多地方找到的都不一样!这是怎么回事?
如:我在书上看到的:
#include<iostream>
int main()
{
std::cout<<"hello world!\n;
return 0;
}
-
- 帖子: 3182
- 注册时间: 2006-03-10 15:10
- 来自: xi'an China
- 联系:
Re: 第一个C程序问题
另一帖子中回复你了w3484732 写了:我一直都不能完成最基本的C程序!
我想输入一个简单的C程序HELLO WORLD
是这样编译的:
#include <stdio.h>
int main()
{
printf("Hello, world!\n");
return 0;
}
存为并退出:hello.c
在终端输入:gcc -o hello.c vi.c回车
出现:
wangxuyuan@wangxuyuan-laptop:~$ gcc -o hello.c vi.c
gcc: vi.c:No such file or directory
gcc: 没有输入文件
wangxuyuan@wangxuyuan-laptop:~$
这是怎么回事阿,大家能看看我是那里出错了?
C程序我在很多地方找到的都不一样!这是怎么回事?
如:我在书上看到的:
#include<iostream>
int main()
{
std::cout<<"hello world!\n;
return 0;
}
-
- 帖子: 21
- 注册时间: 2006-12-21 8:45
Re: vim菜鸟
直接make + 文件名前部分(去掉".c")李伟武 写了:在vim 下编写C程序
#include<stdio.h>
void main(void)
{
printf("ubuntu");
}
在命令模式下输入地:make
之后提示:make: *** 没有指明目标并且找不到 makefile。 停止。
这个问题怎么解决呀??
-
- 帖子: 24
- 注册时间: 2008-03-30 15:37
Re: 第一个C程序问题
wangxuyuan@wangxuyuan-laptop:~$ gcc -o hello.c vi.cw3484732 写了:我一直都不能完成最基本的C程序!
我想输入一个简单的C程序HELLO WORLD
是这样编译的:
#include <stdio.h>
int main()
{
printf("Hello, world!\n");
return 0;
}
存为并退出:hello.c
在终端输入:gcc -o hello.c vi.c回车
出现:
wangxuyuan@wangxuyuan-laptop:~$ gcc -o hello.c vi.c
gcc: vi.c:No such file or directory
gcc: 没有输入文件
wangxuyuan@wangxuyuan-laptop:~$
这是怎么回事阿,大家能看看我是那里出错了?
C程序我在很多地方找到的都不一样!这是怎么回事?
如:我在书上看到的:
#include<iostream>
int main()
{
std::cout<<"hello world!\n;
return 0;
}
后面那个vi.c文件是干嘛的,应该把那个去掉就可以了吧。
-
- 帖子: 2841
- 注册时间: 2006-09-11 22:47
-
- 帖子: 4
- 注册时间: 2008-09-10 1:41
编译c程序,说没有stdio.h 这个文件
终端输入vi hello.c
#include <stdio.h>
int main()
{
printf("hello man\n");
return 0;
}
退出,保存
再输入gcc hello.c
结果输出下面的东东
hello.c:1:19: 错误: stdio.h:没有该文件或目录
hello.c: 在函数‘main’中:
hello.c:4: 警告: 内建函数 ‘printf’ 不兼容的隐式声明
我确保自己的gcc是有装,而且是新的,请问各位大哥是什么原因
#include <stdio.h>
int main()
{
printf("hello man\n");
return 0;
}
退出,保存
再输入gcc hello.c
结果输出下面的东东
hello.c:1:19: 错误: stdio.h:没有该文件或目录
hello.c: 在函数‘main’中:
hello.c:4: 警告: 内建函数 ‘printf’ 不兼容的隐式声明
我确保自己的gcc是有装,而且是新的,请问各位大哥是什么原因