在 Windows 上从 .C 文件创建 .exe
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5455547/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Ccreate an .exe from a .C file on Windows
提问by Amit Singh Tomar
I would like to know if it is possible to create a .EXE from a .C file without using any compiler on Windows ?
我想知道是否可以在 Windows 上不使用任何编译器的情况下从 .C 文件创建 .EXE?
回答by Paul R
You can cross-compile from another platform, e.g. using MinGW on another OS such as Linux or Mac OS X, but ultimately you need a compiler somewhere.
您可以从其他平台交叉编译,例如在其他操作系统(如 Linux 或 Mac OS X)上使用MinGW,但最终您需要在某处使用编译器。
If you don't actually need a .EXE per se, but just want to compile and run some C code without having to install a compiler, e.g. for educational/experimental purposes, then there are very useful sites such as codepad.organd ideone.comwhich provide this capability for C and a number of other languages.
如果您实际上并不需要 .EXE本身,而只想编译和运行一些 C 代码而不必安装编译器,例如用于教育/实验目的,那么有非常有用的站点,例如codepad.org和ideone .com为 C 和许多其他语言提供此功能。
回答by jdehaan
If you are really crazy it is possible. You would need an hexadecimal editor and assembly knowledge. Then you could play the "human compiler" game, transforming C into assembly and putting the opcodes in the hex editor. To learn something it might be useful but in the general case really use a compiler!
如果你真的疯了,这是可能的。您需要一个十六进制编辑器和汇编知识。然后,您可以玩“人类编译器”游戏,将 C 转换为汇编并将操作码放入十六进制编辑器中。要学习一些东西,它可能很有用,但在一般情况下,真的要使用编译器!
回答by etc-100g
You can use Visual Studio Express, too.
您也可以使用 Visual Studio Express。
Since Visual Studio 2003, Microsoft doesn't provide pure command line compiler. The compiler is shipped with an IDE now.
从 Visual Studio 2003 开始,Microsoft 不再提供纯命令行编译器。编译器现在随 IDE 一起提供。
回答by David Heffernan
You need a C compiler and linker. Your friend is confused.
您需要一个 C 编译器和链接器。你的朋友很困惑。
回答by David Heffernan
with what jokester said, that will just change the way it opens, rather than converting the file itself, so when you try and open it, you will just get an error.
就像笑话者所说的那样,这只会改变它的打开方式,而不是转换文件本身,所以当你尝试打开它时,你只会得到一个错误。
回答by David Heffernan
I use the codeblocks compiler for my C code, and with that, it does it for you, just go into the project folder of the project you just made, then go into the bin folder, then go into the debug folder, and there is a program in there, which is your program and it is a .exe file
我为我的 C 代码使用了 codeblocks 编译器,它会为您完成,只需进入您刚刚创建的项目的项目文件夹,然后进入 bin 文件夹,然后进入调试文件夹,然后有那里有一个程序,它是你的程序,它是一个 .exe 文件
Hope i may have helped someone
希望我可能帮助过某人
回答by harihb
There is no way, I would say. By definition
没有办法,我会说。根据定义
Compiler is responsible for
编译器负责
- Checking error in your code
- Convert the error free code into an object file
- 检查代码中的错误
- 将无错误代码转换为目标文件
Linker is responsbile for converting the object file into an executable. In the case of Windows, it is a .exe file.
链接器负责将目标文件转换为可执行文件。对于 Windows,它是一个 .exe 文件。
回答by user3523689
u just use Turbo C++ it will automatically make a .exe file. You can find it under "TurboC++\Disk\TurboC3\BIN" hope this hepled
你只要使用 Turbo C++,它就会自动生成一个 .exe 文件。你可以在“TurboC++\Disk\TurboC3\BIN”下找到它希望这对你有帮助