2011-02-28 66 views
0

我正在尝试使用notepad ++编译并执行c代码。cc1已停止工作[编译并在记事本++中执行]

下面是我用于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。

请指导我如何解决这个问题。

回答

2

您需要保护(转义或引用)反斜杠。注意输出中冒号(反斜杠后面的字符)缺失,这就是你的提示。