How to develop C programmes without an IDE in Wind

2020-06-17 05:58发布

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 and write code in text editors, and finally run it in a prompt?

If the answer is yes, how?

标签: c ide
11条回答
三岁会撩人
2楼-- · 2020-06-17 06:42

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.

查看更多
对你真心纯属浪费
3楼-- · 2020-06-17 06:42

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.

查看更多
疯言疯语
4楼-- · 2020-06-17 06:47

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.

查看更多
Root(大扎)
5楼-- · 2020-06-17 06:48

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.

查看更多
时光不老,我们不散
6楼-- · 2020-06-17 06:49

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"

查看更多
登录 后发表回答