News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Compiling in the Windows Command Prompt

Started by 93NickCousar, September 10, 2018, 10:20:51 PM

Previous topic - Next topic

93NickCousar

So this question might not be entirely relevant to Code::Blocks, but it has been asked before in a previous thread: http://forums.next.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



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)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]