How to develop C programmes without an IDE in Windows?

前端 未结 11 1336
耶瑟儿~
耶瑟儿~ 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:10

    I don't see why an IDE should prevent understanding how a C program works. An IDE usually abstracts the building process, i.e. it creates build rules for you, runs the program and the debugger. This does not have any effect on the way the program itself works, it's just more "user friendly" (depending on how you define "user friendly").

    You can always build programs without the help of an IDE. You can even use Microsofts Visual Studio from the command line, and you won't see the GUI at all. Similar for XCode on Mac OS X.

    If you want to build a program without using any IDE, you basically write the source code the same way you do with IDE. You can even use the IDE as editor. Afterwards, you need to compile your program. IDEs usually have functionality that makes writing the source code easier like automatic completion of structure elements, basic syntax checking and the like. If the program consists of only one single source file this is usually rather trivial. If you have more than one source file (which should be true for almost everything other than the usual "Hello World" example) you can still do that manually. However, this is a tedious and error prone process. In the Unix world, make is the tool of choice to automate this. You can use MinGW to get such an environment on Windows. Cygwin is another alternative here. You could, however, also use nmake out of MSVC and write the input for that manually (never did that myself) -- it's basically the same a Makefile is for make.

    Creating a Makefile can be non-trivial. There are several generators to make that easier. That's basically the same IDEs do by abstracting the build process. Examples for Makefile generators are the autotools (sometimes also known as "GNU build system") and cmake.

    Building programs from the command line also does not have any effect about the program having a GUI or not. You can (assuming Windows again) run any .exe file from the command line. If it's a GUI application the GUI will show up, if it's a console application it will run in the console window.

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

    You can compile programs for Windows (if that's what he meant) from the command line using all the available tools in the Windows SDK (formerly called the Platform SDK, I believe) which is free to download from Microsoft. I think it has all the same tools Visual Studio has if not most of them.

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

    Download Cygwin and make sure to install GCC, the GNU C compiler.

    You can write your C programs in a text editor, compile them with GCC, and then execute them.

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

    I don't know what you mean. You want to write C programs in a text editor an then, compile?? Ofcourse, you CAN do that:

    1- Write a C code
    2- Get a compiler such as gcc (there is a windows version)
    3- Compile it
    4- Run it from console
    

    But, I am not sure if that is what you want to know.

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

    Of course! There are a bunch of C compilers available for Windows, a few one to get you going:

    • Visual Studio has an express edition which is free and comes with a compiler
    • MinGW is the Gnu C Compiler ready-to-run for windows
    • There are plenty of others, but the ones above should be .. enough for now

    As for a text editor, you might want to choose one that comes with C-syntax highlighting, like vi, Emacs or some other text editor. Mastering an editor is by the way really useful, regardless of what your language is.

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