I am currently trying to cross-compile a c++ code I wrote which worked perfectly fine on Linux.
I installed mingw32, and compiled libgmp as a windows library ( .a ) using something like that :
./configure --prefix=/usr/i586-mingw32msvc/ --host=i586-mingw32msvc
Hope I did it right
I added two directories to my project incs and libs. In incs I put the .h header ( gmpxx.h ) and in libs I put libgmpxx.a and libgmp.a
I tried to compile using this makefile :
CPP=i586-mingw32msvc-g++
CPPSPECS=
LDFLAGS=-I incs/ libs/
EXEC=ceyd++.exe
all: $(EXEC)
$(EXEC): base64.o polynome.o chiffre.o dechiffre.o ceyd.o
$(CPP) -o $@ $^ $(LDFLAGS)
%.o: %.cpp
$(CPP) -o $@ -c $< $(CPPWARNINGS) $(CPPSPECS)
clean:
rm -rf *.o
mrproper: clean
rm -rf $(EXEC)
I removed the warning part as it is not usefull here.
When i run make, it tells me that no gmpxx.h as been found....
Does anybody have a solution? Tried hard on this one ...
Your compile directive should point to the header directory 'incs' which it is not:
$(CPP) -o $@ -c $< $(CPPWARNINGS) $(CPPSPECS)
Create a variable as follows:
CCFLAGS=-Iincs/
and modify your compile directive:
$(CPP) -o $@ -c $< $(CPPWARNINGS) $(CPPSPECS) $(CCFLAGS)
Furthermore your LDFLAGS variable should look like:
LDFLAGS=-Llibs/ -l...
Where ... indicates the name of the shared library you're linking with in libs/. If you only have a static library (.a) add this to your linking directive.