简体   繁体   English

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

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

I'm a newbie and I've a problem! 我是新手,我有一个问题! I've to work with a c++ code and I don't know how to import it and how to compile it on eclips ( I compiled it by command line). 我将使用c ++代码,我不知道如何导入它以及如何在eclips上编译它(我通过命令行编译它)。 The code has a particular structure and it is organized in this way: 代码具有特定的结构,并以这种方式组织:

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)

to be sure that you understand my problem...(sure... :) ) 确保你理解我的问题......(当然...... :))

the first configure file is: 第一个配置文件是:

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

and the first makefile is 第一个makefile是

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

this is the makefile for the whole library 这是整个库的makefile

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

an example of configure file (the one inside lib1): 配置文件的示例(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";

compile it without eclipse is simple 在没有eclipse的情况下编译它很简单

  1. type /.configure in the lib folder 在lib文件夹中键入/.configure
  2. type make 打字
  3. go into the application folder 进入应用程序文件夹
  4. type ./configure 输入./configure
  5. type make 打字
  6. run the program 运行程序

my question is....in eclipse??? 我的问题是......在日食中??? I imported the three with import/ import existing code as makefile project but now I don't know how compile it. 我导入了三个导入/导入现有代码作为makefile项目,但现在我不知道如何编译它。 could you please help me? 请你帮助我好吗? it's important! 这一点很重要!

thank you very much gabriele 非常感谢gabriele

You have done the right thing by using "import existing code as makefile project". 通过使用“将现有代码导入为makefile项目”,您已经做了正确的事情。 Now eclipse know that it needs to call make and use your makefile. 现在eclipse知道它需要调用make并使用你的makefile。 But Your build process is not only driven by make. 但是你的构建过程不仅仅是由make驱动的。

One solution is to write a makefile that call all your build steps. 一种解决方案是编写一个调用所有构建步骤的makefile。 Something Like : 就像是 :

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

my2c MY2C

Edit: 编辑:

I currently have no eclipse installed, so I can not send you detailled steps ... sorry 我目前没有安装eclipse,所以我无法向你发送详细的步骤......对不起

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

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