When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.
36 messages ยท Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.
A) compile and run manually (or with a makefile) through terminal
B) #1013107104678162544
oh how would I compile the code?
Idk how it is for C++, but for C it's
gcc source.c -o executable
do you know where I would write this?
I assume for C++ it's something like
g++ source.cpp -o executable
In the terminal
Make sure you cd into the correct directory first
huh now it's saying fatal error
im sorry I don't know any programming words what do you mean by a correct directory ๐
The terminal.
Make sure the path is where your source file is.
yeah it just says "no file or directory"
Send screenshot please
Also can you tell me in what directory your source file is?
I just named my file .vscode
You gotta replace source.cpp with the name of your file
ohh
And executable with whatever name you want your executable to have.
On Windows probably something like my_program.exe
Your source file needs to end in .cpp
๐
So given you have a source file main.cpp in a directory C:/a/b then you need to do:
cd C:/a/b
g++ main.cpp -o main.exe
./main.exe
Ah, you figured it out already
o lol maybe I spoke too soon ๐ thank you for the help though
The first command changes the current working directory. Likely this will already be correctly set if you use the terminal from VS Code.
The second command compiles the source file into an executable/program.
The third command executes the program generated in step 2
@little sable Has your question been resolved? If so, run !solved :)
!solved
Thank you and let us know if you have any more questions!
This thread is now set to auto-hide after an hour of inactivity