2013-03-28 76 views
1

我:
fileMainProgram.cpp
fileClassImplementation.cpp
fileClass.h
的makefile
问题命令提示符

目录中。
冉cmd并键入

   g++ -make -f makefile 

得到这个消息与它摆弄一段时间后(变更文件名/延伸,尝试没有-f,用gcc代替克++等)


C:\ miscprograms \收存箱\框\收存箱\ C++ \ etextbook \ E12 \ progec12 \ pe1c12romanNumeral>克++ -make -f生成文件

C:/ MinGW的/ bin中/../ LIB/GCC /的mingw32/4.6。 2 /../../../../ mingw32/bin/ld.exe:makefile.txt:文件格式未被识别;作为链接脚本处理 c:/ mingw/bin /../ lib/gcc/mingw32/4.6.2 /../../../../ mingw32/bin/ld.exe:makefile.tx t :1:语法错误 collect2:LD返回1个退出状态


这是生成文件中,(尝试删除行其间的目标和行动,使用自动变量试过,等

我试着编译程序为

         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笔记本电脑。

回答

0

你看起来有一个GNU Makefile,适合运行GNU Make。 Windows并不包含GNU Make,所以你需要自己下载它。

看来你已经下载了MingW,试试运行mingw32-make命令来执行你的makefile。

+0

我忘记了我已经将包含mingw32-make的mingw的bin文件夹添加到PATH系统变量中。 非常感谢您的回复。 – wowiamhere 2013-03-28 10:47:56