繁体   English   中英

使用Makefile编译现有的C ++程序

[英]Compiling an existing C++ program using Makefile

编辑: 尚未解决 ,但是当我转向其他软件时 ,我遇到了其他挑战。

对于一个研究项目,我将用于计算机视觉的Github项目 (Tagliasacchi 等人 ,2015)下载到Linux 16.04。 我有PHP编程经验,但是对C ++不熟悉。 当我尝试在计算机上复制研究结果时 ,我很早就遇到了编译错误。

  1. Github项目的Hello world示例(应用程序»helloworld)运行良好。
  2. 当尝试编译另一个应用程序时,我在Makefile中遇到错误: cmake . 工作正常,并创建了一些文件。 但是, make不起作用。
  3. 错误发生后, g++ [filename].cpp -o main显然不起作用。

如何解决这个问题并获得正确的依赖关系?

  1. 在某些情况下,有一个Makefile,但是我遇到了一个错误:

    [ 33%] Building CXX object CMakeFiles/helloworld_atb.dir/main.cpp.o /bin/sh: 1: /usr/bin/g++-4.8: not found CMakeFiles/helloworld_atb.dir/build.make:62: recipe for target 'CMakeFiles/helloworld_atb.dir/main.cpp.o' failed make[2]: *** [CMakeFiles/helloworld_atb.dir/main.cpp.o] Error 127 CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/helloworld_atb.dir/all' failed make[1]: *** [CMakeFiles/helloworld_atb.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: *** [all] Error 2

  2. 在其他情况下(例如在跟踪器»HandFinder中),我无法运行cmake . 或使用g++ HandFinder.cpp -o handfinder make和编译g++ HandFinder.cpp -o handfinder不起作用:

    In file included from HandFinder.cpp:1:0: HandFinder.h:2:41: fatal error: tracker/ForwardDeclarations.h: No such file or directory compilation terminated.

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM