对于我的WINAPI项目,我使用atom IDE与c编程,我可以编译我的代码从cmd提示没有问题,直到我已经开始使用.rc
文件。但现在我在编译我的程序之前使用了rc文件,我需要在cmd提示符下运行这些命令。Cmd提示窗口编译
gcc -c jake.c
gcc -o jake jake.o -mwindows
windres -o jakerc.o jakerc.rc
gcc -o jake jake.o jakerc.o -mwindows
一次又一次地输入它们,看看我的程序每次工作是否真的很单调。 (也请不要告诉我使用像DEV C++或Visual Studio这样的IDE,因为我不喜欢它们,因为我不喜欢它们,因为我喜欢原子。)
所以我想出了这个解决方案。我已经制作了一个名为compile.c
的额外文件,其内部看起来像这样。
#include <stdio.h>
#include <stdlib.h>
int main() {
system("C:\\Users\\hashtag\\Desktop\\rawsock\\kokul gcc -c jake.c");
system("C:\\Users\\hashtag\\Desktop\\rawsock\\kokul gcc -o jake jake.o -mwindows");
system("C:\\Users\\hashtag\\Desktop\\rawsock\\kokul windres -o jakerc.o jakerc.rc");
system("C:\\Users\\hashtag\\Desktop\\rawsock\\kokul gcc -o jake jake.o jakerc.o -mwindows");
return 0;
}
当我编译和运行这个程序我得到这个错误:
'C:\\Users\\hashtag\\Desktop\\rawsock\\kokul' is not recognized as an internal or external command,
operable program or batch file.
如何摆脱这种错误的,而且我怎么自动当我运行compile.exe
编译我的文件吗?
使用参数化的批处理文件 –
你能证明它只是为了确保? @SebastianL – turmuka
我看到了两个选择:可以创建一个'.bat'脚本文件,它为你完成所有这些。或者学习如何使用'make','nmake'或类似的工具。 –