So I've downloaded a genetic algorithm package that was written in C, and I'm calling it from some C++ code, so I need to use g++ instead of cc. However it seems that I can't use the same tags in g++ as in cc because if I try to compile using g++ I end up getting a whole bunch of "undefined reference" to the functions defined in the package.
Here is the makefile:
If I put g++ as the compiler (CC variable) it won't even compile the .c files correctly (I get the same undefined reference problems, I've also tried mpiCC (because I think its a parallel program) and I don't know the equivalen c++ compiler, but with mpiCC I still get the undefined references to those functions that I don't get if I just use cc. So I'm quite certain its a flag issue, however I thought that the flags were the same.Code:# Generated automatically from Makefile.in by configure. CC = cc PRECFLAGS = -O CPPFLAGS = -I/home/bbare/pga/include -Dlinux -DWL=32 -DFORTRANUNDERSCORE -DOPTIMIZE -DFAKE_MPI FC = f77 RM = /bin/rm -f LDFLAGS = -s -L/home/bbare/pga/lib/linux -lpgaO -lm SHELL = /bin/sh # "$@" expands to the target; "$?" expands to the dependency list CFLAGS = -o $@ $? $(PRECFLAGS) LINK.c = @echo " Compiling $@" ; $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) default: @make classic @make dejong @make example @make maxbit @make maxchar @make maxint @make name @make namefull @make udtstr ga_ee: math_utils.cpp calc_subs.cpp EM.cpp EE_utils.cpp In_out.cpp main.cpp $(LINK.c) classic: classic.c $(LINK.c) dejong: dejong.c $(LINK.c) example: example.c $(LINK.c) maxbit: maxbit.c $(LINK.c) maxchar: maxchar.c $(LINK.c) maxint: maxint.c $(LINK.c) name: name.c $(LINK.c) namefull: namefull.c $(LINK.c) udtstr: udtstr.c $(LINK.c) clean: @$(RM) classic dejong example maxbit maxchar maxint name namefull \ udtstr *.o
Thanks for the help