How to develop C programmes without an IDE in Windows?

前端 未结 11 1334
耶瑟儿~
耶瑟儿~ 2021-02-09 18:52

I want to have a deeper understanding of how C programmes are run.

But IDEs stops us from doing that.

So is it possible that I manually set up the environment an

相关标签:
11条回答
  • 2021-02-09 19:02

    As others have said, install MinGW (I'm assuming you are using Windows) and put its bin directory on your path. Open a command line windows, and create a file with a text editor, such as notepad - call it foo.c:

    #include <stdio.h>
    int main() {
      printf( "hello world\n" );
      return 0;
    }
    

    Then, use the gcc compiler to compile it, creating an executable called foo.exe:

    > gcc foo.c -o foo.exe
    

    lastly, run foo.exe from the command line:

    > foo.exe
    hello world
    
    0 讨论(0)
  • 2021-02-09 19:02

    If you're interested in how large projects are organised, you could try downloading the source code for something like Apache httpd or PHP. These are both in C. On Linux/Mac you can compile them from the command-line using a few simple commands (see the documentation).

    0 讨论(0)
  • 2021-02-09 19:03

    If you want to see how the build works, most if not all IDE's create a build log which shows the actual command lines issued to invoke the compiler/linker etc. Nothing prevents you from issuing these commands directly on the command line.

    What an IDE typically also does for you is dependency management; this is difficult to maintain manually, and best left to the IDE for large projects.

    You do not need to download and install any specific compiler or toolchain as some have suggested; the one you have with your current IDE will be sufficient. For example if you have VC++2008 (or 2008 Express), the command line tools are described here.

    0 讨论(0)
  • 2021-02-09 19:06

    Here is some simple step that would make you to compile and run c program without IDE

    1 - install the TCC (Turbo C compiler)

    2- open Notepad and write C code

    3 - save as a.c in C:\TC\BIN

    4 - then open CMD

    5 - compile c code by "tcc a.c"

    6 - finally run "a.exe"

    0 讨论(0)
  • Of course. You'll need something like MinGW compilers set to compile your application (or you could use the IDE-provided compiler). Then just use CMD and execute appropriate compile commands.

    Actually, every IDE provides just more easier way to do the same compilation.

    0 讨论(0)
  • 2021-02-09 19:09

    You just need to install the MinGW compiler and set path to the gcc executable and you're ready to go. Then you can write C code in editor and compile it in command line just like you would on Linux.

    0 讨论(0)
提交回复
热议问题