我正在尝试使用notepad ++编译和执行c代码。
以下是我用于NppExec的脚本。
NPP_SAVE
SET GCC = C:\cygwin\bin\gcc.exe
SET OBJ = $(CURRENT_DIRECTORY)\$(NAME_PART)
"$(GCC)" -c "$(FULL_CURRENT_PATH)" -o "$(OBJ).o"
"$(GCC)" "$(OBJ).o" -o "$(OBJ).exe"
"$(OBJ).exe"
UNSET OBJ
UNSET GCC
当我使用F6执行上述脚本时。我收到以下消息。
# NPP_EXEC: "C_compile_execute"
# NPP_SAVE: E:\Cprograms\test.c
# SET: GCC = C:\cygwin\bin\gcc.exe
# $(GCC) = C:\cygwin\bin\gcc.exe
# SET: OBJ = E:\Cprograms\test
# $(OBJ) = E:\Cprograms\test
# "C:\cygwin\bin\gcc.exe" -c "E:\Cprograms\test.c" -o "E:\Cprograms\test.o"
# Process started >>>
# <<< Process finished.
# "C:\cygwin\bin\gcc.exe" "E:\Cprograms\test.o" -o "E:\Cprograms\test.exe"
# Process started >>>
# gcc: E:\Cprograms\test.o: No such file or directory
# gcc: no input files
# <<< Process finished.
# "E:\Cprograms\test.exe"
# CreateProcess() failed with error code 2:
# The system cannot find the file specified.
# - the user's variable has been removed: $(OBJ)
# - the user's variable has been removed: $(GCC)
# ================ READY ================
我在弹出窗口中收到错误消息:“cc1已停止工作”
但是,我可以成功地从命令行编译和执行。
E:\Cprograms>C:\cygwin/bin/gcc.exe test.c -o test.exe
E:\Cprograms>test.exe
Hello
E:\Cprograms>
我正在使用Windows Vista。
请指导我如何解决这个问题。
答案 0 :(得分:2)
您需要保护(转义或引用)反斜杠。注意输出中是否缺少冒号(反斜杠后面的字符),这是你的提示。