簡體   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