Eclipse c ++如何使用现有的makefile [英] Eclipse c++ How to work with existing makefile

查看:337
本文介绍了Eclipse c ++如何使用现有的makefile的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

  repos ____ lib____configure库文件夹)
I I___makefile(在库文件夹中执行make文件,
需要make / make.def)
I I ___ ib1 ____。cpp
II I ____。h
I ...配置(它需要make / configure_lib和
make / configure_includes
I ... I____makefile(由configure生成)
I I ___ lib2 ___,
i I___ .. .....
I I ___ libn ____。cpp
i I ____。h
i I____configure
i I____makefile(由configure生成)
I
I ___ make(文件夹)__ bashrc设置一些环境变量)
I I__configure_bin
I I__configure_includes
I Iconfigure_lib
I I__make.def(设置所有包含路径和库路径
I配置文件)
I ___ application__main.cpp
I__configure
I__makefile(由配置文件生成)

确保您了解我的问题...(确定... :))



第一个配置文件是:

  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';
printCreated Makefile.\\\
;

#这将为整个目录创建一个包含文件,
#使用模板< dirname> .h.templ
require'/ media / Dati / WORKHOME / / make / configure_includes';
print创建$ libname.h\\\
;

无eclipse编译简单



<
  • 在lib文件夹中键入/.configure

  • 输入make

  • 进入应用程序文件夹

  • 键入./configure

  • 键入make

  • 运行程序

  • 我的问题是....在eclipse ???
    我导入三个导入/导入现有代码作为makefile项目,但现在我不知道如何编译它。
    你能帮我吗?非常重要!



    非常感谢
    gabriele

    解决方案

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



    一个解决方案是编写一个调用所有构建步骤的makefile。类似的东西:

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

    my2c



    编辑:



    我目前没有安装eclipse,因此我无法向您发送detailled步骤...对不起


    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). 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

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

    this is the makefile for the whole library

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

    an example of configure file (the one inside 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

    1. type /.configure in the lib folder
    2. type make
    3. go into the application folder
    4. type ./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. could you please help me? it's important!

    thank you very much gabriele

    解决方案

    You have done the right thing by using "import existing code as makefile project". Now eclipse know that it needs to call make and use your makefile. But Your build process is not only driven by make.

    One solution is to write a makefile that call all your build steps. Something Like :

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

    my2c

    Edit:

    I currently have no eclipse installed, so I can not send you detailled steps ... sorry

    这篇关于Eclipse c ++如何使用现有的makefile的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