2013-02-26 2 views
0

FFTW3 구현으로 C++ 프로그램을 컴파일하려고 할 때마다 매우 이상한 오류가 발생합니다. 나는 또한C++ FFTW3 연결 오류

#include <math.h> #include "fftw3.h" 

를 다음과 같이 내 헤더 파일을 포함

g ++ -03 -lm -lfftw3 myFile.cpp -o myFileFFTW

다음과 같이

나는 컴파일하고 오류는 다음과 같습니다.

(.text + 0x63) : 'fftw_malloc'에 대한 정의되지 않은 참조

어떤 제안 사항이 있습니까?

편집 :

hmjd에 의해 제안은 나를 위해 일한

. Linker errors when compiling against glib...?

나는 곧은 3 일 동안 그렇지 않으면 마음이 작동하지 않는다고 생각한다! 감사합니다. hmjd !! 당신은 내 하루를 구했고 제 시간에 제 프로젝트를 끝낼 수있었습니다 !!

+1

라이브러리 :'g ++ -O3 myFile.cpp - o myFileFFTW -lm -lfftw3 '참조 http://stackoverflow.com/questions/9966959/linker-errors-when-compiling-against-glib/9966989#9966989 – hmjd

+0

예. 그것은 일했다!! 고맙습니다. !!!! – VishalYadav

+0

이 내용을 읽었지만 해결책이 무엇인지 이해하지 못했던 사람은 hmjd가 보여 주지만 설명하지 않았 듯이 링커 플래그를 컴파일 명령의 끝에 넣어야합니다. – user3728501

답변

0

시스템에 -lfftw3이 없으며 libs를 올바르게 지정하지 않은 것 같습니다. 컴파일러 명령의 끝에

라이브러리 :

는 GCC -I는/usr/포함/입심 - 2.0 -I는/usr/lib 디렉토리/x86_64에-리눅스 GNU/입심-2.0 /은 re.c을 포함 - 오 -lglib - 2.0 다시 GCC 링크 옵션에서

:

-llibrary -l 라이브러리 을 링크 할 때 라이브러리라는 라이브러리를 검색합니다. 마지막에 (. 별도의 인수 은 POSIX 호환을위한 권장되지 않는 라이브러리와 두 번째 대안)

It makes a difference where in the command you write this option; 
the linker searches and processes libraries and object files in the 
order they are specified. 
Thus, `foo.o -lz bar.o' searches library `z' after file foo.o but 
before bar.o. If bar.o refers to functions in `z', those functions 
may not be loaded. 

snnippet에서 Linker errors when compiling against glib...?