2010-12-06 38 views
11

我是一個新手,我遇到了問題! 我必須使用C++代碼,我不知道如何導入它以及如何在eclips上編譯它(我通過命令行編譯它)。 代碼具有特殊的結構,它是這樣安排:Eclipse C++如何使用現有的makefile

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 

和第一生成文件是

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

這是生成文件對整個文庫

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"; 

編譯它沒有蝕是lib文件夾中簡單

  1. 類型/.configure
  2. 類型製造
  3. 進入應用程序文件夾
  4. 鍵入./configure
  5. 類型做出
  6. 運行程序

我的問題是....在日食??? 我導入三個導入/導入現有的代碼作爲生成文件項目,但現在我不知道如何編譯它。 你能幫我嗎?這一點很重要!

非常感謝你 加布裏埃萊

+4

+1合式併爲6人制定了一個人的問題。 (: – 2010-12-06 21:14:13

+0

@Kiril:我同意 – neuro 2010-12-07 16:31:54

回答

1

您已使用「導入現有的代碼生成文件項目」做正確的事。 現在eclipse知道它需要調用make並使用makefile。但是你的構建過程不僅由make驅動。

一個解決方案是編寫一個調用所有構建步驟的makefile。是這樣的:

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

MY2C

編輯:

我目前沒有安裝Eclipse的,所以我不能給你的相關詳細步驟...對不起

相關問題