(C++) Undefined reference to 'cln::cl\random\def\init\helper::cl\random\def\init\helper()'
February 24, 2017 · View on GitHub
(C++) Undefined reference to 'cln::cl_random_def_init_helper::cl_random_def_init_helper()'
Full error message
/MyFolder/MyFile.o:: In function '__static_initialization_and_destruction_0': /usr/include/cln/random.h:43: error: undefined reference to 'cln::cl_random_def_init_helper::cl_random_def_init_helper()' /usr/include/cln/random.h:43: error: undefined reference to 'cln::cl_random_def_init_helper::~cl_random_def_init_helper()' /MyFolder/MyFile.o:: In function '__static_initialization_and_destruction_0': /usr/include/cln/io.h:78: error: undefined reference to 'cln::cl_prin_globals_init_helper::cl_prin_globals_init_helper()' /usr/include/cln/io.h:78: error: undefined reference to 'cln::cl_prin_globals_init_helper::~cl_prin_globals_init_helper()' /MyFolder/MyFile.o:: In function '__static_initialization_and_destruction_0': /usr/include/cln/ring.h:392: error: undefined reference to 'cln::cl_no_ring_init_helper::cl_no_ring_init_helper()' /usr/include/cln/ring.h:392: error: undefined reference to 'cln::cl_no_ring_init_helper::~cl_no_ring_init_helper()' /MyFolder/MyFile.o:: In function '__static_initialization_and_destruction_0': /usr/include/cln/integer_ring.h:22: error: undefined reference to 'cln::cl_I_ring_init_helper::cl_I_ring_init_helper()' /usr/include/cln/integer_ring.h:22: error: undefined reference to 'cln::cl_I_ring_init_helper::~cl_I_ring_init_helper()' /MyFolder/MyFile.o:: In function '__static_initialization_and_destruction_0': /usr/include/cln/null_ring.h:20: error: undefined reference to 'cln::cl_0_ring_init_helper::cl_0_ring_init_helper()' /usr/include/cln/null_ring.h:20: error: undefined reference to 'cln::cl_0_ring_init_helper::~cl_0_ring_init_helper()' /MyFolder/MyFile.o:: In function '__static_initialization_and_destruction_0': /usr/include/cln/rational_ring.h:22: error: undefined reference to 'cln::cl_RA_ring_init_helper::cl_RA_ring_init_helper()' /usr/include/cln/rational_ring.h:22: error: undefined reference to 'cln::cl_RA_ring_init_helper::~cl_RA_ring_init_helper()' /MyFolder/MyFile.o:: In function '__static_initialization_and_destruction_0': /usr/include/cln/ffloat_class.h:72: error: undefined reference to 'cln::cl_FF_globals_init_helper::cl_FF_globals_init_helper()' /usr/include/cln/ffloat_class.h:72: error: undefined reference to 'cln::cl_FF_globals_init_helper::~cl_FF_globals_init_helper()' /MyFolder/MyFile.o:: In function '__static_initialization_and_destruction_0': /usr/include/cln/dfloat_class.h:62: error: undefined reference to 'cln::cl_DF_globals_init_helper::cl_DF_globals_init_helper()' /usr/include/cln/dfloat_class.h:62: error: undefined reference to 'cln::cl_DF_globals_init_helper::~cl_DF_globals_init_helper()' /MyFolder/MyFile.o:: In function '__static_initialization_and_destruction_0': /usr/include/cln/lfloat_class.h:63: error: undefined reference to 'cln::cl_LF_globals_init_helper::cl_LF_globals_init_helper()' /usr/include/cln/lfloat_class.h:63: error: undefined reference to 'cln::cl_LF_globals_init_helper::~cl_LF_globals_init_helper()' /MyFolder/MyFile.o:: In function '__static_initialization_and_destruction_0': /usr/include/cln/real_ring.h:23: error: undefined reference to 'cln::cl_R_ring_init_helper::cl_R_ring_init_helper()' /usr/include/cln/real_ring.h:23: error: undefined reference to 'cln::cl_R_ring_init_helper::~cl_R_ring_init_helper()' [and many more]
Cause
Operating system: Ubuntu 10.04 Lucid Lynx
IDE: Qt Creator 2.0.0
Project type: console Application
Libraries used:
- CLN: version 1.3.1
Qt project file
#------------------------------------------------- # # Project created by QtCreator 2010-08-24T12:57:24 # #------------------------------------------------- QT += core QT -= gui TARGET = CppClnExample1 CONFIG += console CONFIG -= app_bundle TEMPLATE = app SOURCES += main.cpp
Source code
#include <cln/cln.h> int main() { cln::cl_I y = 1; }
Solution
Add the following line to the Qt Creator project file:
LIBS += -L/usr/local/lib -lcln