User forums > Using Code::Blocks
Compiling in the Windows Command Prompt
(1/1)
93NickCousar:
So this question might not be entirely relevant to Code::Blocks, but it has been asked before in a previous thread: http://forums.codeblocks.org/index.php/topic,9314.msg66340.html#msg66340, so I'm assuming it is allowed. Anyways, I downloaded the codeblocks-17.12mingw-setup.exe version and everything works fine. I've been learning how to write programs as console applications. But I want to be able to use a console that doesn't close every time it finishes executing a program. So how do you compile and run a source file in a Windows command prompt? Whenever I try the command
>gcc main.c
I get this error: "gcc is not recognized as an internal or external command"
And same goes for >minGW main.c
The linked thread had this to say, but I'm not sure what they meant by PATH variable:
--- Quote from: dje on October 04, 2008, 06:48:19 pm ---Hi !
Either it is not installed, either it is not in the PATH environment variable.
Did you install the bundle that includes GCC ?
Dje
--- End quote ---
oBFusCATed:
This https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/set_1 and in particular you need to add the path to the executable to the list of paths. Search how the PATH variable is managed on windows. https://en.wikipedia.org/wiki/PATH_(variable)
And please learn how to use the search engine of your choice. It saves time. 8)
Navigation
[0] Message Index
Go to full version