2011-12-08 58 views
0

我其中有一個生成文件項目:如何從cmd運行項目? (Windows 7)中

# a simple makefile 

# Uncomment, if compression support is desired 
#DCOMP=-DWITH_COMPRESSION 
#ZLIB=-lz 

#Compiler 
CC=g++ 
# compiler switches 
#CPPFLAGS=-g -I. 
CPPFLAGS=-O -I. 
CFLAGS=-O -I. $(DCOMP) 

#LDFLAGS=-L/usr/local/lib 
#libraries 
LIBS= -lm $(ZLIB) 

# Compilation rules 
# target:source 
%.o:%.c 
    $(CC) $(CFLAGS) -o [email protected] -c $< 
%.o:%.cpp 
    $(CC) $(CPPFLAGS) -o [email protected] -c $< 
# [email protected], $<-source 

DNAME=f3dProjBasicNoComp12 
PROGRAM=project 

PROJ_OBJECTS= project.o f3d.o f3dGridLite.o 

#the first (default) 
all:$(PROGRAM) 

project:$(PROJ_OBJECTS) 
    $(CC) $(LDFLAGS) -o [email protected] $(PROJ_OBJECTS) $(LIBS) 

clean: 
    rm -f $(PROGRAM) *.o core* *.ppm 

pack: 
    make clean 
    (cd .. && tar cvzf $(DNAME).tgz $(DNAME)) 

我已經安裝了cygwin的和MinGW,但我不能編譯make文件或運行項目:(我總是得到錯誤: 第一:

C:\Users\Bladeszasza>C:\MinGW\bin\mingw32-make.exe -B C:\Users\Bladeszasza\Docu 
ments\vvd\f3dProjBasicNoComp12\Makefile 
mingw32-make: Nothing to be done for `C:\Users\Bladeszasza\Documents\vvd\f3dProj 
BasicNoComp12\Makefile'. 


C:\Users\Bladeszasza>C:\MinGW\bin\mingw32-make.exe -B C:\Users\Bladeszasza\Docu 
    ments\vvd\f3dProjBasicNoComp12\Makefile 
C;\MinGW\bin\mingw32-make: invalid option --z 
Usage : mingw32-make [option] [target] ... 
Options: 

所以我需要運行被稱爲project.cpp 該項目,但我不知道怎麼用它做什麼>( 請幫我

感謝

+0

用法錯誤是從make&不是從你的項目。 – jman

+0

我明白,但爲什麼?我已經發布了整個makefile我沒有得到它:( – Csabi

+0

你在哪裏發佈了Makefile? – jman

回答

1

製作必須使用像this

mingw32-make.exe -B C:\Users\Bladeszasza\Documents\vvd\f3dProjBasicNoComp12\Makefile 
  • 你不指定:

    make [ -f makefile ] [ options ] ... [ targets ] ... 
    

    -B當你輸入總是用來建立

    -B, --always-make 
        Unconditionally make all targets. 
    

    所以一個makefile,因爲有n o -f

  • 你有一個選擇:-B
  • C:\Users\Bladeszasza\Documents\vvd\f3dProjBasicNoComp12\Makefile是目標。

你需要做的,而不是什麼是這樣的:

你看到
mingw32-make.exe -f C:\Users\Bladeszasza\Documents\vvd\f3dProjBasicNoComp12\Makefile -B all