CppDB compilation errors - c++

I followed the following steps in order to build CppDB:
svn co http://cppcms.svn.sourceforge.net/svnroot/cppcms/cppdb/trunk cppdb-trunk
cd cppdb-trunk
cmake ~/Desktop/cppdb-trunk
make
make install
Afterwards, I'm trying to compile and run the file example1.cpp from the examples directory.
When I run gcc example1.cpp I get the following errors:
/tmp/ccGWenrv.o: In function main':
example1.cpp:(.text+0x2a): undefined reference tostd::allocator::allocator()'
example1.cpp:(.text+0x42): undefined reference to std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)'
example1.cpp:(.text+0x58): undefined reference tocppdb::session::session(std::__cxx11::basic_string, std::allocator > const&)'
example1.cpp:(.text+0x64): undefined reference to std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
example1.cpp:(.text+0x73): undefined reference tostd::allocator::~allocator()'
example1.cpp:(.text+0x91): undefined reference to cppdb::session::operator<<(char const*)'
example1.cpp:(.text+0xa5): undefined reference tocppdb::statement::operator<<(void ()(cppdb::statement&))'
example1.cpp:(.text+0xb4): undefined reference to cppdb::statement::~statement()'
example1.cpp:(.text+0xd2): undefined reference tocppdb::session::operator<<(char const)'
example1.cpp:(.text+0xe6): undefined reference to cppdb::statement::operator<<(void (*)(cppdb::statement&))'
example1.cpp:(.text+0xf5): undefined reference tocppdb::statement::~statement()'
example1.cpp:(.text+0x170): undefined reference to cppdb::statement::statement()'
example1.cpp:(.text+0x18e): undefined reference tocppdb::session::operator<<(char const*)'
example1.cpp:(.text+0x1db): undefined reference to cppdb::statement::operator<<(tm const&)'
example1.cpp:(.text+0x1e8): undefined reference tocppdb::statement::operator<<(char const*)'
example1.cpp:(.text+0x1fd): undefined reference to `cppdb::statement::operator=(cppdb::statement const&)'
etc.
Any suggestions?

Try g++ example1.cpp -lcppdb. You need to link against the C++ run-time library (using g++ instead of gcc takes care of that) and against CppDB itself (the -lcppdb part). If GCC cannot find the -lcppdb library, you'll have to provide the path using -L, and you may have to use LD_LIBRARY_PATH at run time as well.

Related

Trying to statically link MYSQL library in C++ without any luck

I'm stuck on this issue and I don't think it should be this difficult. I'm essentially getting a compilation error with several 'undefined reference' warnings which are, I believe, caused by the library not being properly linked to the project.
The library resources along with the required header files are all located in the include folder of my project as well as in the include path. (For reference, I'm working inside of VScode).
Here's part of my makefile
MYSQL_CONCPP_DIR = /home/me/Git/CppProject/include/cpp-connector-mysql
UTILS_DIR = /home/me/Git/CppProject/include/utils/
CPPFLAGS = -DSTATIC_CONCPP -I $(UTILS_DIR)
LDLIBS = $(MYSQL_CONCPP_DIR)/lib64/libmysqlcppconn8-static.a -I $(UTILS_DIR) -lssl -lcrypto -lpthread
CXXFLAGS := -std=c++17 -Wall -Wextra -g
I started moving towards C++ development maybe a week ago and have been programming for maybe half a year. So, if there is something obvious that I am missing I would not mind being embarrassed on Stack Overflow, as long as I learn something.
I've scoured the internet to find a solution and nothing has worked. I successfully did the exact same thing I'm trying to do (connect to localhost via a User class and a Connector class) in both Java and Python in a few hours, but am stuck on C++ with this issue.
Here's the actual error message I get, which is incredibly difficult to decipher:
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: src/Connector.o: in function `check_lib()':
/home/adis/Git/CppProject/include/cpp-connector-mysql/jdbc/cppconn/driver.h:77: undefined reference to `check(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /home/adis/Git/CppProject/include/cpp-connector-mysql/jdbc/cppconn/driver.h:78: undefined reference to `check(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const&)'
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: src/Connector.o: in function `get_driver_instance_by_name':
/home/adis/Git/CppProject/include/cpp-connector-mysql/jdbc/cppconn/driver.h:90: undefined reference to `_get_driver_instance_by_name'
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: src/Connector.o: in function `mysqlx::abi2::r0::string::traits<char>::to_str[abi:cxx11](mysqlx::abi2::r0::string const&)':
/home/adis/Git/CppProject/include/cpp-connector-mysql/mysqlx/devapi/common.h:225: undefined reference to `mysqlx::abi2::r0::string::Impl::to_utf8[abi:cxx11](mysqlx::abi2::r0::string const&)'
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: src/Connector.o: in function `mysqlx::abi2::r0::DbDoc::DbDoc()':
/home/adis/Git/CppProject/include/cpp-connector-mysql/mysqlx/devapi/document.h:107: undefined reference to `vtable for mysqlx::abi2::r0::DbDoc'
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: src/Connector.o: in function `mysqlx::abi2::r0::DbDoc::~DbDoc()':
/home/adis/Git/CppProject/include/cpp-connector-mysql/mysqlx/devapi/document.h:81: undefined reference to `vtable for mysqlx::abi2::r0::DbDoc'
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: src/Connector.o: in function `mysqlx::abi2::r0::Value::print(std::ostream&) const':
/home/adis/Git/CppProject/include/cpp-connector-mysql/mysqlx/devapi/document.h:508: undefined reference to `mysqlx::abi2::r0::common::Value::print(std::ostream&) const'
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: src/Connector.o:(.data.rel.ro._ZTCN6mysqlx4abi22r05ValueE0_NS1_6common5ValueE[_ZTVN6mysqlx4abi22r05ValueE]+0x18): undefined reference to `typeinfo for mysqlx::abi2::r0::common::Value'
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: src/Connector.o:(.data.rel.ro._ZTCN6mysqlx4abi22r05ValueE0_NS1_6common5ValueE[_ZTVN6mysqlx4abi22r05ValueE]+0x20): undefined reference to `mysqlx::abi2::r0::common::Value::print(std::ostream&) const'
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: src/Connector.o:(.data.rel.ro._ZTIN6mysqlx4abi22r05ValueE[_ZTIN6mysqlx4abi22r05ValueE]+0x28): undefined reference to `typeinfo for mysqlx::abi2::r0::common::Value'
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: warning: creating DT_TEXTREL in a PIE
collect2: error: ld returned 1 exit status
make: *** [Makefile:76: main] Error 1

Make utility complains about "undefined reference" when I tried to make TPC-E test [duplicate]

This question already has answers here:
GCC linker can't find standard library?
(4 answers)
Closed 3 years ago.
The problem is compounded by the fact that I am far from programming.
I need to use the TPC-E test. I downloaded the source codes from their website.
There is a miserable and almost meaningless ReadMe.
Here are its contents:
To use the Makefile you must first set the following environment variables
to match your system and compiler requirements:
CXX: path and name of compiler
ex: export CXX=/opt/SUNWspro/bin/CC (C++ compiler on Solaris)
CCFLAGS: compiler options
ex: export CCFLAGS="-g -O"
-g enable debug
-O optimize code
LDFLAGS: linker/loader options
ex: export LDFLAGS="-g"
LIBS: extra libraries to link in
ex: export LIBS="-lpthread"
According to the instructions there, I created the necessary environment variables (I just removed the -g switch from the CCFLAGS variable). After that, I ran the make utility and got more than five thousand lines of errors. Apparently he lacks some libraries. On this my knowledge ends.
Here are some error messages received:
...
/usr/bin/ld: DateTime.o: in function `TPCE::CDateTime::Validate(int, int, int, int, int, int, int)': DateTime.cpp:(.text+0xee): undefined reference to `std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::basic_ostringstream(std::_Ios_Openmode)'
/usr/bin/ld: DateTime.cpp:(.text+0xfd): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
/usr/bin/ld: DateTime.cpp:(.text+0x107): undefined reference to `__cxa_allocate_exception'
/usr/bin/ld: DateTime.cpp:(.text+0x117): undefined reference to `std::__cxx11::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::str() const'
/usr/bin/ld: DateTime.cpp:(.text+0x122): undefined reference to `std::out_of_range::out_of_range(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: DateTime.cpp:(.text+0x135): undefined reference to `operator delete(void*)'
...
/usr/bin/ld: error.cpp:(.text._ZN4TPCE10CSystemErrD0Ev[_ZN4TPCE10CSystemErrD5Ev]+0x24): undefined reference to `std::exception::~exception()'
/usr/bin/ld: error.cpp:(.text._ZN4TPCE10CSystemErrD0Ev[_ZN4TPCE10CSystemErrD5Ev]+0x31): undefined reference to `operator delete(void*, unsigned long)'
/usr/bin/ld: error.o: in function `TPCE::CSystemErr::~CSystemErr()':error.cpp:(.text._ZN4TPCE10CSystemErrD2Ev[_ZN4TPCE10CSystemErrD5Ev]+0x1c): undefined reference to `operator delete(void*)'
...
/usr/bin/ld: locking.cpp:(.text+0x1fb): undefined reference to `operator delete(void*)'
/usr/bin/ld: locking.cpp:(.text+0x202): undefined reference to `std::runtime_error::~runtime_error()'
/usr/bin/ld: locking.cpp:(.text+0x209): undefined reference to `typeinfo for std::runtime_error'
/usr/bin/ld: locking.cpp:(.text+0x211): undefined reference to `__cxa_throw'
/usr/bin/ld: locking.o: in function `TPCE::CMutex::lock()':locking.cpp:(.text+0x246): undefined reference to `std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::basic_ostringstream(std::_Ios_Openmode)'
...
A search on the internet made me think of installing the libboost-all-dev package, but that didn't help. In the end, I gave up - I’m completely incomprehensible to the terminology and I don’t have time to study C ++ programming.
Operating System - Debian 10
Questions: which libraries need to be installed and is there anyone who used these tests, how to adapt them to PostgreSQL?
Full error log (892 230 bytes)
I replaced
export CXX=/usr/bin/gcc
with
export CXX=/usr/bin/c++

