首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在cmd中运行项目?(Windows 7)

如何在cmd中运行项目?(Windows 7)
EN

Stack Overflow用户
提问于 2011-12-09 01:41:00
回答 1查看 1.2K关注 0票数 0

我有一个项目,它有一个makefile:

代码语言:javascript
复制
# 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 $@ -c $<
%.o:%.cpp
    $(CC) $(CPPFLAGS) -o $@ -c $<
# $@-target, $<-source

DNAME=f3dProjBasicNoComp12
PROGRAM=project

PROJ_OBJECTS= project.o f3d.o f3dGridLite.o

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

project:$(PROJ_OBJECTS)
    $(CC) $(LDFLAGS) -o $@ $(PROJ_OBJECTS) $(LIBS)

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

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

我已经安装了cygwin和mingw,但我无法编译make文件或运行项目:(我总是收到错误: first:

代码语言:javascript
复制
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的项目,但我不知道如何处理它>(请帮助我

谢谢

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-12-09 02:56:02

Make必须像this一样使用

代码语言:javascript
复制
make [ -f makefile ] [ options ] ... [ targets ] ...

-B总是用来构建

代码语言:javascript
复制
-B, --always-make
    Unconditionally make all targets.

所以当你输入:

代码语言:javascript
复制
mingw32-make.exe -B C:\Users\Bladeszasza\Documents\vvd\f3dProjBasicNoComp12\Makefile

目标文件您不需要指定makefile,因为没有-f

  • you。只有一个选项:-B

  • and C:\Users\Bladeszasza\Documents\vvd\f3dProjBasicNoComp12\Makefile is

相反,您需要做的是:

代码语言:javascript
复制
mingw32-make.exe -f C:\Users\Bladeszasza\Documents\vvd\f3dProjBasicNoComp12\Makefile -B all
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8435217

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档