Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] compiler error - undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] compiler error - undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'


Chronological Thread 
  • From: Ramin H <>
  • To:
  • Subject: Re: [cgal-discuss] compiler error - undefined reference to `CGAL::assertion_fail(char const*, char const*, int, char const*)'
  • Date: Fri, 4 Dec 2009 08:43:35 -0500
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=TJe6Je7aIKCksaZPgchiVE6k8Beu0Sg/sVRtANRwLrX8Gv+i64c+kOegNuNoZ9UXc9 +f5NHGz1N5kcsxJ1uOzFlblrWjdTwiKqtb2OzaPX3dfBnevJA1Bx3TdZc2PxRNginktV kgF4jBCULC6ohUD4HOewZdHKaOr/FhPMGyh9U=

Matthew,
Thank you for your help. I also followed this thread
(https://lists-sop.inria.fr/sympa/arc/cgal-discuss/2009-06/msg00014.html)
where you asked a similar question.

I have compiled CGAL3.5 myself. (Ubuntu does not have a binary for
this version and I need the latest version for some features).
Location of CGAL is in my home directory /home/ramin/CGAL-3.5

This is how the .pro file looks like:
---- begin: nef.pro ----
SOURCES = main.cpp
QT += opengl
QT += xml
INCLUDEPATH += "/usr/include"
INCLUDEPATH += "/home/ramin/CGAL-3.5/include"
LIBS += -L"/usr/lib"
LIBS += -L"/home/ramin/CGAL-3.5/lib"
---- end: nef.pro

And qmake generates the following Makefile where I added
"-frounding-math" manually.

I am still getting the same error. Am I adding the flag correctly? Any
help is appreciated.
Thank you.
-Ramin

---- begin: Makefile ----
###########################################################
# Makefile for building: nef
# Generated by qmake (2.01a) (Qt 4.5.2) on: Thu Dec 3 17:54:41 2009
# Project: nef.pro
# Template: app
# Command: /usr/bin/qmake -unix -o Makefile nef.pro
###########################################################

####### Compiler, tools and options

CC = gcc
CXX = g++
DEFINES = -DQT_NO_DEBUG -DQT_XML_LIB -DQT_OPENGL_LIB
-DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED
CFLAGS = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES)
CXXFLAGS = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES) -frounding-math
INCPATH = -I/usr/share/qt4/mkspecs/linux-g++ -I.
-I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui
-I/usr/include/qt4/QtOpenGL -I/usr/include/qt4/QtXml
-I/usr/include/qt4 -I/usr/include -I../../CGAL-3.5/include
-I/usr/X11R6/include -I.
LINK = g++
LFLAGS = -Wl,-O1
LIBS = $(SUBLIBS) -L/usr/lib -L/usr/X11R6/lib -L/usr/lib
-L/home/ramin/CGAL-3.5/lib -lQtXml -lQtOpenGL -lQtGui -lQtCore -lGLU
-lGL -lpthread
AR = ar cqs
RANLIB =
QMAKE = /usr/bin/qmake
TAR = tar -cf
COMPRESS = gzip -9f
COPY = cp -f
SED = sed
COPY_FILE = $(COPY)
COPY_DIR = $(COPY) -r
INSTALL_FILE = install -m 644 -p
INSTALL_DIR = $(COPY_DIR)
INSTALL_PROGRAM = install -m 755 -p
DEL_FILE = rm -f
SYMLINK = ln -sf
DEL_DIR = rmdir
MOVE = mv -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p

####### Output directory

OBJECTS_DIR = ./

####### Files

SOURCES = main.cpp
OBJECTS = main.o
DIST = /usr/share/qt4/mkspecs/common/g++.conf \
/usr/share/qt4/mkspecs/common/unix.conf \
/usr/share/qt4/mkspecs/common/linux.conf \
/usr/share/qt4/mkspecs/qconfig.pri \
/usr/share/qt4/mkspecs/features/qt_functions.prf \
/usr/share/qt4/mkspecs/features/qt_config.prf \
/usr/share/qt4/mkspecs/features/exclusive_builds.prf \
/usr/share/qt4/mkspecs/features/default_pre.prf \
/usr/share/qt4/mkspecs/features/release.prf \
/usr/share/qt4/mkspecs/features/default_post.prf \
/usr/share/qt4/mkspecs/features/warn_on.prf \
/usr/share/qt4/mkspecs/features/qt.prf \
/usr/share/qt4/mkspecs/features/unix/opengl.prf \
/usr/share/qt4/mkspecs/features/unix/thread.prf \
/usr/share/qt4/mkspecs/features/moc.prf \
/usr/share/qt4/mkspecs/features/resources.prf \
/usr/share/qt4/mkspecs/features/uic.prf \
/usr/share/qt4/mkspecs/features/yacc.prf \
/usr/share/qt4/mkspecs/features/lex.prf \
/usr/share/qt4/mkspecs/features/include_source_dir.prf \
nef.pro
QMAKE_TARGET = nef
DESTDIR =
TARGET = nef

first: all
####### Implicit rules

.SUFFIXES: .o .c .cpp .cc .cxx .C

.cpp.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"

.cc.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"

.cxx.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"

.C.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"

.c.o:
$(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"

####### Build rules

all: Makefile $(TARGET)

$(TARGET): $(OBJECTS)
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)

Makefile: nef.pro /usr/share/qt4/mkspecs/linux-g++/qmake.conf
/usr/share/qt4/mkspecs/common/g++.conf \
/usr/share/qt4/mkspecs/common/unix.conf \
/usr/share/qt4/mkspecs/common/linux.conf \
/usr/share/qt4/mkspecs/qconfig.pri \
/usr/share/qt4/mkspecs/features/qt_functions.prf \
/usr/share/qt4/mkspecs/features/qt_config.prf \
/usr/share/qt4/mkspecs/features/exclusive_builds.prf \
/usr/share/qt4/mkspecs/features/default_pre.prf \
/usr/share/qt4/mkspecs/features/release.prf \
/usr/share/qt4/mkspecs/features/default_post.prf \
/usr/share/qt4/mkspecs/features/warn_on.prf \
/usr/share/qt4/mkspecs/features/qt.prf \
/usr/share/qt4/mkspecs/features/unix/opengl.prf \
/usr/share/qt4/mkspecs/features/unix/thread.prf \
/usr/share/qt4/mkspecs/features/moc.prf \
/usr/share/qt4/mkspecs/features/resources.prf \
/usr/share/qt4/mkspecs/features/uic.prf \
/usr/share/qt4/mkspecs/features/yacc.prf \
/usr/share/qt4/mkspecs/features/lex.prf \
/usr/share/qt4/mkspecs/features/include_source_dir.prf \
/usr/lib/libQtXml.prl \
/usr/lib/libQtOpenGL.prl \
/usr/lib/libQtGui.prl \
/usr/lib/libQtCore.prl
$(QMAKE) -unix -o Makefile nef.pro
/usr/share/qt4/mkspecs/common/g++.conf:
/usr/share/qt4/mkspecs/common/unix.conf:
/usr/share/qt4/mkspecs/common/linux.conf:
/usr/share/qt4/mkspecs/qconfig.pri:
/usr/share/qt4/mkspecs/features/qt_functions.prf:
/usr/share/qt4/mkspecs/features/qt_config.prf:
/usr/share/qt4/mkspecs/features/exclusive_builds.prf:
/usr/share/qt4/mkspecs/features/default_pre.prf:
/usr/share/qt4/mkspecs/features/release.prf:
/usr/share/qt4/mkspecs/features/default_post.prf:
/usr/share/qt4/mkspecs/features/warn_on.prf:
/usr/share/qt4/mkspecs/features/qt.prf:
/usr/share/qt4/mkspecs/features/unix/opengl.prf:
/usr/share/qt4/mkspecs/features/unix/thread.prf:
/usr/share/qt4/mkspecs/features/moc.prf:
/usr/share/qt4/mkspecs/features/resources.prf:
/usr/share/qt4/mkspecs/features/uic.prf:
/usr/share/qt4/mkspecs/features/yacc.prf:
/usr/share/qt4/mkspecs/features/lex.prf:
/usr/share/qt4/mkspecs/features/include_source_dir.prf:
/usr/lib/libQtXml.prl:
/usr/lib/libQtOpenGL.prl:
/usr/lib/libQtGui.prl:
/usr/lib/libQtCore.prl:
qmake: FORCE
@$(QMAKE) -unix -o Makefile nef.pro

dist:
@$(CHK_DIR_EXISTS) .tmp/nef1.0.0 || $(MKDIR) .tmp/nef1.0.0
$(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/nef1.0.0/ &&
$(COPY_FILE) --parents main.cpp .tmp/nef1.0.0/ && (cd `dirname
.tmp/nef1.0.0` && $(TAR) nef1.0.0.tar nef1.0.0 && $(COMPRESS)
nef1.0.0.tar) && $(MOVE) `dirname .tmp/nef1.0.0`/nef1.0.0.tar.gz . &&
$(DEL_FILE) -r .tmp/nef1.0.0


clean:compiler_clean
-$(DEL_FILE) $(OBJECTS)
-$(DEL_FILE) *~ core *.core


####### Sub-libraries

distclean: clean
-$(DEL_FILE) $(TARGET)
-$(DEL_FILE) Makefile


mocclean: compiler_moc_header_clean compiler_moc_source_clean

mocables: compiler_moc_header_make_all compiler_moc_source_make_all

compiler_moc_header_make_all:
compiler_moc_header_clean:
compiler_rcc_make_all:
compiler_rcc_clean:
compiler_image_collection_make_all: qmake_image_collection.cpp
compiler_image_collection_clean:
-$(DEL_FILE) qmake_image_collection.cpp
compiler_moc_source_make_all:
compiler_moc_source_clean:
compiler_uic_make_all:
compiler_uic_clean:
compiler_yacc_decl_make_all:
compiler_yacc_decl_clean:
compiler_yacc_impl_make_all:
compiler_yacc_impl_clean:
compiler_lex_make_all:
compiler_lex_clean:
compiler_clean:

####### Compile

main.o: main.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp

####### Install

install: FORCE

uninstall: FORCE

FORCE:
---- end: Makefile ----

On Thu, Dec 3, 2009 at 7:21 PM, Matthew Denno
<>
wrote:
> I think that you need to add LIBS += -lCGAL to your .pro file.  Also you
> should add -frounding-math flag, but I forget exactly how...I am on my
> mobile right now so I can't look.
>
> On Dec 3, 2009 6:53 PM, "Ramin H"
> <>
> wrote:
>
> Hi everyone,
>
> I am using CGAL3.5 and Ubuntu 9.10. Most of the examples and demos
> compile successfully but when I try to compile the following code:
>
> ---- begin: main.cpp ----
> #include <CGAL/Exact_predicates_exact_constructions_kernel.h>
> int main() {
>   return 0;
> }
> ---- end main.cpp ----
>
> I get the following errors on the terminal (the Makefile is generated
> from a Qt .pro project file.):
> ------------------
> ramin@ubundev:~/NetBeansProjects/test-cgal$
> qmake nef.pro
> ramin@ubundev:~/NetBeansProjects/test-cgal$
> make
> g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_XML_LIB
> -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED
> -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore
> -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL
> -I/usr/include/qt4/QtXml -I/usr/include/qt4 -I/usr/include
> -I../../CGAL-3.5/include -I/usr/X11R6/include -I. -o main.o main.cpp
> g++ -Wl,-O1 -o nef main.o    -L/usr/lib -L/usr/X11R6/lib -L/usr/lib
> -L/home/ramin/CGAL-3.5/lib -lQtXml -lQtOpenGL -lQtGui -lQtCore -lGLU
> -lGL -lpthread
> main.o: In function `global constructors keyed to main':
> main.cpp:(.text+0x246): undefined reference to
> `CGAL::assertion_fail(char const*, char const*, int, char const*)'
> main.cpp:(.text+0x270): undefined reference to
> `CGAL::assertion_fail(char const*, char const*, int, char const*)'
> main.cpp:(.text+0x29a): undefined reference to
> `CGAL::assertion_fail(char const*, char const*, int, char const*)'
> main.cpp:(.text+0x2c4): undefined reference to
> `CGAL::assertion_fail(char const*, char const*, int, char const*)'
> collect2: ld returned 1 exit status
> make: *** [nef] Error 1
> ------------------
>
> Any idea what's wrong? Do I need a specific compiler switch to compile
> CGAL programs in this environment?
>
> Thank you,
> -Ramin
>
> --
> You are currently subscribed to cgal-discuss.
> To unsubscribe or access the archives, go to
> https://lists-sop.inria.fr/wws/info/cgal-discuss
>
>



Archive powered by MHonArc 2.6.16.

Top of Page