riscv-software-src/riscv-tools

gcc and g++ errors

Opened this issue · 1 comments

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<stdio.h>

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.

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.