Code::Blocks

User forums => Using Code::Blocks => Topic started by: 93NickCousar on September 10, 2018, 10:20:51 pm

Title: Compiling in the Windows Command Prompt
Post by: 93NickCousar on September 10, 2018, 10:20:51 pm
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 (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:

Hi !

Either it is not installed, either it is not in the PATH environment variable.

Did you install the bundle that includes GCC ?

Dje


Title: Re: Compiling in the Windows Command Prompt
Post by: oBFusCATed on September 11, 2018, 03:39:30 pm
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)