从DOS命令提示符运行MAKE实用程序的问题

时间:2013-03-28 05:30:33

标签: compilation makefile utility

我有:
            fileMainProgram.cpp
            fileClassImplementation.cpp
            fileClass.h
            生成文件

在目录中。
跑cmd并键入

              g++ -make -f makefile

在修改它一段时间后得到此消息(更改文件名/扩展名,尝试不使用-f,使用gcc而不是g ++等)


C:\ miscprograms \ Dropbox \ box \ Dropbox \ c ++ \ etextbook \ e12 \ progec12 \ pe1c12romanNumeral> g ++ -make -f makefile

C:/ MinGW的/ bin中/../ LIB / GCC /的mingw32 / 4.6.2 /../../../../的mingw32 / bin中/ ld.exe:makefile.tx t:文件格式无法识别;作为链接描述文件处理 C:/ MinGW的/ bin中/../ LIB / GCC /的mingw32 / 4.6.2 /../../../../的mingw32 / bin中/ ld.exe:makefile.tx t:1:语法错误 collect2:ld返回1退出状态


这是makefile,(试图删除目标和动作之间的行,尝试使用自动变量等,

我尝试将程序编译为

                                      g++ -c fileClassImplementation.cpp

                           then

                                      g++ fileClassImplementation.o fileMain.cpp

获取可执行文件并且工作正常。


 all: a

 a: romanNumeralMain.o romanNumeralImp.o
 [1 tab]g++ romanNumeralMain.o romanNumeralImp.o -o a

 romanNumeralMain.o: romanNumeralMain.cpp 
        g++ -c romanNumeralMain.cpp

 romanNumeralImp.o: romanNumeralImp.cpp
        g++ -c romanNumeralImp.cpp

 clean:
        rm romanNumeralImp.o romanNumeralMain.o a

将我的三星手机全部放在C4droid上并按原样正常工作 不适用于我的Windows7笔记本电脑。

1 个答案:

答案 0 :(得分:0)

你看起来有一个GNU Makefile,适合运行GNU Make。 Windows并不附带GNU Make,因此您需要自己下载。

您似乎已经下载了MingW,请尝试运行mingw32-make命令来执行您的makefile。