gcc 初初级问题,为什么编译找不到文件?

时间:2020-12-17 12:43:33
//C:\test\hello.cpp

#include <iostream>

using namespace std;

int main(void)
{
cout << "Hello World!" << endl;
return 0;
}


//path = c:\test

f:\MingW\bin\gcc -O2 -g -o  hello  hello.cpp
gcc: hello.cpp No such file or direction
gcc: no input files

9 个解决方案

#1


..UP

#2


库的路径设置对了吗?

#3


我还以为你在LINUX下用GCC呀

#4


不知道什么地方没设置好。UP

#5


继续up

#6


加#include"stdafx.h"试试

#7




顺便问一下:using namespace std;是何意思?

#8


要详细注明hello.cpp的位置。
gcc -g -o hello.exe c:\test\hello.cpp

#9


同意楼上的,编译程序和源程序都不在同一个目录用相对路径,看来你得好好补下基础知识

#1


..UP

#2


库的路径设置对了吗?

#3


我还以为你在LINUX下用GCC呀

#4


不知道什么地方没设置好。UP

#5


继续up

#6


加#include"stdafx.h"试试

#7




顺便问一下:using namespace std;是何意思?

#8


要详细注明hello.cpp的位置。
gcc -g -o hello.exe c:\test\hello.cpp

#9


同意楼上的,编译程序和源程序都不在同一个目录用相对路径,看来你得好好补下基础知识