我有一个目录,它下面像这样4个子目录一个makefile:如何创建几个子目录
myDir:
myDir/Part1
myDir/Part2
myDir/Part3
myDir/shared
我想打一个可执行文件,从共享文件的需要,它链接到文件的第2部分并将可执行文件放入myDir中。
这是我尝试(在makefile是相关仅行):在Makefile
Part2/part2code.o: ../Shared/helper.o
gcc -ansi -pedantic-errors -c -Wall -Werror -g -o Part2/part2code.o Part2/part2code.c
,并在它上面:在makefile
Shared/helper.o:
gcc -ansi -pedantic-errors -c -Wall -Werror -g -o Shared/helper.o Shared/helper.c
,并在其上方
part2code: Part2/part2code.o ../Shared/helper.o
gcc -ansi -pedantic-errors -Wall -Werror -g -lm -o part2code Part2/part2code.o ../Shared/helper.o
(I也尝试不../共享之前)
我得到这个错误:
No such file or directory.
帮助?
谢谢!
我相信海报说他没有../就尝试过。 – 2011-04-24 13:35:29
@Konstantin:的确他/她做到了。但有了这些信息,它肯定没有。 – 2011-04-24 14:09:26