C在 Windows 上从 .C 文件创建 .exe
我想知道是否可以在 Windows 上不使用任何编译器的情况下从 .C 文件创建 .EXE?
I would like to know if it is possible to create a .EXE from a .C file without using any compiler on Windows ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
您可以从另一个平台进行交叉编译,例如在另一个操作系统(例如 Linux 或 Mac OS X)上使用 MinGW,但最终你需要一个编译器某处。
如果您实际上不需要 .EXE 本身,而只是想编译和运行一些 C 代码而无需安装编译器,例如用于教育/实验目的,那么有一些非常有用的网站例如 codepad.org 和 ideone.com 为 C 和许多其他语言提供了此功能。
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.
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.org and ideone.com which provide this capability for C and a number of other languages.
如果你真的很疯狂,这是可能的。您需要十六进制编辑器和汇编知识。然后你可以玩“人类编译器”游戏,将 C 语言转换为汇编语言并将操作码放入十六进制编辑器中。要学习一些东西,它可能很有用,但在一般情况下,真正使用编译器!
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 编译器和链接器。你的朋友很困惑。
You need a C compiler and linker. Your friend is confused.
您也可以使用 Visual Studio Express。
从Visual Studio 2003开始,微软不再提供纯命令行编译器。该编译器现在随 IDE 一起提供。
You can use Visual Studio Express, too.
Since Visual Studio 2003, Microsoft doesn't provide pure command line compiler. The compiler is shipped with an IDE now.
正如笑话斯特所说,这只会改变它打开的方式,而不是转换文件本身,所以当您尝试打开它时,您只会收到错误。
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.
我对我的 C 代码使用 codeblocks 编译器,它会为您完成此操作,只需进入您刚刚创建的项目的项目文件夹,然后进入 bin 文件夹,然后进入 debug 文件夹,然后就可以看到那里有一个程序,这是你的程序,它是一个 .exe 文件
希望我可以帮助别人
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
Hope i may have helped someone
我想说,没有办法。根据定义,
编译器负责
链接器负责将目标文件转换为可执行文件。对于 Windows,它是一个 .exe 文件。
There is no way, I would say. By definition
Compiler is responsible for
Linker is responsbile for converting the object file into an executable. In the case of Windows, it is a .exe file.
你只要使用 Turbo C++ 它就会自动生成一个 .exe 文件。你可以在“TurboC++\Disk\TurboC3\BIN”下找到它希望这有帮助
u just use Turbo C++ it will automatically make a .exe file. You can find it under "TurboC++\Disk\TurboC3\BIN" hope this hepled