繁体   English   中英

Eclipse c ++如何使用现有的makefile

[英]Eclipse c++ How to work with existing makefile

我是新手,我有一个问题! 我将使用c ++代码,我不知道如何导入它以及如何在eclips上编译它(我通过命令行编译它)。 代码具有特定的结构,并以这种方式组织:

repos____lib____configure (execute the configure file inside the libraries folders)
                  I           I___makefile (execute the make file inside the libraries folders,
                                                        requires make/make.def)
      I           I___ib1____.cpp
      I           I            I____.h
      I           ...          I____configure (it requires make/configure_lib and
                                                              make/configure_includes
      I           ...          I____makefile (generated by configure)
      I           I___lib2___....
      i           I___.......
      I           I___libn____.cpp
      i                        I____.h
      i                        I____configure
      i                        I____makefile (generated by configure)
      I
      I___make(folder)__bashrc (are set the some environment variables)
      I                               I__configure_bin
      I                               I__configure_includes
      I                               I__configure_lib
      I                               I__make.def (are set all the include path and library path used
      I                                                         in the configure file)
      I___application__main.cpp
                                   I__configure
                                   I__makefile(generated by the configure file)

确保你理解我的问题......(当然...... :))

第一个配置文件是:

cd lib1; ./configure
cd ../lib2; ./configure
.....
....
cd ../libn; ./configure
cd

第一个makefile是

include /media/Dati/WORKHOME/repos/make/make.def

这是整个库的makefile

lib:
    make -C lib1
    make -C lib2
    make -C libn

配置文件的示例(lib1中的一个):

   #!/usr/bin/perl

$INC = '$(OPENCVINC) $(FLTKINC) $(DC1394V2INC)';  ##<-DEFINED IN /make.def
$LIB = '$(OPENCVLIB) $(FLTKLIB) $(DC1394V2LIB)';      #####################

#-------------------------------------------------------------------------------

require '/media/Dati/WORKHOME/repos/make/configure_lib';
print "Created Makefile.\n";

# this will create a include file for the whole directory, 
# using the template <dirname>.h.templ
require '/media/Dati/WORKHOME/repos/make/configure_includes';
print "Created $libname.h\n";

在没有eclipse的情况下编译它很简单

  1. 在lib文件夹中键入/.configure
  2. 打字
  3. 进入应用程序文件夹
  4. 输入./configure
  5. 打字
  6. 运行程序

我的问题是......在日食中??? 我导入了三个导入/导入现有代码作为makefile项目,但现在我不知道如何编译它。 请你帮助我好吗? 这一点很重要!

非常感谢gabriele

通过使用“将现有代码导入为makefile项目”,您已经做了正确的事情。 现在eclipse知道它需要调用make并使用你的makefile。 但是你的构建过程不仅仅是由make驱动的。

一种解决方案是编写一个调用所有构建步骤的makefile。 就像是 :

all:
    cd dir1 && ./configure && make
    cd dir2 && ./configure && make 
    etc.

MY2C

编辑:

我目前没有安装eclipse,所以我无法向你发送详细的步骤......对不起

暂无
暂无

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

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