PDA

View Full Version : Compiling Problems



Seryoga
26th March 2014, 15:48
Hey guys i am new here.
Have the following problem with compiling my code
I get after starting make sim_O following errors

Classic_observables.o: In function `main':
/home/sergej/Arbeitsfläche/Code/Classic_observables.cpp:75: undefined reference to `fftw_plan_dft_3d'
/home/sergej/Arbeitsfläche/Code/Classic_observables.cpp:76: undefined reference to `fftw_plan_dft_3d'
/home/sergej/Arbeitsfläche/Code/Classic_observables.cpp:384: undefined reference to `fftw_destroy_plan'
/home/sergej/Arbeitsfläche/Code/Classic_observables.cpp:384: undefined reference to `fftw_destroy_plan'
/home/sergej/Arbeitsfläche/Code/Classic_observables.cpp:385: undefined reference to `fftw_cleanup'
Classic_observables.o: In function `fftw_norm(fftw_plan_s*, gsl_complex*, gsl_complex*, double)':
/home/sergej/Arbeitsfläche/Code/ComplexGrid.h:32: undefined reference to `fftw_execute_dft'
ItGPE.o: In function `fftw_not_norm(fftw_plan_s*, gsl_complex*, gsl_complex*, double)':
/home/sergej/Arbeitsfläche/Code/ComplexGrid.h:48: undefined reference to `fftw_execute_dft'
collect2: ld gab 1 als Ende-Status zurück
make: *** [sim_O] Fehler 1

However i already installes fftw3 and included it into the makefile (you can look at the code) :

CC= g++
EXTROOT= /home/sergej/Downloads/hdf5-1.8.12/hdf5
EXTLIB= -L$(EXTROOT)/lib
INCLUDE= -I$(EXTROOT)/include
CFLAGS= -Wl,--no-as-needed -g -Wall -lgsl -lgslcblas -fopenmp -lfftw3 -lm -lfftw3_omp $(EXTLIB) -lhdf5
LDFLAGS= -Wl,-rpath,/home/sergej/Downloads/hdf5-1.8.12/hdf5/lib
OBJECTS_OBSER= Classic_observables.o kPropagator.o Initial.o ItGPE.o sGPE.o Noise.o BdG_QC.o Soliton.o GPE.o Observables.o
OBJECTS_FIELD= Classic_fields.o kPropagator.o Initial.o ItGPE.o sGPE.o Noise.o BdG_QC.o Soliton.o GPE.o
# Runge_Kutta.o

#Calculate observables in C/C++, don't save fields
sim_O : $(OBJECTS_OBSER)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^

#Calculate observables extern, just save fields
sim_F : $(OBJECTS_FIELD)
$(CC) $(CFLAGS) -o $@ $^

%.o : %.cpp *.h
$(CC) $(CFLAGS) $(INCLUDE) -c $<
clean :
-rm -f *.o *~

cleanall:
-rm -f *.o *~ sim_O sim_F

cleandata:
-rm -f ./data/*.*
-rm -f ./data/tmp/*.*

This shoul actually do the job
Fftw ist installed by default in my /usr/local folder

So does anybody have any suggestions ?
(i am quite new to programming so sry if my mistakes are too obviuos or something else )

ChrisW67
26th March 2014, 20:10
It would seem that /usr/local/lib (lib64, or /usr/local/fftw/lib as appropriate) is not in the linker's default library search path and you have not added it. Add it to EXTLIB with a -L option similar to the one that is already there.

BTW: this is a Qt programming forum not a general C++ programming forum.

Seryoga
26th March 2014, 21:39
hey thx for the answer i will look for it
sry i just saw a similar problem in this forum ans thought to write here
thx for your consideration though :)

Added after 1:

I just definde another EXTROOT1 and did the same as with hdf5 (and i made an Include1 as well)
it did not work
i think the compiler itself should actually look for those libs in the usr/local folder but somehow the commands seem to be undefined
very strange
so if this forum is not for c++ i wont disturb the peace any longer
does somebody know a good forum whre i can get helf for my problem
would be nice
thx for all considerations