riscv-software-src / riscv-tools

RISC-V Tools (ISA Simulator and Tests)
1.13k stars 446 forks source link

gcc and g++ errors #326

Closed ghost closed 3 years ago

ghost commented 3 years ago

I'm brand new to C and the C family of coding languages. I am trying to run a Hello World program I found just to check if i have set up Visual Studio Code (on Windows 10) up correctly to use C and C++. If anyone can tell me what I need to do it would much appreciated. Below are my C and C++ Hello World files.

C:

include

void main() { printf("Hello world"); }

C++:

include

using namespace std;

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

I get the resulting errors when attempt to run it:

gcc: error: Hello: No such file or directory gcc: error: World.c: No such file or directory gcc: error: World: No such file or directory gcc: fatal error: no input files compilation terminated.

g++: error: Hello: No such file or directory g++: error: World.cpp: No such file or directory g++: error: World: No such file or directory g++: fatal error: no input files compilation terminated.

jim-wilson commented 3 years ago

Don't put spaces in file names. "gcc Hello World.c" is telling gcc to compile a Hello file and a World.c file, neither of which exist.