I am having some difficulties compiling some files that I downloaded (for academic purposes). I ran the following command :
cd tmp/Detri_2.6.a/detri
then make detri_new CC=gcc To build a library from the relevant files and folders extracted to /tmp.
The output is as follows:
tmp/Detri_2.6.a/detri$ make detri_new CC=gcc
g++ Makefile.cpp -o Makefile
Makefile.cpp:16:25: error: expected unqualified-id before ‘-’ token
Makefile.cpp:16:38: error: expected unqualified-id before ‘-’ token
Makefile.cpp:17:1: error: ‘LIBS’ does not name a type
Makefile.cpp:20:1: error: ‘MODULES’ does not name a type
[..]
Makefile.cpp:65:73: error: expected unqualified-id before ‘-’ token
Makefile.cpp:68:1: error: expected unqualified-id before ‘.’ token
Makefile.cpp:68:19: error: ‘$’ does not name a type
Makefile.cpp:68:60: error: expected unqualified-id before ‘-’ token
Makefile.cpp:71:10: error: ‘$’ does not name a type
Makefile.cpp:71:20: error: expected unqualified-id before ‘-’ token
Makefile.cpp:71:31: error: expected unqualified-id before ‘--’ token
Makefile.cpp:71:43: error: ‘$’ does not name a type
make: *** [Makefile] Error 1
>
I haven't written the makefile.cpp (please bear in mind this is my first week of using ubuntu and doing this sort of thing) but previously, the compiler would attempt to build and find an error in the makefile.tmp, not in the .cpp file. Now as the output shows, it isn't going past the point of trying to read the .cpp file.
I am a bit lost here...
Thank you
UPDATE: I have tried what was suggested in the comment below, i.e. running : make -k TMPMK=Makefile.tmp detri_new CC=gcc
Yet I still have the same (window full of) output errors, plus some new ones.
If this is of any help, the code was obtained from the following website
EDIT: Shortened error output section and clearer explanation of the problem.
Here is the makefile :
/* detri/Makefile.cpp --- C pre-processor Makefile for detri. */
/* USAGE: cpp -P ${CPPMK} > ${TMPMK}; make -k TMPMK=${TMPMK} -f ${TMPMK} ... */
/* Targets. (CHANGE THIS ACCORDING TO YOUR NEEDS!) */
DEST= ../bin
LIB= ../lib
INCLUDE= ../include
/* Paramters: DEPEND, SHELL, CC, CPP, CPPMK, TMPMK, COPT. */
/* System specifics: CCFLAGS, AR, RANLIB, MALLOC. */
#include "Makefile.sys"
/* Other libraries. */
INCLS= -I${INCLUDE}
LIBRARIES= -l_sos${DBX} -l_lia${DBX} -l_basic${DBX}
LIBS= -L${LIB}
/* Source and object files. */
MODULES= detri.c delaunay.c flip.c prep.c \
dt.c print_dt.c search.c trist.c peel.c
H_FILES= detri.h dt.h trist.h
OBJECTS= ${MODULES:.c=.o}
/* Interface. */
normal: detri; @echo "Detri ready."
debug: ; ${MAKE} -k -f ${TMPMK} detri COPT="-D__DEBUG__" DBX=-g
remove: ; rm -f ${OBJECTS}
all: normal;
/* BEGIN Meta Interface: make detri_new */
/* Note: This is here so that we can package Detri stand-alone,
without the alpha shape software and it's top-level Makefile. */
BASIC= ../basic
LIA= ../lia
SOS= ../sos
DETRI= ./
HD=echo "\n\n*** X ***\n"
MK= ${MAKE} -k CC="${CC}" CPP="${CPP}" COPT="${COPT}"
detri_new:; ${MK} check soslibs_ detri_
detri_debug:; ${MK} check soslibs_d detri_d
detri_all:; ${MK} check soslibs_d soslibs_ detri_
soslibs_: basic_ lia_ sos_
detri_:; @/bin/csh -cf '${HD:X=Detri}; cd ${DETRI}; ${MK} new'
sos_:; @/bin/csh -cf '${HD:X=SoS}; cd ${SOS}; ${MK} new'
lia_:; @/bin/csh -cf '${HD:X=Lia}; cd ${LIA}; ${MK} new'
basic_:; @/bin/csh -cf '${HD:X=Basic}; cd ${BASIC}; ${MK} new'
soslibs_d: basic_d lia_d sos_d
detri_d:; @/bin/csh -cf '${HD:X=Detri}; cd ${DETRI}; ${MK} clear debug'
sos_d:; @/bin/csh -cf '${HD:X=SoS}; cd ${SOS}; ${MK} clear debug'
lia_d:; @/bin/csh -cf '${HD:X=Lia}; cd ${LIA}; ${MK} clear debug'
basic_d:; @/bin/csh -cf '${HD:X=Basic}; cd ${BASIC}; ${MK} clear debug'
check:; @/bin/csh -cf ' \
echo Checking for target dirs; \
if (! -e ${DEST}) mkdir ${DEST}; \
if (! -e ${LIB}) mkdir ${LIB}; \
if (! -e ${INCLUDE}) mkdir ${INCLUDE} \
'
/* Internal rules. */
detri: ${OBJECTS}; ${CC} ${CCFLAGS} ${DBX} ${COPT} ${OBJECTS} \
-o ${DEST}/detri ${LIBS} ${LIBRARIES} ${MALLOC} -lm;
/* Generic rule to compile source files. */
.c.o: ${H_FILES}; ${CC} ${CCFLAGS} ${DBX} ${COPT} ${INCLS} -c $*.c -o $*.o
/* To compute dependencies with "make depend" ... */
depend:; ${DEPEND} -f${TMPMK} -- ${INCLS} ${MODULES}
Makefile.cpp
to sth. else, anything not .cpp, .cc, .c or .h would work, as make is trying to compile Makefile.cpp, which is apparently not a C++ file.cpp -p
command and the various extensions (h,c and cc) and running themake -k TMPMK=Makefile.tmp detri_new CC=gcc
All in all, I am back to square one.