Hi,

I am not a C programmer, but have been given some code to get compiled and use.

We host our server with 1&1 and I can access the machine via SSH/Telnet, but when I come to run the make file, I get the following error:

> make
g++ -DGNU_CONSTRUCTOR_BUG -I/usr/include/ -I/usr/include/g++-2/ -I. -DPDEBUG_ENABLED -O -L/usr/X11R6/lib -L../lib -g main.o displ.o nprcs.o nmatrix.o procs.o nvect.o nfiles.o -lm -lX11 -lainn -o ainn
main.o: In function `main':
main.o(.text+0xf9): undefined reference to `dconv(void)'
main.o(.text+0x17a): undefined reference to `calc_(int, char **, char *, char *)'
collect2: ld returned 1 exit status
make: *** [ainn] Error 1

The OS Type is linux-gnu

But I tried the same files and makefile on my Red Hat 9 OS Box and it all compiled instantly!

Is there any reason for C code to compile on one machine but not the other? Any help would or pointers would great!

Thanks

Daniel

The makefile is below:

CC = g++ -DGNU_CONSTRUCTOR_BUG
OLDC = gcc
INCLUDE = -I/usr/include/ -I/usr/include/g++-3/
LFLAGS = -L/usr/X11R6/lib -L../lib
SYS_LIBS =
BINPATH = ../bin
MOVE = mv
COPY = cp
LIBS = $(SYS_LIBS) -lm -lX11 -lainn
DB = -O
CFLAGS = $(INCLUDE) $(DEFS) $(DB) $(PROF) $(SYS_CFLAGS) $(LFLAGS)
DEFS = -I. -DPDEBUG_ENABLED
DFLAGS = -wt
PROGS = ainn
SRCS = main.cc displ.cc nprcs.cc nmatrix.cc procs.cc nvect.cc nfiles.cc

DEPEND_SRC = $(SRCS)
HEADERS = ff.h trn.h ut.h uttypes.h ui.h global.h xwin.h defines.h
OBJS = main.o displ.o nprcs.o nmatrix.o procs.o nvect.o nfiles.o
DEPEND_OBJ = $(OBJS)
$(PROGS): $(OBJS)
$(CC) $(CFLAGS) -g $(OBJS) $(LIBS) -o $(PROGS)
$(MOVE) $(PROGS) $(BINPATH)
$(COPY) ../lib/llib2rdmcsh $(BINPATH)
$(COPY) ../lib/llib2dset1 $(BINPATH)
$(COPY) ../lib/llib2rdmxlzhx $(BINPATH)
$(COPY) ../lib/llibjianmo0 $(BINPATH)
$(COPY) ../lib/llibdconv $(BINPATH)
$(COPY) ../lib/llib2virtreg $(BINPATH)
depend:
-DEPEND_SRC=`echo $(DEPEND_OBJ:.o=.cc) $(DEPEND_OBJ:.o=.cpp) `; \
touch ./dependencies.tmp; \
makedepend -f ./dependencies.tmp $(DEPEND_SRC) 2>&-
sort < ./dependencies.tmp > ./dependencies
-rm ./dependencies.tmp*
dependencies:
clean:
-rm -f $(PROGS) *.o *~ *.bak dependencies
include dependencies
# DO NOT DELETE

Hello,

I am not a big-gun programmer, but I think that you may be lacking some C++ libraries or have to make tweaks to the makefile before you can have a successful compile. It is possible that the libraries exist, but the directory paths are wrong. Or different C compilers entirely.

This is why a lot of C++ programs on the net come with a ./configure script that goes through and makes a Makefile on-the-fly so that the various includes are properly accounted for.

Christian

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.