Undefined reference problem with antlr4 c++ target

I am taking a compiler design course and I am trying to learn about ANTLR4 with a C++ target.
Well, that's what I went through:
I Wrote the grammar in a file named "ArrayInit.g4"
Compiled it using ANTLR4 tool and the command "antlr4 -Dlanguage=Cpp -o build" and got a bunch of files in the "build/" directory where I added also a simple file containing the main function int main(){return 0;}
Downloaded the C++ runtime and put it in a directory "runtime/"
In this stage I got stuck, I could not compile the .cpp files using the command "g++ -std=c++11 -I ../runtime -o exec *.cpp" and i get the following error messages:
/tmp/cc8VNGfx.o: In function `ArrayInitLexer::ArrayInitLexer(antlr4::CharStream*)':
ArrayInitLexer.cpp:(.text+0xc8): undefined reference to `antlr4::Lexer::Lexer(antlr4::CharStream*)'
ArrayInitLexer.cpp:(.text+0x116): undefined reference to `antlr4::atn::LexerATNSimulator::LexerATNSimulator(antlr4::Lexer*, antlr4::atn::ATN const&, std::vector<antlr4::dfa::DFA, std::allocator<antlr4::dfa::DFA> >&, std::unordered_set<std::shared_ptr<antlr4::atn::PredictionContext>, antlr4::atn::PredictionContextHasher, antlr4::atn::PredictionContextComparer, std::allocator<std::shared_ptr<antlr4::atn::PredictionContext> > >&)'
/tmp/cc8VNGfx.o: In function `ArrayInitLexer::Initializer::Initializer()':
ArrayInitLexer.cpp:(.text+0x376): undefined reference to `antlr4::dfa::Vocabulary::getLiteralName[abi:cxx11](unsigned long) const'
ArrayInitLexer.cpp:(.text+0x3a6): undefined reference to `antlr4::dfa::Vocabulary::getSymbolicName[abi:cxx11](unsigned long) const'
ArrayInitLexer.cpp:(.text+0x4b2): undefined reference to `antlr4::atn::ATNDeserializer::ATNDeserializer()'
ArrayInitLexer.cpp:(.text+0x4d2): undefined reference to `antlr4::atn::ATNDeserializer::deserialize(std::vector<unsigned short, std::allocator<unsigned short> > const&)'
ArrayInitLexer.cpp:(.text+0x4e8): undefined reference to `antlr4::atn::ATN::operator=(antlr4::atn::ATN&&)'
ArrayInitLexer.cpp:(.text+0x4f7): undefined reference to `antlr4::atn::ATN::~ATN()'
ArrayInitLexer.cpp:(.text+0x503): undefined reference to `antlr4::atn::ATN::getNumberOfDecisions() const'
ArrayInitLexer.cpp:(.text+0x551): undefined reference to `antlr4::atn::ATN::getDecisionState(unsigned long) const'
ArrayInitLexer.cpp:(.text+0x598): undefined reference to `antlr4::atn::ATNDeserializer::~ATNDeserializer()'
ArrayInitLexer.cpp:(.text+0x601): undefined reference to `antlr4::atn::ATNDeserializer::~ATNDeserializer()'
/tmp/cc8VNGfx.o: In function `__static_initialization_and_destruction_0(int, int)':
ArrayInitLexer.cpp:(.text+0x6ec): undefined reference to `antlr4::atn::ATN::ATN()'
ArrayInitLexer.cpp:(.text+0x701): undefined reference to `antlr4::atn::ATN::~ATN()'
ArrayInitLexer.cpp:(.text+0xee6): undefined reference to `antlr4::dfa::Vocabulary::Vocabulary(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)'
ArrayInitLexer.cpp:(.text+0xefb): undefined reference to `antlr4::dfa::Vocabulary::~Vocabulary()'
/tmp/cc8VNGfx.o: In function `antlr4::Lexer::~Lexer()':
ArrayInitLexer.cpp:(.text._ZN6antlr45LexerD2Ev[_ZN6antlr45LexerD5Ev]+0xf): undefined reference to `vtable for antlr4::Lexer'
ArrayInitLexer.cpp:(.text._ZN6antlr45LexerD2Ev[_ZN6antlr45LexerD5Ev]+0x1d): undefined reference to `vtable for antlr4::Lexer'
ArrayInitLexer.cpp:(.text._ZN6antlr45LexerD2Ev[_ZN6antlr45LexerD5Ev]+0x7d): undefined reference to `antlr4::TokenSource::~TokenSource()'
ArrayInitLexer.cpp:(.text._ZN6antlr45LexerD2Ev[_ZN6antlr45LexerD5Ev]+0x89): undefined reference to `antlr4::Recognizer::~Recognizer()'
/tmp/cc8VNGfx.o: In function `void __gnu_cxx::new_allocator<antlr4::dfa::DFA>::construct<antlr4::dfa::DFA, antlr4::atn::DecisionState*, unsigned long&>(antlr4::dfa::DFA*, antlr4::atn::DecisionState*&&, unsigned long&)':
ArrayInitLexer.cpp:(.text._ZN9__gnu_cxx13new_allocatorIN6antlr43dfa3DFAEE9constructIS3_JPNS1_3atn13DecisionStateERmEEEvPT_DpOT0_[_ZN9__gnu_cxx13new_allocatorIN6antlr43dfa3DFAEE9constructIS3_JPNS1_3atn13DecisionStateERmEEEvPT_DpOT0_]+0x60): undefined reference to `antlr4::dfa::DFA::DFA(antlr4::atn::DecisionState*, unsigned long)'
/tmp/cc8VNGfx.o: In function `void std::_Construct<antlr4::dfa::DFA, antlr4::dfa::DFA>(antlr4::dfa::DFA*, antlr4::dfa::DFA&&)':
ArrayInitLexer.cpp:(.text._ZSt10_ConstructIN6antlr43dfa3DFAEJS2_EEvPT_DpOT0_[_ZSt10_ConstructIN6antlr43dfa3DFAEJS2_EEvPT_DpOT0_]+0x44): undefined reference to `antlr4::dfa::DFA::DFA(antlr4::dfa::DFA&&)'
/tmp/cc8VNGfx.o:(.data.rel.ro._ZTV14ArrayInitLexer[_ZTV14ArrayInitLexer]+0x38): undefined reference to `antlr4::Recognizer::getTokenTypeMap[abi:cxx11]()'
/tmp/cc8VNGfx.o:(.data.rel.ro._ZTV14ArrayInitLexer[_ZTV14ArrayInitLexer]+0x40): undefined reference to `antlr4::Recognizer::getRuleIndexMap[abi:cxx11]()'
/tmp/cc8VNGfx.o:(.data.rel.ro._ZTV14ArrayInitLexer[_ZTV14ArrayInitLexer]+0x48): undefined reference to `antlr4::Recognizer::getTokenType(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/tmp/cc8VNGfx.o:(.data.rel.ro._ZTV14ArrayInitLexer[_ZTV14ArrayInitLexer]+0x60): undefined reference to `antlr4::Recognizer::getErrorHeader[abi:cxx11](antlr4::RecognitionException*)'
/tmp/cc8VNGfx.o:(.data.rel.ro._ZTV14ArrayInitLexer[_ZTV14ArrayInitLexer]+0x68): undefined reference to `antlr4::Recognizer::getTokenErrorDisplay[abi:cxx11](antlr4::Token*)'
/tmp/cc8VNGfx.o:(.data.rel.ro._ZTV14ArrayInitLexer[_ZTV14ArrayInitLexer]+0x70): undefined reference to `antlr4::Recognizer::addErrorListener(antlr4::ANTLRErrorListener*)'
/tmp/cc8VNGfx.o:(.data.rel.ro._ZTV14ArrayInitLexer[_ZTV14ArrayInitLexer]+0x78): undefined reference to `antlr4::Recognizer::removeErrorListener(antlr4::ANTLRErrorListener*)'
/tmp/cc8VNGfx.o:(.data.rel.ro._ZTV14ArrayInitLexer[_ZTV14ArrayInitLexer]+0x80): undefined reference to `antlr4::Recognizer::removeErrorListeners()'
/tmp/cc8VNGfx.o:(.data.rel.ro._ZTV14ArrayInitLexer[_ZTV14ArrayInitLexer]+0x88): undefined reference to `antlr4::Recognizer::getErrorListenerDispatch()'
/tmp/cc8VNGfx.o:(.data.rel.ro._ZTV14ArrayInitLexer[_ZTV14ArrayInitLexer]+0x90): undefined reference to `antlr4::Recognizer::sempred(antlr4::RuleContext*, unsigned long, unsigned long)'
/tmp/cc8VNGfx.o:(.data.rel.ro._ZTV14ArrayInitLexer[_ZTV14ArrayInitLexer]+0x98): undefined reference to `antlr4::Recognizer::precpred(antlr4::RuleContext*, int)'
/tmp/cc8VNGfx.o:(.data.rel.ro._ZTV14ArrayInitLexer[_ZTV14ArrayInitLexer]+0xa0): undefined reference to `antlr4::Recognizer::action(antlr4::RuleContext*, unsigned long, unsigned long)'
/tmp/cc8VNGfx.o:(.data.rel.ro._ZTV14ArrayInitLexer[_ZTV14ArrayInitLexer]+0xa8): undefined reference to `antlr4::Recognizer::getState() const'
/tmp/cc8VNGfx.o:(.data.rel.ro._ZTV14ArrayInitLexer[_ZTV14ArrayInitLexer]+0xb8): undefined reference to `antlr4::Lexer::getInputStream()'
/tmp/cc8VNGfx.o:(.data.rel.ro._ZTV14ArrayInitLexer[_ZTV14ArrayInitLexer]+0xc0): undefined reference to `antlr4::Lexer::setInputStream(antlr4::IntStream*)'
I am totaly new to C++ and I am skipping a basic idea maybe.
Edit1: I am using Linux
Edit2:
When I execute the commande antlr4 -Dlanguage=Cpp -o build I get a bunch of .cpp and .h files as: ArrayInitLexer.h and many of them include antlr4-runtime.h .This header file is present in the runtime/ folder which by it self includes many other header files in the same directory (.i.e runtime/) that contains .h and .cpp files (I see no .a or .so files).
You can find the runtime here under the C++ target section or directly from here
Your compile command doesn't look quite right.
Note that g++ takes an uppercase -L switch to specify a location to look for libraries, and a lowercase -l to specify the filename of a library to link, not including a lib prefix and the file suffix. Since in at least the version I see, antlr provides a "libantlr.a", this would be -l antlr.
Also, the library should be given after your program source or object file(s), because in most cases the linker decides what pieces of libraries to include based on whether they provide any symbols it knows are needed by what it has seen so far.
So I'm not sure if this will solve all the problems, but a step forward would be:
g++ -std=c++11 -Wall -Wextra *.cpp -L ../runtime -l antlr -o exec
I've also taken the liberty of adding the -W flags to enable a default set of compiler warnings, which is a must when writing new C++ code, whether you're new to the language or not.

undefined reference error when compiling c++ application

I receiving a undefined reference error when try to compile an c++ program. I'm the using the -I and -L switches to point to lib and include files my command:
g++ -g -Wall -L/usr/local/lib/active -I/usr/local/include/active tutorial_01.cpp -o tutorial_01
Can some help me with what I'm missing?
In file included from /usr/local/include/active/jaus/core/header.h:44:0,
from /usr/local/include/active/jaus/core/message.h:49,
from /usr/local/include/active/jaus/core/service.h:44,
from /usr/local/include/active/jaus/core/transport/transport.h:44,
from /usr/local/include/active/jaus/core/component.h:43,
from tutorial_01.cpp:42:
/usr/local/include/active/jaus/core/address.h: In static member function ‘static bool JAUS::Address::IsReservedComponentID(JAUS::Byte)’:
/usr/local/include/active/jaus/core/address.h:302:40: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
/usr/local/include/active/jaus/core/address.h:303:40: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
/tmp/cczAJw8H.o: In function `main':
/home/reese/JAUS++-2.110519-src/libraries/jaus++/2.0/src/jaus/core/tutorial_01.cpp:58: undefined reference to `JAUS::Component::Component()'
/home/reese/JAUS++-2.110519-src/libraries/jaus++/2.0/src/jaus/core/tutorial_01.cpp:78: undefined reference to `JAUS::Discovery::Name'
/home/reese/JAUS++-2.110519-src/libraries/jaus++/2.0/src/jaus/core/tutorial_01.cpp:78: undefined reference to `JAUS::Component::GetService(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/home/reese/JAUS++-2.110519-src/libraries/jaus++/2.0/src/jaus/core/tutorial_01.cpp:88: undefined reference to `JAUS::Discovery::SetSubsystemIdentification(JAUS::Subsystem::Type, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/home/reese/JAUS++-2.110519-src/libraries/jaus++/2.0/src/jaus/core/tutorial_01.cpp:100: undefined reference to `JAUS::Component::Initialize(JAUS::Address const&, double)'
/home/reese/JAUS++-2.110519-src/libraries/jaus++/2.0/src/jaus/core/tutorial_01.cpp:109: undefined reference to `CxUtils::Time::GetUtcTimeMs()'
/home/reese/JAUS++-2.110519-src/libraries/jaus++/2.0/src/jaus/core/tutorial_01.cpp:122: undefined reference to `JAUS::Management::Name'
/home/reese/JAUS++-2.110519-src/libraries/jaus++/2.0/src/jaus/core/tutorial_01.cpp:122: undefined reference to `JAUS::Component::GetService(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/home/reese/JAUS++-2.110519-src/libraries/jaus++/2.0/src/jaus/core/tutorial_01.cpp:130: undefined reference to `CxUtils::Time::GetUtcTimeMs()'
/home/reese/JAUS++-2.110519-src/libraries/jaus++/2.0/src/jaus/core/tutorial_01.cpp:136: undefined reference to `CxUtils::Time::GetUtcTimeMs()'
/home/reese/JAUS++-2.110519-src/libraries/jaus++/2.0/src/jaus/core/tutorial_01.cpp:139: undefined reference to `CxUtils::GetChar()'
/home/reese/JAUS++-2.110519-src/libraries/jaus++/2.0/src/jaus/core/tutorial_01.cpp:144: undefined reference to `CxUtils::SleepMs(unsigned int)'
/home/reese/JAUS++-2.110519-src/libraries/jaus++/2.0/src/jaus/core/tutorial_01.cpp:150: undefined reference to `JAUS::Component::Shutdown()'
/home/reese/JAUS++-2.110519-src/libraries/jaus++/2.0/src/jaus/core/tutorial_01.cpp:58: undefined reference to `JAUS::Component::~Component()'
/home/reese/JAUS++-2.110519-src/libraries/jaus++/2.0/src/jaus/core/tutorial_01.cpp:58: undefined reference to `JAUS::Component::~Component()'
collect2: ld returned 1 exit status
The -L option doesn't really do anything for you unless you also use -l with the name of the library. I'm going to take a guess that your library is named libactive.a, in which case you'll want to do this:
g++ -g -Wall -L/usr/local/lib/active -lactive -I/usr/local/include/active tutorial_01.cpp -o tutorial_01
If the library has a different name, you'll need to change it.
Here's the rule: For a library called /path/to/library/libmylibrary.a, use this command line: -L/path/to/library -lmylibrary.

c++ compile error after upgrading from ubuntu 10.10 to 11.10

I have a program in c++ that was working and compiling on ubuntu 10.10. However, when i upgraded to 11.10 i started to get this error message:
g++ -rdynamic -o ../../../bin/camera Camera.o main.o moc_Camera.o -L/home/myusername/Desktop/project/lib -L/usr/lib/i386-linux-gnu -ljpeg -lcfitsio -lavcodec -lavformat -lswscale -lfftw3 -lfftw3f -lcv -lgdal1.7.0 -lmatrox_fake -lbacktrace -lexceptions -limage -limage_display -lio -ljpeg_image -llog -lmetadata -lpipe -lpipebrowser -lplumber -lplumbing -lqt -lserial -ltime -lwebcam -Wl,-R/home/myusername/Desktop/project/lib -lQtXml -lQtGui -lQtCore -lpthread
/home/myusername/Desktop/project/lib/libjpeg_image.so: undefined reference to `jpeg_resync_to_restart'
/home/myusername/Desktop/project/lib/libplumber.so: undefined reference to `company::pipe::PipeBrowser::PipeBrowser()'
/home/myusername/Desktop/project/lib/libjpeg_image.so: undefined reference to `jpeg_std_error'
/home/myusername/Desktop/project/lib/libjpeg_image.so: undefined reference to `jpeg_CreateDecompress'
/home/myusername/Desktop/project/lib/libjpeg_image.so: undefined reference to `jpeg_start_compress'
/home/myusername/Desktop/project/lib/libjpeg_image.so: undefined reference to `jpeg_read_header'
/home/myusername/Desktop/project/lib/libqt.so: undefined reference to `ExceptionHandler::ExceptionHandler()'
/home/myusername/Desktop/project/lib/liblog.so: undefined reference to `Backtrace::add(void*)'
/home/myusername/Desktop/project/lib/libjpeg_image.so: undefined reference to `jpeg_destroy_decompress'
/home/myusername/Desktop/project/lib/libwebcam.so: undefined reference to `Exception::Exception(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/home/myusername/Desktop/project/lib/libimage.so: undefined reference to `Exception::Exception(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/home/myusername/Desktop/project/lib/libimage.so: undefined reference to `Exception::~Exception()'
/home/myusername/Desktop/project/lib/libjpeg_image.so: undefined reference to `jpeg_finish_compress'
/home/myusername/Desktop/project/lib/liblog.so: undefined reference to `Backtrace::~Backtrace()'
/home/myusername/Desktop/project/lib/libjpeg_image.so: undefined reference to `jpeg_destroy_compress'
/home/myusername/Desktop/project/lib/libjpeg_image.so: undefined reference to `jpeg_finish_decompress'
/home/myusername/Desktop/project/lib/libjpeg_image.so: undefined reference to `jpeg_set_defaults'
/home/myusername/Desktop/project/lib/liblog.so: undefined reference to `Backtrace::print(std::basic_ostream<char, std::char_traits<char> >&) const'
/home/myusername/Desktop/project/lib/libimage.so: undefined reference to `Exception::~Exception()'
/home/myusername/Desktop/project/lib/libimage.so: undefined reference to `typeinfo for Exception'
/home/myusername/Desktop/project/lib/libjpeg_image.so: undefined reference to `jpeg_start_decompress'
/home/myusername/Desktop/project/lib/libplumber.so: undefined reference to `ExceptionHandler::handle(Exception&)'
/home/myusername/Desktop/project/lib/liblog.so: undefined reference to `Backtrace::trace()'
/home/myusername/Desktop/project/lib/libjpeg_image.so: undefined reference to `jpeg_write_scanlines'
/home/myusername/Desktop/project/lib/liblog.so: undefined reference to `Backtrace::Backtrace()'
/home/myusername/Desktop/project/lib/libimage.so: undefined reference to `Exception::report(std::basic_ostream<char, std::char_traits<char> >&) const'
/home/myusername/Desktop/project/lib/libjpeg_image.so: undefined reference to `jpeg_CreateCompress'
/home/myusername/Desktop/project/lib/libjpeg_image.so: undefined reference to `jpeg_read_scanlines'
/home/myusername/Desktop/project/lib/libimage.so: undefined reference to `IOException::IOException(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/home/myusername/Desktop/project/lib/liblog.so: undefined reference to `checkIO(std::basic_ios<char, std::char_traits<char> >&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
collect2: ld returned 1 exit status
make: *** [../../../bin/camera] Error 1
All the libraries are there.. so im not sure why there are all those undefined references. Has anyone else encountered this problems with the libjpeg library after upgrading to 11.10 or have any idea on why upgrading would cause this problem?
According to the information found in this bug report, re-installing the JPEG library may solve the problem. The title of the bug is **libwebkit-1.0-2: Undefined symbol: jpeg_resync_to_restart* and here is how the reporter fixed the problem:
My system appeared to be broken. After reinstalling libjpeg62,
libjpeg.so.62 becomes a symlink to libjpeg.so.62.0.0 as expected.
Something must be wrong in my upgrade path, but it's not
libwebkit's or libjpeg's problem. So, closing this false-alarm
bug now.
Found out that all of the .so libraries when they are being compiled they were missing -l(libname) for all the included libraries which is why all those undefined errors where being printed out. Still wondering why it works without them on 10.10 and not on 11.10...