Shlomo
Shlomo

Reputation: 3990

Simple way to execute C program without IDE

I am new to C. What is the most simple way to execute a C program without an IDE?

I created my first C program und it runs flawlessly using my IDE Netbeans on Mac OS X. Now I need to make that program be "executable without IDE on Windows".

Also the requirement is only "Windows", no specific version. Which means I might have to support XP, Vista, 7, 8.

What is the most simple way to do so?

Upvotes: 1

Views: 1817

Answers (2)

Zach P
Zach P

Reputation: 1791

Download MinGW here: http://sourceforge.net/projects/mingw/files/latest/download?source=files and install it. Then go to cmd (In Windows 8 - Windows key+R and type cmd in the window opened. In Windows 7 - search >> run >> cmd). After installing it and entering cmd type in the Command Prompt window (CMD) cd C:/MinGW/bin (when MinGW is on C drive which is the default path). After doing so type the following command: gcc -o X.exe Y.c when X is the name of the output file (what name you want the .exe file to be and Y is the name of the C file that must be inside of the BIN folder (C:/MinGW/bin by default). It should be compiled smoothly if it compiled in your IDE and then the .exe file would be in the BIN folder named X.exe (when X is what you typed in the CMD). Afterwards, you can close your CMD and do with the .exe file whatever you like.

Upvotes: 1

John Zwinck
John Zwinck

Reputation: 249394

As soon as you have built your app, it is a program you can run outside the IDE. You just need to find it. :) In NetBeans this will usually be under your project directory in a subdirectory called "dist". There will be an executable file in there which you can copy out to wherever you want.

Upvotes: 1

Related Questions