仅在使用makefile时出现gcc错误(CreateProcess:没有这样的文件或目录)

时间:2013-04-09 17:37:06

标签: gcc makefile createprocess gsl

我在使用gcc和gsl库在Windows 7中使用make进行编译时遇到了问题。它仅在使用make时发生(当我手动将编译命令键入cmd行时,它会正确编译)。我找到了一些帖子,其中人们有来自gcc的类似错误,但没有一个在正常打字时它起作用,但在使用make时没有。我的Makefile的内容如下所示:

#Compiler
COMP=gcc
# Compiler Flags.  -Wall turns on all warnings
FLAGS=-Wall
# GSL include file dir
INCLUDES=GnuWin32/include
# GSL Libraries directory
LIB=GnuWin32/lib
# Library Flags
LFLAGS=-lgsl -lgslcblas -lm
# Target Program
EXE=ex2.1.exe
# Dependencies needed for $(PROGRAM)
OBJ=ex2.1.o
# List of source files for objects
SRC=ex2.1.c
# List with types of files to be cleared by clean:
TRASH=*.exe *.o
# I/O files to be cleaned with 'very clean' target
#IOFILES= *.dat *.out *.csv *.mod

all: $(SRC) $(EXE)

$(EXE): $(OBJ)
    $(COMP) -L/$(LIB) $(OBJ) $(LFLAGS) -o $(EXE)

$(OBJ): $(SRC)
    $(COMP) -I/GnuWin32/include -c ex2.1.c
    #$(COMP) -I/$(INCLUDES) -c $(SRC)

clean:
    del $(TRASH)

如果我只用目录中的ex2.1.c键入make,我会得到以下输出和错误:

gcc -I/GnuWin32/include -c ex2.1.c
gcc: error: CreateProcess : No such file or directory
make: *** [ex2.1.o] Error 1

但是,如果我首先输入“gcc -I / GnuWiun32 / include -c ex2.1.c”,则成功创建ex2.1.o且没有错误。如果然后键入'make',我会得到以下输出/错误:

gcc -L/GnuWin32/lib ex2.1.o -lgsl -lgslcblas -lm -o ex2.1.exe
gcc: fatal error: -fuse-linker-plugin, but liblto_plugin-0.dll not found
compilation terminated
make: *** [ex2.1.exe] Error 1

但是,如果我手动输入“gcc -L / GnuWin32 / lib ex2.1.o -lgsl -lgslcblas -lm -o ex2.1.exe”,那么可执行文件会编译并运行它应该如此,所以问题似乎是请问make是如何调用gcc的?我的PATH变量包含make.exe和gcc.exe的路径,所以我不确定我没有正确设置。有谁知道可能出错了什么?感谢。

0 个答案:

没有答案