How do I compile my application with static library? - gcc
I am currently trying to use reactphysics3d library to make simple pariticle collision simulator. https://www.reactphysics3d.com/
I tried to compile my c++ file with the static library but it doesn't compile well. The directory structure is something like this.
ParticleSimulation
|
|-- test.cpp
|
|-- lib
| |-- libreactphysics3d.a
|
|-- reactphysics3d
| |-- src
| |-- reactphysics3d.h
My test code is
#include "reactphysics3d.h"
using namespace reactphysics3d;
int main() {
rp3d::SphereShape * sphereShape = new SphereShape(1.0);
delete sphereShape;
}
I tried to compile with
gcc -std=c++11 -Ireactphysics3d/src -Llib -lreactphysics3d -o myapp test.cpp ./lib/libreactphysics3d.a
The entire error message is too long to post here(over 30000 characters exceeds the limit of a single post of Stackoverflow). The first lines of the message are
Undefined symbols for architecture x86_64:
"std::__1::__basic_string_common<true>::__throw_length_error() const", referenced from:
std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >::str() const in libreactphysics3d.a(ConcaveMeshShape.cpp.o)
"std::__1::locale::use_facet(std::__1::locale::id&) const", referenced from:
reactphysics3d::ConcaveMeshShape::to_string() const in libreactphysics3d.a(ConcaveMeshShape.cpp.o)
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in libreactphysics3d.a(ConcaveMeshShape.cpp.o)
"std::__1::ios_base::getloc() const", referenced from:
reactphysics3d::ConcaveMeshShape::to_string() const in libreactphysics3d.a(ConcaveMeshShape.cpp.o)
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in libreactphysics3d.a(ConcaveMeshShape.cpp.o)
"std::runtime_error::runtime_error(char const*)", referenced from:
reactphysics3d::HalfEdgeStructure::init() in libreactphysics3d.a(HalfEdgeStructure.cpp.o)
reactphysics3d::Map<reactphysics3d::Pair<unsigned int, unsigned int>, reactphysics3d::Pair<unsigned int, unsigned int> >::add(reactphysics3d::Pair<reactphysics3d::Pair<unsigned int, unsigned int>, reactphysics3d::Pair<unsigned int, unsigned int> > const&, bool) in libreactphysics3d.a(HalfEdgeStructure.cpp.o)
reactphysics3d::Map<reactphysics3d::Pair<unsigned int, unsigned int>, reactphysics3d::HalfEdgeStructure::Edge>::add(reactphysics3d::Pair<reactphysics3d::Pair<unsigned int, unsigned int>, reactphysics3d::HalfEdgeStructure::Edge> const&, bool) in libreactphysics3d.a(HalfEdgeStructure.cpp.o)
reactphysics3d::Map<reactphysics3d::Pair<unsigned int, unsigned int>, unsigned int>::add(reactphysics3d::Pair<reactphysics3d::Pair<unsigned int, unsigned int>, unsigned int> const&, bool) in libreactphysics3d.a(HalfEdgeStructure.cpp.o)
reactphysics3d::Map<unsigned int, reactphysics3d::Pair<unsigned int, unsigned int> >::add(reactphysics3d::Pair<unsigned int, reactphysics3d::Pair<unsigned int, unsigned int> > const&, bool) in libreactphysics3d.a(HalfEdgeStructure.cpp.o)
reactphysics3d::Map<reactphysics3d::Pair<unsigned int, unsigned int>, unsigned int>::operator[](reactphysics3d::Pair<unsigned int, unsigned int> const&) in libreactphysics3d.a(HalfEdgeStructure.cpp.o)
reactphysics3d::Map<reactphysics3d::Pair<unsigned int, unsigned int>, reactphysics3d::Pair<unsigned int, unsigned int> >::operator[](reactphysics3d::Pair<unsigned int, unsigned int> const&) in libreactphysics3d.a(HalfEdgeStructure.cpp.o)
...
"std::runtime_error::~runtime_error()", referenced from:
reactphysics3d::HalfEdgeStructure::init() in libreactphysics3d.a(HalfEdgeStructure.cpp.o)
reactphysics3d::Map<reactphysics3d::Pair<unsigned int, unsigned int>, reactphysics3d::Pair<unsigned int, unsigned int> >::add(reactphysics3d::Pair<reactphysics3d::Pair<unsigned int, unsigned int>, reactphysics3d::Pair<unsigned int, unsigned int> > const&, bool) in libreactphysics3d.a(HalfEdgeStructure.cpp.o)
reactphysics3d::Map<reactphysics3d::Pair<unsigned int, unsigned int>, reactphysics3d::HalfEdgeStructure::Edge>::add(reactphysics3d::Pair<reactphysics3d::Pair<unsigned int, unsigned int>, reactphysics3d::HalfEdgeStructure::Edge> const&, bool) in libreactphysics3d.a(HalfEdgeStructure.cpp.o)
reactphysics3d::Map<reactphysics3d::Pair<unsigned int, unsigned int>, unsigned int>::add(reactphysics3d::Pair<reactphysics3d::Pair<unsigned int, unsigned int>, unsigned int> const&, bool) in libreactphysics3d.a(HalfEdgeStructure.cpp.o)
reactphysics3d::Map<unsigned int, reactphysics3d::Pair<unsigned int, unsigned int> >::add(reactphysics3d::Pair<unsigned int, reactphysics3d::Pair<unsigned int, unsigned int> > const&, bool) in libreactphysics3d.a(HalfEdgeStructure.cpp.o)
reactphysics3d::Map<reactphysics3d::Pair<unsigned int, unsigned int>, unsigned int>::operator[](reactphysics3d::Pair<unsigned int, unsigned int> const&) in libreactphysics3d.a(HalfEdgeStructure.cpp.o)
reactphysics3d::Map<reactphysics3d::Pair<unsigned int, unsigned int>, reactphysics3d::Pair<unsigned int, unsigned int> >::operator[](reactphysics3d::Pair<unsigned int, unsigned int> const&) in libreactphysics3d.a(HalfEdgeStructure.cpp.o)
...
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(char const*, unsigned long)", referenced from:
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string<std::nullptr_t>(char const*) in test-db2b03.o
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::append(char const*)", referenced from:
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&&, char const*) in test-db2b03.o
reactphysics3d::FixedJoint::to_string() const in libreactphysics3d.a(FixedJoint.cpp.o)
reactphysics3d::Vector3::to_string() const in libreactphysics3d.a(FixedJoint.cpp.o)
reactphysics3d::Quaternion::to_string() const in libreactphysics3d.a(FixedJoint.cpp.o)
reactphysics3d::HingeJoint::to_string() const in libreactphysics3d.a(HingeJoint.cpp.o)
reactphysics3d::Vector3::to_string() const in libreactphysics3d.a(HingeJoint.cpp.o)
reactphysics3d::Quaternion::to_string() const in libreactphysics3d.a(HingeJoint.cpp.o)
...
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::append(char const*, unsigned long)", referenced from:
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::append(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in test-db2b03.o
reactphysics3d::FixedJoint::to_string() const in libreactphysics3d.a(FixedJoint.cpp.o)
reactphysics3d::Vector3::to_string() const in libreactphysics3d.a(FixedJoint.cpp.o)
reactphysics3d::Quaternion::to_string() const in libreactphysics3d.a(FixedJoint.cpp.o)
reactphysics3d::HingeJoint::to_string() const in libreactphysics3d.a(HingeJoint.cpp.o)
reactphysics3d::Vector3::to_string() const in libreactphysics3d.a(HingeJoint.cpp.o)
reactphysics3d::Quaternion::to_string() const in libreactphysics3d.a(HingeJoint.cpp.o)
...
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::insert(unsigned long, char const*)", referenced from:
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&&) in test-db2b03.o
reactphysics3d::FixedJoint::to_string() const in libreactphysics3d.a(FixedJoint.cpp.o)
reactphysics3d::Vector3::to_string() const in libreactphysics3d.a(FixedJoint.cpp.o)
reactphysics3d::Quaternion::to_string() const in libreactphysics3d.a(FixedJoint.cpp.o)
reactphysics3d::HingeJoint::to_string() const in libreactphysics3d.a(HingeJoint.cpp.o)
reactphysics3d::Vector3::to_string() const in libreactphysics3d.a(HingeJoint.cpp.o)
reactphysics3d::Quaternion::to_string() const in libreactphysics3d.a(HingeJoint.cpp.o)
...
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::resize(unsigned long, char)", referenced from:
std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >::overflow(int) in libreactphysics3d.a(ConcaveMeshShape.cpp.o)
and the last lines are
non-virtual thunk to std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_stringstream() in libreactphysics3d.a(ConcaveMeshShape.cpp.o)
virtual thunk to std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_stringstream() in libreactphysics3d.a(ConcaveMeshShape.cpp.o)
std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_stringstream() in libreactphysics3d.a(ConcaveMeshShape.cpp.o)
non-virtual thunk to std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_stringstream() in libreactphysics3d.a(ConcaveMeshShape.cpp.o)
virtual thunk to std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_stringstream() in libreactphysics3d.a(ConcaveMeshShape.cpp.o)
...
"std::__1::to_string(float)", referenced from:
reactphysics3d::SphereShape::to_string() const in test-db2b03.o
reactphysics3d::CapsuleShape::to_string() const in test-db2b03.o
reactphysics3d::SliderJoint::to_string() const in test-db2b03.o
reactphysics3d::HingeJoint::to_string() const in test-db2b03.o
reactphysics3d::Vector3::to_string() const in test-db2b03.o
reactphysics3d::Quaternion::to_string() const in test-db2b03.o
reactphysics3d::Vector3::to_string() const in libreactphysics3d.a(FixedJoint.cpp.o)
...
"std::terminate()", referenced from:
___clang_call_terminate in test-db2b03.o
___clang_call_terminate in libreactphysics3d.a(TriangleShape.cpp.o)
___clang_call_terminate in libreactphysics3d.a(ConcaveMeshShape.cpp.o)
___clang_call_terminate in libreactphysics3d.a(BoxShape.cpp.o)
___clang_call_terminate in libreactphysics3d.a(DynamicAABBTree.cpp.o)
___clang_call_terminate in libreactphysics3d.a(HalfEdgeStructure.cpp.o)
___clang_call_terminate in libreactphysics3d.a(mathematics_functions.cpp.o)
...
"typeinfo for std::__1::basic_istream<char, std::__1::char_traits<char> >", referenced from:
construction vtable for std::__1::basic_istream<char, std::__1::char_traits<char> >-in-std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libreactphysics3d.a(ConcaveMeshShape.cpp.o)
"typeinfo for std::__1::basic_ostream<char, std::__1::char_traits<char> >", referenced from:
construction vtable for std::__1::basic_ostream<char, std::__1::char_traits<char> >-in-std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libreactphysics3d.a(ConcaveMeshShape.cpp.o)
"typeinfo for std::__1::basic_iostream<char, std::__1::char_traits<char> >", referenced from:
construction vtable for std::__1::basic_iostream<char, std::__1::char_traits<char> >-in-std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libreactphysics3d.a(ConcaveMeshShape.cpp.o)
typeinfo for std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libreactphysics3d.a(ConcaveMeshShape.cpp.o)
"typeinfo for std::__1::basic_streambuf<char, std::__1::char_traits<char> >", referenced from:
typeinfo for std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libreactphysics3d.a(ConcaveMeshShape.cpp.o)
"typeinfo for std::runtime_error", referenced from:
reactphysics3d::HalfEdgeStructure::init() in libreactphysics3d.a(HalfEdgeStructure.cpp.o)
reactphysics3d::Map<reactphysics3d::Pair<unsigned int, unsigned int>, reactphysics3d::Pair<unsigned int, unsigned int> >::add(reactphysics3d::Pair<reactphysics3d::Pair<unsigned int, unsigned int>, reactphysics3d::Pair<unsigned int, unsigned int> > const&, bool) in libreactphysics3d.a(HalfEdgeStructure.cpp.o)
reactphysics3d::Map<reactphysics3d::Pair<unsigned int, unsigned int>, reactphysics3d::HalfEdgeStructure::Edge>::add(reactphysics3d::Pair<reactphysics3d::Pair<unsigned int, unsigned int>, reactphysics3d::HalfEdgeStructure::Edge> const&, bool) in libreactphysics3d.a(HalfEdgeStructure.cpp.o)
reactphysics3d::Map<reactphysics3d::Pair<unsigned int, unsigned int>, unsigned int>::add(reactphysics3d::Pair<reactphysics3d::Pair<unsigned int, unsigned int>, unsigned int> const&, bool) in libreactphysics3d.a(HalfEdgeStructure.cpp.o)
reactphysics3d::Map<unsigned int, reactphysics3d::Pair<unsigned int, unsigned int> >::add(reactphysics3d::Pair<unsigned int, reactphysics3d::Pair<unsigned int, unsigned int> > const&, bool) in libreactphysics3d.a(HalfEdgeStructure.cpp.o)
reactphysics3d::Map<reactphysics3d::Pair<unsigned int, unsigned int>, unsigned int>::operator[](reactphysics3d::Pair<unsigned int, unsigned int> const&) in libreactphysics3d.a(HalfEdgeStructure.cpp.o)
reactphysics3d::Map<reactphysics3d::Pair<unsigned int, unsigned int>, reactphysics3d::Pair<unsigned int, unsigned int> >::operator[](reactphysics3d::Pair<unsigned int, unsigned int> const&) in libreactphysics3d.a(HalfEdgeStructure.cpp.o)
...
"vtable for __cxxabiv1::__class_type_info", referenced from:
typeinfo for reactphysics3d::DynamicAABBTreeOverlapCallback in test-db2b03.o
typeinfo for reactphysics3d::Joint in test-db2b03.o
typeinfo for reactphysics3d::Joint in libreactphysics3d.a(FixedJoint.cpp.o)
typeinfo for reactphysics3d::Joint in libreactphysics3d.a(HingeJoint.cpp.o)
typeinfo for reactphysics3d::Joint in libreactphysics3d.a(SliderJoint.cpp.o)
typeinfo for reactphysics3d::Joint in libreactphysics3d.a(BallAndSocketJoint.cpp.o)
typeinfo for reactphysics3d::CollisionShape in libreactphysics3d.a(CollisionShape.cpp.o)
...
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
"vtable for __cxxabiv1::__si_class_type_info", referenced from:
typeinfo for reactphysics3d::ConvexShape in test-db2b03.o
typeinfo for reactphysics3d::ConvexPolyhedronShape in test-db2b03.o
typeinfo for reactphysics3d::BoxShape in test-db2b03.o
typeinfo for reactphysics3d::SphereShape in test-db2b03.o
typeinfo for reactphysics3d::CapsuleShape in test-db2b03.o
typeinfo for reactphysics3d::TriangleShape in test-db2b03.o
typeinfo for reactphysics3d::ConcaveShape in test-db2b03.o
...
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
"non-virtual thunk to std::__1::basic_iostream<char, std::__1::char_traits<char> >::~basic_iostream()", referenced from:
construction vtable for std::__1::basic_iostream<char, std::__1::char_traits<char> >-in-std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libreactphysics3d.a(ConcaveMeshShape.cpp.o)
"non-virtual thunk to std::__1::basic_iostream<char, std::__1::char_traits<char> >::~basic_iostream()", referenced from:
construction vtable for std::__1::basic_iostream<char, std::__1::char_traits<char> >-in-std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libreactphysics3d.a(ConcaveMeshShape.cpp.o)
"virtual thunk to std::__1::basic_istream<char, std::__1::char_traits<char> >::~basic_istream()", referenced from:
construction vtable for std::__1::basic_istream<char, std::__1::char_traits<char> >-in-std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libreactphysics3d.a(ConcaveMeshShape.cpp.o)
"virtual thunk to std::__1::basic_istream<char, std::__1::char_traits<char> >::~basic_istream()", referenced from:
construction vtable for std::__1::basic_istream<char, std::__1::char_traits<char> >-in-std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libreactphysics3d.a(ConcaveMeshShape.cpp.o)
"virtual thunk to std::__1::basic_ostream<char, std::__1::char_traits<char> >::~basic_ostream()", referenced from:
construction vtable for std::__1::basic_ostream<char, std::__1::char_traits<char> >-in-std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libreactphysics3d.a(ConcaveMeshShape.cpp.o)
"virtual thunk to std::__1::basic_ostream<char, std::__1::char_traits<char> >::~basic_ostream()", referenced from:
construction vtable for std::__1::basic_ostream<char, std::__1::char_traits<char> >-in-std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libreactphysics3d.a(ConcaveMeshShape.cpp.o)
"virtual thunk to std::__1::basic_iostream<char, std::__1::char_traits<char> >::~basic_iostream()", referenced from:
construction vtable for std::__1::basic_iostream<char, std::__1::char_traits<char> >-in-std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libreactphysics3d.a(ConcaveMeshShape.cpp.o)
"virtual thunk to std::__1::basic_iostream<char, std::__1::char_traits<char> >::~basic_iostream()", referenced from:
construction vtable for std::__1::basic_iostream<char, std::__1::char_traits<char> >-in-std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > in libreactphysics3d.a(ConcaveMeshShape.cpp.o)
"operator delete[](void*)", referenced from:
reactphysics3d::TriangleVertexArray::~TriangleVertexArray() in libreactphysics3d.a(TriangleVertexArray.cpp.o)
reactphysics3d::TriangleVertexArray::~TriangleVertexArray() in libreactphysics3d.a(TriangleVertexArray.cpp.o)
"operator delete(void*)", referenced from:
_main in test-db2b03.o
reactphysics3d::BoxShape::~BoxShape() in test-db2b03.o
reactphysics3d::SphereShape::~SphereShape() in test-db2b03.o
reactphysics3d::CapsuleShape::~CapsuleShape() in test-db2b03.o
reactphysics3d::TriangleShape::~TriangleShape() in test-db2b03.o
reactphysics3d::ConvexTriangleAABBOverlapCallback::~ConvexTriangleAABBOverlapCallback() in test-db2b03.o
reactphysics3d::BallAndSocketJoint::~BallAndSocketJoint() in test-db2b03.o
...
"operator new[](unsigned long)", referenced from:
reactphysics3d::TriangleVertexArray::computeVerticesNormals() in libreactphysics3d.a(TriangleVertexArray.cpp.o)
"operator new(unsigned long)", referenced from:
_main in test-db2b03.o
std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > std::__1::__pad_and_output<char, std::__1::char_traits<char> >(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >, char const*, char const*, char const*, std::__1::ios_base&, char) in libreactphysics3d.a(ConcaveMeshShape.cpp.o)
std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >::str() const in libreactphysics3d.a(ConcaveMeshShape.cpp.o)
"___cxa_allocate_exception", referenced from:
reactphysics3d::HalfEdgeStructure::init() in libreactphysics3d.a(HalfEdgeStructure.cpp.o)
reactphysics3d::Map<reactphysics3d::Pair<unsigned int, unsigned int>, reactphysics3d::Pair<unsigned int, unsigned int> >::add(reactphysics3d::Pair<reactphysics3d::Pair<unsigned int, unsigned int>, reactphysics3d::Pair<unsigned int, unsigned int> > const&, bool) in libreactphysics3d.a(HalfEdgeStructure.cpp.o)
reactphysics3d::Map<reactphysics3d::Pair<unsigned int, unsigned int>, reactphysics3d::HalfEdgeStructure::Edge>::add(reactphysics3d::Pair<reactphysics3d::Pair<unsigned int, unsigned int>, reactphysics3d::HalfEdgeStructure::Edge> const&, bool) in libreactphysics3d.a(HalfEdgeStructure.cpp.o)
reactphysics3d::Map<reactphysics3d::Pair<unsigned int, unsigned int>, unsigned int>::add(reactphysics3d::Pair<reactphysics3d::Pair<unsigned int, unsigned int>, unsigned int> const&, bool) in libreactphysics3d.a(HalfEdgeStructure.cpp.o)
reactphysics3d::Map<unsigned int, reactphysics3d::Pair<unsigned int, unsigned int> >::add(reactphysics3d::Pair<unsigned int, reactphysics3d::Pair<unsigned int, unsigned int> > const&, bool) in libreactphysics3d.a(HalfEdgeStructure.cpp.o)
reactphysics3d::Map<reactphysics3d::Pair<unsigned int, unsigned int>, unsigned int>::operator[](reactphysics3d::Pair<unsigned int, unsigned int> const&) in libreactphysics3d.a(HalfEdgeStructure.cpp.o)
reactphysics3d::Map<reactphysics3d::Pair<unsigned int, unsigned int>, reactphysics3d::Pair<unsigned int, unsigned int> >::operator[](reactphysics3d::Pair<unsigned int, unsigned int> const&) in libreactphysics3d.a(HalfEdgeStructure.cpp.o)
...
"___cxa_begin_catch", referenced from:
___clang_call_terminate in test-db2b03.o
___clang_call_terminate in libreactphysics3d.a(TriangleShape.cpp.o)
___clang_call_terminate in libreactphysics3d.a(ConcaveMeshShape.cpp.o)
std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >::overflow(int) in libreactphysics3d.a(ConcaveMeshShape.cpp.o)
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in libreactphysics3d.a(ConcaveMeshShape.cpp.o)
reactphysics3d::HalfEdgeStructure::Face* std::__1::uninitialized_copy<reactphysics3d::HalfEdgeStructure::Face*, reactphysics3d::HalfEdgeStructure::Face*>(reactphysics3d::HalfEdgeStructure::Face*, reactphysics3d::HalfEdgeStructure::Face*, reactphysics3d::HalfEdgeStructure::Face*) in libreactphysics3d.a(BoxShape.cpp.o)
___clang_call_terminate in libreactphysics3d.a(BoxShape.cpp.o)
...
"___cxa_end_catch", referenced from:
std::__1::basic_stringbuf<char, std::__1::char_traits<char>, std::__1::allocator<char> >::overflow(int) in libreactphysics3d.a(ConcaveMeshShape.cpp.o)
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in libreactphysics3d.a(ConcaveMeshShape.cpp.o)
reactphysics3d::HalfEdgeStructure::Face* std::__1::uninitialized_copy<reactphysics3d::HalfEdgeStructure::Face*, reactphysics3d::HalfEdgeStructure::Face*>(reactphysics3d::HalfEdgeStructure::Face*, reactphysics3d::HalfEdgeStructure::Face*, reactphysics3d::HalfEdgeStructure::Face*) in libreactphysics3d.a(BoxShape.cpp.o)
"___cxa_free_exception", referenced from:
reactphysics3d::HalfEdgeStructure::init() in libreactphysics3d.a(HalfEdgeStructure.cpp.o)
reactphysics3d::Map<reactphysics3d::Pair<unsigned int, unsigned int>, reactphysics3d::Pair<unsigned int, unsigned int> >::add(reactphysics3d::Pair<reactphysics3d::Pair<unsigned int, unsigned int>, reactphysics3d::Pair<unsigned int, unsigned int> > const&, bool) in libreactphysics3d.a(HalfEdgeStructure.cpp.o)
reactphysics3d::Map<reactphysics3d::Pair<unsigned int, unsigned int>, reactphysics3d::HalfEdgeStructure::Edge>::add(reactphysics3d::Pair<reactphysics3d::Pair<unsigned int, unsigned int>, reactphysics3d::HalfEdgeStructure::Edge> const&, bool) in libreactphysics3d.a(HalfEdgeStructure.cpp.o)
reactphysics3d::Map<reactphysics3d::Pair<unsigned int, unsigned int>, unsigned int>::add(reactphysics3d::Pair<reactphysics3d::Pair<unsigned int, unsigned int>, unsigned int> const&, bool) in libreactphysics3d.a(HalfEdgeStructure.cpp.o)
reactphysics3d::Map<unsigned int, reactphysics3d::Pair<unsigned int, unsigned int> >::add(reactphysics3d::Pair<unsigned int, reactphysics3d::Pair<unsigned int, unsigned int> > const&, bool) in libreactphysics3d.a(HalfEdgeStructure.cpp.o)
reactphysics3d::Map<reactphysics3d::Pair<unsigned int, unsigned int>, unsigned int>::operator[](reactphysics3d::Pair<unsigned int, unsigned int> const&) in libreactphysics3d.a(HalfEdgeStructure.cpp.o)
reactphysics3d::Map<reactphysics3d::Pair<unsigned int, unsigned int>, reactphysics3d::Pair<unsigned int, unsigned int> >::operator[](reactphysics3d::Pair<unsigned int, unsigned int> const&) in libreactphysics3d.a(HalfEdgeStructure.cpp.o)
...
"___cxa_pure_virtual", referenced from:
vtable for reactphysics3d::ConvexShape in test-db2b03.o
vtable for reactphysics3d::ConvexPolyhedronShape in test-db2b03.o
vtable for reactphysics3d::ConcaveShape in test-db2b03.o
vtable for reactphysics3d::CollisionShape in libreactphysics3d.a(CollisionShape.cpp.o)
vtable for reactphysics3d::ConvexShape in libreactphysics3d.a(ConvexShape.cpp.o)
vtable for reactphysics3d::ConcaveShape in libreactphysics3d.a(ConcaveShape.cpp.o)
vtable for reactphysics3d::ConvexPolyhedronShape in libreactphysics3d.a(ConvexPolyhedronShape.cpp.o)
...
"___cxa_rethrow", referenced from:
reactphysics3d::HalfEdgeStructure::Face* std::__1::uninitialized_copy<reactphysics3d::HalfEdgeStructure::Face*, reactphysics3d::HalfEdgeStructure::Face*>(reactphysics3d::HalfEdgeStructure::Face*, reactphysics3d::HalfEdgeStructure::Face*, reactphysics3d::HalfEdgeStructure::Face*) in libreactphysics3d.a(BoxShape.cpp.o)
"___cxa_throw", referenced from:
reactphysics3d::HalfEdgeStructure::init() in libreactphysics3d.a(HalfEdgeStructure.cpp.o)
reactphysics3d::Map<reactphysics3d::Pair<unsigned int, unsigned int>, reactphysics3d::Pair<unsigned int, unsigned int> >::add(reactphysics3d::Pair<reactphysics3d::Pair<unsigned int, unsigned int>, reactphysics3d::Pair<unsigned int, unsigned int> > const&, bool) in libreactphysics3d.a(HalfEdgeStructure.cpp.o)
reactphysics3d::Map<reactphysics3d::Pair<unsigned int, unsigned int>, reactphysics3d::HalfEdgeStructure::Edge>::add(reactphysics3d::Pair<reactphysics3d::Pair<unsigned int, unsigned int>, reactphysics3d::HalfEdgeStructure::Edge> const&, bool) in libreactphysics3d.a(HalfEdgeStructure.cpp.o)
reactphysics3d::Map<reactphysics3d::Pair<unsigned int, unsigned int>, unsigned int>::add(reactphysics3d::Pair<reactphysics3d::Pair<unsigned int, unsigned int>, unsigned int> const&, bool) in libreactphysics3d.a(HalfEdgeStructure.cpp.o)
reactphysics3d::Map<unsigned int, reactphysics3d::Pair<unsigned int, unsigned int> >::add(reactphysics3d::Pair<unsigned int, reactphysics3d::Pair<unsigned int, unsigned int> > const&, bool) in libreactphysics3d.a(HalfEdgeStructure.cpp.o)
reactphysics3d::Map<reactphysics3d::Pair<unsigned int, unsigned int>, unsigned int>::operator[](reactphysics3d::Pair<unsigned int, unsigned int> const&) in libreactphysics3d.a(HalfEdgeStructure.cpp.o)
reactphysics3d::Map<reactphysics3d::Pair<unsigned int, unsigned int>, reactphysics3d::Pair<unsigned int, unsigned int> >::operator[](reactphysics3d::Pair<unsigned int, unsigned int> const&) in libreactphysics3d.a(HalfEdgeStructure.cpp.o)
...
"___gxx_personality_v0", referenced from:
_main in test-db2b03.o
reactphysics3d::BoxShape::to_string() const in test-db2b03.o
reactphysics3d::SphereShape::to_string() const in test-db2b03.o
reactphysics3d::CapsuleShape::to_string() const in test-db2b03.o
reactphysics3d::TriangleShape::to_string() const in test-db2b03.o
reactphysics3d::BallAndSocketJoint::to_string() const in test-db2b03.o
reactphysics3d::SliderJoint::to_string() const in test-db2b03.o
...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I feel very uncomfortable with compiling c/c++ project with gcc/g++ compiler.
Could you help me to figure the problem?
Thank you.
There are two mistakes in your commandline:
gcc -std=c++11 -Ireactphysics3d/src -Llib -lreactphysics3d -o myapp test.cpp ./lib/libreactphysics3d.a
one of which is responsible for all the undefined reference linkage errors you have actually posted
(although possibly not responsible for other linkage errors that we cannot see).
That mistake is that you are attempting to link an application containing compiled C++ using the
GCC C frontend (gcc), instead of the C++ frontend (g++).
Compiled C++ will typically make references to symbols that are defined in the standard C++ library.
Yours does so. So your program must be linked with the standard C++ library. g++ adds the
standard C library and the standard C++ library to the linkage automatically. gcc adds only
the standard C library. That is the difference between the two frontends. So your linkage
fails because references to symbols defined by the standard C++ library are not resolved. To
fix this, replace gcc with g++ in your commandline.
The other mistake - although it is innocuous in this case - is that the commandline:
g++ -std=c++11 -Ireactphysics3d/src -Llib -lreactphysics3d -o myapp test.cpp
would be an example of Your linkage consumes libraries before the object files that refer to them,
which is yet another routine cause of linkage failures for undefined references.
Libraries must appear in the linkage sequence after the files that depend on them.
The only reason that your linkage does not exhibit additional undefined reference errors on that
score is that in your actual commandline, having placed -lreactphysics3d first in the
linkage sequence, where it has no effect, you then add the same library again to the linkage
sequence, by name - ./lib/libreactphysics3d.a - after the file that depends on it, where
it is effective. To get rid of this redundancy, use either the more conventional:
g++ -std=c++11 -Ireactphysics3d/src -o myapp test.cpp -Llib -lreactphysics3d
or the less conventional:
g++ -std=c++11 -Ireactphysics3d/src -o myapp test.cpp ./lib/libreactphysics3d.a
Related
unordered_map insert not using move operation
I am trying to insert element to unordered_map, which should use move operations, but its not using. For example: #include <unordered_map> #include <memory> #include <utility> struct S { int i; }; int main(){ std::unordered_map<int, std::unique_ptr<S>> map {}; std::unique_ptr<S> s {new S{1}}; map.insert({1, std::move(s)}); return 0; } Compiling it as: g++-6 -std=c++11 -c Ex2.cpp Getting error: In file included from /usr/include/x86_64-linux-gnu/c++/6/bits/c++allocator.h:33:0, from /usr/include/c++/6/bits/allocator.h:46, from /usr/include/c++/6/string:41, from /usr/include/c++/6/stdexcept:39, from /usr/include/c++/6/array:39, from /usr/include/c++/6/tuple:39, from /usr/include/c++/6/unordered_map:41, from Ex2.cpp:1: /usr/include/c++/6/ext/new_allocator.h: In instantiation of ‘void __gnu_cxx::new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = std::pair<const int, std::unique_ptr<S> >; _Args = {const std::pair<const int, std::unique_ptr<S, std::default_delete<S> > >&}; _Tp = std::pair<const int, std::unique_ptr<S> >]’: /usr/include/c++/6/bits/alloc_traits.h:455:4: required from ‘static void std::allocator_traits<std::allocator<_CharT> >::construct(std::allocator_traits<std::allocator<_CharT> >::allocator_type&, _Up*, _Args&& ...) [with _Up = std::pair<const int, std::unique_ptr<S> >; _Args = {const std::pair<const int, std::unique_ptr<S, std::default_delete<S> > >&}; _Tp = std::pair<const int, std::unique_ptr<S> >; std::allocator_traits<std::allocator<_CharT> >::allocator_type = std::allocator<std::pair<const int, std::unique_ptr<S> > >]’ /usr/include/c++/6/bits/hashtable_policy.h:1953:37: required from ‘std::__detail::_Hashtable_alloc<_NodeAlloc>::__node_type* std::__detail::_Hashtable_alloc<_NodeAlloc>::_M_allocate_node(_Args&& ...) [with _Args = {const std::pair<const int, std::unique_ptr<S, std::default_delete<S> > >&}; _NodeAlloc = std::allocator<std::__detail::_Hash_node<std::pair<const int, std::unique_ptr<S> >, false> >; std::__detail::_Hashtable_alloc<_NodeAlloc>::__node_type = std::__detail::_Hash_node<std::pair<const int, std::unique_ptr<S> >, false>]’ /usr/include/c++/6/bits/hashtable_policy.h:180:58: required from ‘std::__detail::_AllocNode<_NodeAlloc>::__node_type* std::__detail::_AllocNode<_NodeAlloc>::operator()(_Arg&&) const [with _Arg = const std::pair<const int, std::unique_ptr<S> >&; _NodeAlloc = std::allocator<std::__detail::_Hash_node<std::pair<const int, std::unique_ptr<S> >, false> >; std::__detail::_AllocNode<_NodeAlloc>::__node_type = std::__detail::_Hash_node<std::pair<const int, std::unique_ptr<S> >, false>]’ /usr/include/c++/6/bits/hashtable.h:1690:18: required from ‘std::pair<typename std::__detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _H1, _H2, _Hash, _Traits>::iterator, bool> std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::_M_insert(_Arg&&, const _NodeGenerator&, std::true_type) [with _Arg = const std::pair<const int, std::unique_ptr<S> >&; _NodeGenerator = std::__detail::_AllocNode<std::allocator<std::__detail::_Hash_node<std::pair<const int, std::unique_ptr<S> >, false> > >; _Key = int; _Value = std::pair<const int, std::unique_ptr<S> >; _Alloc = std::allocator<std::pair<const int, std::unique_ptr<S> > >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<int>; _H1 = std::hash<int>; _H2 = std::__detail::_Mod_range_hashing; _Hash = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<false, false, true>; typename std::__detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _H1, _H2, _Hash, _Traits>::iterator = std::__detail::_Node_iterator<std::pair<const int, std::unique_ptr<S> >, false, false>; std::true_type = std::integral_constant<bool, true>]’ /usr/include/c++/6/bits/hashtable_policy.h:713:55: required from ‘std::__detail::_Insert_base<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::__ireturn_type std::__detail::_Insert_base<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::insert(const value_type&) [with _Key = int; _Value = std::pair<const int, std::unique_ptr<S> >; _Alloc = std::allocator<std::pair<const int, std::unique_ptr<S> > >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<int>; _H1 = std::hash<int>; _H2 = std::__detail::_Mod_range_hashing; _Hash = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<false, false, true>; std::__detail::_Insert_base<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::__ireturn_type = std::pair<std::__detail::_Node_iterator<std::pair<const int, std::unique_ptr<S> >, false, false>, bool>; std::__detail::_Insert_base<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::value_type = std::pair<const int, std::unique_ptr<S> >]’ /usr/include/c++/6/bits/unordered_map.h:550:31: required from ‘std::pair<typename std::_Hashtable<_Key, std::pair<const _Key, _Tp>, _Alloc, std::__detail::_Select1st, _Pred, _Hash, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<std::__not_<std::__and_<std::__is_fast_hash<_Hash>, std::__detail::__is_noexcept_hash<_Key, _Hash> > >::value, false, true> >::iterator, bool> std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(const value_type&) [with _Key = int; _Tp = std::unique_ptr<S>; _Hash = std::hash<int>; _Pred = std::equal_to<int>; _Alloc = std::allocator<std::pair<const int, std::unique_ptr<S> > >; typename std::_Hashtable<_Key, std::pair<const _Key, _Tp>, _Alloc, std::__detail::_Select1st, _Pred, _Hash, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<std::__not_<std::__and_<std::__is_fast_hash<_Hash>, std::__detail::__is_noexcept_hash<_Key, _Hash> > >::value, false, true> >::iterator = std::__detail::_Node_iterator<std::pair<const int, std::unique_ptr<S> >, false, false>; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::value_type = std::pair<const int, std::unique_ptr<S> >]’ Ex2.cpp:14:30: required from here /usr/include/c++/6/ext/new_allocator.h:120:4: error: use of deleted function ‘constexpr std::pair<_T1, _T2>::pair(const std::pair<_T1, _T2>&) [with _T1 = const int; _T2 = std::unique_ptr<S>]’ { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); } ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/6/utility:70:0, from /usr/include/c++/6/unordered_map:38, from Ex2.cpp:1: /usr/include/c++/6/bits/stl_pair.h:224:17: note: ‘constexpr std::pair<_T1, _T2>::pair(const std::pair<_T1, _T2>&) [with _T1 = const int; _T2 = std::unique_ptr<S>]’ is implicitly deleted because the default definition would be ill-formed: constexpr pair(const pair&) = default; ^~~~ /usr/include/c++/6/bits/stl_pair.h:224:17: error: use of deleted function ‘std::unique_ptr<_Tp, _Dp>::unique_ptr(const std::unique_ptr<_Tp, _Dp>&) [with _Tp = S; _Dp = std::default_delete<S>]’ In file included from /usr/include/c++/6/memory:81:0, from Ex2.cpp:2: /usr/include/c++/6/bits/unique_ptr.h:356:7: note: declared here unique_ptr(const unique_ptr&) = delete; ^~~~~~~~~~ So, error seems telling me that I am using deleted copy constructor of std::pair, which is deleted because std::unique_ptr doesn't have copy constructor. BUT why its not using move constructor? It compiles fine in my visual studio 2017. I am using g++ compiler version: gcc version 6.2.0 20160901
C++: Error retrieving STL map from another map
I have the following piece of code - #include <map> using Type1 = std::map<std::string, unsigned long long>; using Type2 = std::map<std::string, Type1>; class T { private: Type2 mymap; public: const Type1& get(const std::string& key) const; }; const Type1& T::get(const std::string& key) const { return mymap[key]; } int main(void) { } This does not compile and the compiler complains - maps.cpp: In member function ‘const Type1& T::get(const string&) const’: maps.cpp:17:20: error: passing ‘const Type2 {aka const std::map<std::basic_string<char>, std::map<std::basic_string<char>, long long unsigned int> >}’ as ‘this’ argument of ‘std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = std::basic_string<char>; _Tp = std::map<std::basic_string<char>, long long unsigned int>; _Compare = std::less<std::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::basic_string<char>, std::map<std::basic_string<char>, long long unsigned int> > >; std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type = std::map<std::basic_string<char>, long long unsigned int>; std::map<_Key, _Tp, _Compare, _Alloc>::key_type = std::basic_string<char>]’ discards qualifiers [-fpermissive] return mymap[key]; ^ I need help understanding this error. From what I can tell I am not modifying "this" in the get function. Thanks!
The errors comes from the fact that std::map::operator[] can inserts the key if the it does not exist. You could do a std::map::find first as a check.
Setting up a static template data member in an include file in a DLL
I have multiple in-memory data dictionaries that I have to keep track of so I'm trying to set up an interface with the following code in an include file in a DLL: LinkData.hpp #pragma once #include <string> #include <map> #ifdef LINKDATA_EXPORTS #define API /*__declspec(dllexport) */ #else #define API /*__declspec(dllimport) */ #endif template <typename T> class LinkDataFactory { public: static API T Get(std::string key) { return _data[key]; } template <typename T> static API void Set(std::string key, T value) { _data[key] = value; } private: API static std::map<std::string, T > _data; }; The API macro is undefined because it's my understanding that the template class resides in an include file and will be instantiated at compile time. I try to use the static class with the following code: #include "LinkData.hpp" //... LinkDataFactory<std::string>::Set(key, data); The compile fails with the error: error LNK2001: unresolved external symbol "public: static class std::map< class std::basic_string<char,struct std::char_traits<char>, class std::allocator<char> >, class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >, struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >, class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const , class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > > LinkDataFactory< class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > Defining the API macros gets the error: error C2491: 'LinkDataFactory<T>::Set' : definition of dllimport function not allowed What's going on? Is what I'm trying even possible?
mkvtoolnix build failing with "Undefined symbols for architecture x86_64" on Mac OS 10.8
I'm trying to compile mkvtoolnix from source on Mountain Lion (Mac OS 10.8). I believe all prerequisites are installed, as ./configure works. I did have to change my ./configure command line, though: ./configure ZLIB_CFLAGS="-l/usr/lib/libz.dylib" ZLIB_LIBS="-L/usr/lib" \ CURL_CFLAGS="-l/usr/lib/libcurl.dylib" CURL_LIBS="-L/usr/lib" Then I run rake and everything compiles until the very end, where I get this message: LINK src/mkvmerge Undefined symbols for architecture x86_64: "libmatroska::KaxCueDuration::ClassInfos", referenced from: cluster_helper_c::postprocess_cues() in libmtxmerge.a(cluster_helper.o) "libmatroska::KaxCueRelativePosition::ClassInfos", referenced from: cluster_helper_c::postprocess_cues() in libmtxmerge.a(cluster_helper.o) "libebml::EbmlString::SetValue(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from: void FixMandatoryElement<libmatroska::KaxTagName, libmatroska::KaxTagLangue, libmatroska::KaxTagDefault>(libebml::EbmlMaster*) in libmtxcommon.a(tags.o) mtx::xml::ebml_converter_c::parse_string(mtx::xml::ebml_converter_c::parser_context_t&) in libmtxcommon.a(ebml_converter.o) mtx::xml::ebml_chapters_converter_c::fix_display(libmatroska::KaxChapterDisplay&) const in libmtxcommon.a(ebml_chapters_converter.o) "libebml::EbmlSInteger::SetValue(long long)", referenced from: kax_reference_block_c::UpdateSize(bool, bool) in libmtxmerge.a(libmatroska_extensions.o) mtx::xml::ebml_converter_c::parse_int(mtx::xml::ebml_converter_c::parser_context_t&) in libmtxcommon.a(ebml_converter.o) "libebml::EbmlUInteger::SetValue(unsigned long long)", referenced from: adjust_chapter_timecodes(libebml::EbmlMaster&, long long) in libmtxcommon.a(chapters.o) remove_entries(long long, long long, long long, libebml::EbmlMaster&) in libmtxcommon.a(chapters.o) cluster_helper_c::postprocess_cues() in libmtxmerge.a(cluster_helper.o) fix_mandatory_tag_elements(libebml::EbmlElement*) in libmtxcommon.a(tags.o) void FixMandatoryElement<libmatroska::KaxTagName, libmatroska::KaxTagLangue, libmatroska::KaxTagDefault>(libebml::EbmlMaster*) in libmtxcommon.a(tags.o) mtx::xml::ebml_chapters_converter_c::fix_atom(libmatroska::KaxChapterAtom&) const in libmtxcommon.a(ebml_chapters_converter.o) mtx::xml::ebml_chapters_converter_c::fix_edition_entry(libmatroska::KaxEditionEntry&) const in libmtxcommon.a(ebml_chapters_converter.o) ... "libebml::EbmlUnicodeString::SetValueUTF8(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from: set_simple_tag_name(libmatroska::KaxTagSimple&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in libmtxcommon.a(tags.o) set_simple_tag_value(libmatroska::KaxTagSimple&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in libmtxcommon.a(tags.o) set_simple_tag(libmatroska::KaxTagSimple&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in libmtxcommon.a(tags.o) convert_old_tags(libmatroska::KaxTags&) in libmtxcommon.a(tags.o) mtx::xml::ebml_converter_c::parse_ustring(mtx::xml::ebml_converter_c::parser_context_t&) in libmtxcommon.a(ebml_converter.o) "libebml::EbmlUnicodeString::SetValue(libebml::UTFstring const&)", referenced from: void FixMandatoryElement<libmatroska::KaxTagName, libmatroska::KaxTagLangue, libmatroska::KaxTagDefault>(libebml::EbmlMaster*) in libmtxcommon.a(tags.o) "libebml::EbmlString::GetValue() const", referenced from: kt_get_codec_id(libmatroska::KaxTrackEntry&) in libmtxcommon.a(ebml.o) kt_get_language(libmatroska::KaxTrackEntry&) in libmtxcommon.a(ebml.o) dump_ebml_elements(libebml::EbmlElement*, bool, unsigned int) in libmtxcommon.a(output.o) void FixMandatoryElement<libmatroska::KaxTagName, libmatroska::KaxTagLangue, libmatroska::KaxTagDefault>(libebml::EbmlMaster*) in libmtxcommon.a(tags.o) kax_reader_c::read_headers_tracks(mm_io_c*, libebml::EbmlElement*, long long) in libmtxinput.a(r_matroska.o) kax_reader_c::handle_attachments(mm_io_c*, libebml::EbmlElement*, long long) in libmtxinput.a(r_matroska.o) mtx::xml::ebml_converter_c::format_string(pugi::xml_node&, libebml::EbmlElement&) in libmtxcommon.a(ebml_converter.o) ... "libebml::EbmlSInteger::GetValue() const", referenced from: dump_ebml_elements(libebml::EbmlElement*, bool, unsigned int) in libmtxcommon.a(output.o) kax_reader_c::process_block_group(libmatroska::KaxCluster*, libmatroska::KaxBlockGroup*) in libmtxinput.a(r_matroska.o) mtx::xml::ebml_converter_c::format_int(pugi::xml_node&, libebml::EbmlElement&) in libmtxcommon.a(ebml_converter.o) "libebml::EbmlUInteger::GetValue() const", referenced from: get_chapter_start(libmatroska::KaxChapterAtom&, long long) in libmtxcommon.a(chapters.o) get_chapter_end(libmatroska::KaxChapterAtom&, long long) in libmtxcommon.a(chapters.o) get_chapter_uid(libmatroska::KaxChapterAtom&) in libmtxcommon.a(chapters.o) find_edition_with_uid(libmatroska::KaxChapters&, unsigned long long) in libmtxcommon.a(chapters.o) find_chapter_with_uid(libmatroska::KaxChapters&, unsigned long long) in libmtxcommon.a(chapters.o) move_chapters_by_edition(libmatroska::KaxChapters&, libmatroska::KaxChapters&) in libmtxcommon.a(chapters.o) adjust_chapter_timecodes(libebml::EbmlMaster&, long long) in libmtxcommon.a(chapters.o) ... "libebml::EbmlUnicodeString::GetValueUTF8() const", referenced from: dump_ebml_elements(libebml::EbmlElement*, bool, unsigned int) in libmtxcommon.a(output.o) get_simple_tag_value(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, libebml::EbmlMaster&) in libmtxcommon.a(tags.o) get_simple_tag_name(libmatroska::KaxTagSimple const&) in libmtxcommon.a(tags.o) get_simple_tag_value(libmatroska::KaxTagSimple const&) in libmtxcommon.a(tags.o) convert_old_tags(libmatroska::KaxTags&) in libmtxcommon.a(tags.o) kax_reader_c::read_headers_info(libebml::EbmlElement*&, libebml::EbmlElement*&, int&) in libmtxinput.a(r_matroska.o) kax_reader_c::read_headers_info_writing_app(libmatroska::KaxWritingApp*&) in libmtxinput.a(r_matroska.o) ... "libebml::EbmlUnicodeString::GetValue() const", referenced from: void FixMandatoryElement<libmatroska::KaxTagName, libmatroska::KaxTagLangue, libmatroska::KaxTagDefault>(libebml::EbmlMaster*) in libmtxcommon.a(tags.o) kax_reader_c::read_headers_info(libebml::EbmlElement*&, libebml::EbmlElement*&, int&) in libmtxinput.a(r_matroska.o) kax_reader_c::read_headers_tracks(mm_io_c*, libebml::EbmlElement*, long long) in libmtxinput.a(r_matroska.o) kax_reader_c::handle_attachments(mm_io_c*, libebml::EbmlElement*, long long) in libmtxinput.a(r_matroska.o) "libebml::EbmlFloat::GetValue() const", referenced from: kt_get_a_sfreq(libmatroska::KaxTrackEntry&) in libmtxcommon.a(ebml.o) kt_get_a_osfreq(libmatroska::KaxTrackEntry&) in libmtxcommon.a(ebml.o) dump_ebml_elements(libebml::EbmlElement*, bool, unsigned int) in libmtxcommon.a(output.o) kax_reader_c::read_headers_track_audio(kax_track_t*, libmatroska::KaxTrackAudio*) in libmtxinput.a(r_matroska.o) kax_reader_c::read_headers_track_video(kax_track_t*, libmatroska::KaxTrackVideo*) in libmtxinput.a(r_matroska.o) kax_reader_c::read_headers_info(libebml::EbmlElement*&, libebml::EbmlElement*&, int&) in libmtxinput.a(r_matroska.o) "std::ctype<char>::_M_widen_init() const", referenced from: __gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > boost::io::detail::skip_asterisk<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::ctype<char> >(__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::ctype<char> const&) in mkvmerge.o bool boost::io::detail::parse_printf_directive<char, std::char_traits<char>, std::allocator<char>, __gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::ctype<char> >(__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >&, __gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > const&, boost::io::detail::format_item<char, std::char_traits<char>, std::allocator<char> >*, std::ctype<char> const&, unsigned long, unsigned char) in mkvmerge.o boost::io::detail::stream_format_state<char, std::char_traits<char> >::apply_on(std::basic_ios<char, std::char_traits<char> >&, std::locale*) const in mkvmerge.o void boost::io::detail::put<char, std::char_traits<char>, std::allocator<char>, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&>(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, boost::io::detail::format_item<char, std::char_traits<char>, std::allocator<char> > const&, boost::basic_format<char, std::char_traits<char>, std::allocator<char> >::string_type&, boost::basic_format<char, std::char_traits<char>, std::allocator<char> >::internal_streambuf_t&, std::locale*) in mkvmerge.o void boost::io::detail::put<char, std::char_traits<char>, std::allocator<char>, unsigned int const&>(unsigned int const&, boost::io::detail::format_item<char, std::char_traits<char>, std::allocator<char> > const&, boost::basic_format<char, std::char_traits<char>, std::allocator<char> >::string_type&, boost::basic_format<char, std::char_traits<char>, std::allocator<char> >::internal_streambuf_t&, std::locale*) in mkvmerge.o void boost::io::detail::put<char, std::char_traits<char>, std::allocator<char>, char const*&>(char const*&, boost::io::detail::format_item<char, std::char_traits<char>, std::allocator<char> > const&, boost::basic_format<char, std::char_traits<char>, std::allocator<char> >::string_type&, boost::basic_format<char, std::char_traits<char>, std::allocator<char> >::internal_streambuf_t&, std::locale*) in mkvmerge.o void boost::io::detail::put<char, std::char_traits<char>, std::allocator<char>, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, boost::io::detail::format_item<char, std::char_traits<char>, std::allocator<char> > const&, boost::basic_format<char, std::char_traits<char>, std::allocator<char> >::string_type&, boost::basic_format<char, std::char_traits<char>, std::allocator<char> >::internal_streambuf_t&, std::locale*) in mkvmerge.o ... "std::domain_error::~domain_error()", referenced from: boost::bad_rational::~bad_rational() in libmtxcommon.a(mpeg4_p10.o) boost::bad_rational::~bad_rational() in libmtxcommon.a(mpeg4_p10.o) "std::__detail::__prime_list", referenced from: __GLOBAL__sub_I_output_control.cpp in libmtxmerge.a(output_control.o) std::__detail::_Prime_rehash_policy::_M_next_bkt(unsigned long) const in libmtxmerge.a(pr_generic.o) std::__detail::_Prime_rehash_policy::_M_next_bkt(unsigned long) const in libmtxmerge.a(cluster_helper.o) "std::__detail::_List_node_base::_M_hook(std::__detail::_List_node_base*)", referenced from: qtmp4_reader_c::detect_interleaving() in libmtxinput.a(r_qtmp4.o) M2VParser::AddTimecode(long long) in libmpegparser.a(M2VParser.o) "std::__detail::_List_node_base::_M_unhook()", referenced from: M2VParser::FlushWaitQueue() in libmpegparser.a(M2VParser.o) M2VParser::StampFrame(MPEGFrame*) in libmpegparser.a(M2VParser.o) "std::__throw_bad_function_call()", referenced from: at_scope_exit_c::~at_scope_exit_c() in mkvmerge.o bool parse_number<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >(boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, double&) in mkvmerge.o mxinfo(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in libmtxcommon.a(output.o) mxinfo(std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&) in libmtxcommon.a(output.o) mxwarn(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in libmtxcommon.a(output.o) mxerror(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in libmtxcommon.a(output.o) mxinfo(boost::basic_format<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&) in libmtxcommon.a(output.o) ... "_curl_easy_cleanup", referenced from: url_retriever_c::retrieve(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&) in libmtxcommon.a(curl.o) "_curl_easy_init", referenced from: url_retriever_c::retrieve(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&) in libmtxcommon.a(curl.o) "_curl_easy_perform", referenced from: url_retriever_c::retrieve(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&) in libmtxcommon.a(curl.o) "_curl_easy_setopt", referenced from: url_retriever_c::retrieve(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&) in libmtxcommon.a(curl.o) "_curl_global_init", referenced from: url_retriever_c::retrieve(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&) in libmtxcommon.a(curl.o) ld: symbol(s) not found for architecture x86_64 collect2: error: ld returned 1 exit status Not really sure what to do here. Any suggestions?
Compile test program with wxWidgets in MAC
OS: MAC X 10.7.0 The Mac OS X install an older version of wxMac(wxMac-2.8.8.1) in /usr, but I install a newer one(wxMac-2.8.12.0) in /usr/local. To install it, I compile the new one with the flag: arch_flags="-arch i386" ./configure CFLAGS="$arch_flags" CXXFLAGS="$arch_flags" CPPFLAGS="$arch_flags" LDFLAGS="$arch_flags" OBJCFLAGS="$arch_flags" OBJCXXFLAGS="$arch_flags" --enable-unicode --enable-debug --disable-shared Then I write a simple program(hello2.cpp) to test it: #include "wx/wx.h" class HelloWorldApp : public wxApp { public: virtual bool OnInit(); private: wxButton *button; }; IMPLEMENT_APP(HelloWorldApp) bool HelloWorldApp::OnInit() { wxFrame *frame = new wxFrame((wxFrame*) NULL, -1, _T("Hello wxWidgets World")); frame->CreateStatusBar(); frame->SetStatusText(_T("Hello World")); button = new wxButton((wxFrame *)frame, -2, _T("123")); frame->Show(TRUE); SetTopWindow(frame); return true; } I compile this test program in the command line with the flag: g++ hello2.cpp /usr/local/bin/wx-config --cxxflags --libs -o hello2 But I receive some warnings and errors. I am a newbie in Mac programming, so I don't know the reason. I just have to say: help! Here is the result of compiling: ld: warning: in /usr/local/lib/libiconv.dylib, file was built for unsupported file format which is not the architecture being linked (i386) Undefined symbols: "_libiconv_open", referenced from: wxMBConv_iconv::wxMBConv_iconv(wchar_t const*)in libwx_base_carbonud-2.8.a(baselib_strconv.o) wxMBConv_iconv::wxMBConv_iconv(wchar_t const*)in libwx_base_carbonud-2.8.a(baselib_strconv.o) wxMBConv_iconv::wxMBConv_iconv(wchar_t const*)in libwx_base_carbonud-2.8.a(baselib_strconv.o) wxMBConv_iconv::wxMBConv_iconv(wchar_t const*)in libwx_base_carbonud-2.8.a(baselib_strconv.o) wxMBConv_iconv::wxMBConv_iconv(wchar_t const*)in libwx_base_carbonud-2.8.a(baselib_strconv.o) wxMBConv_iconv::wxMBConv_iconv(wchar_t const*)in libwx_base_carbonud-2.8.a(baselib_strconv.o) wxMBConv_iconv::wxMBConv_iconv(wchar_t const*)in libwx_base_carbonud-2.8.a(baselib_strconv.o) wxMBConv_iconv::wxMBConv_iconv(wchar_t const*)in libwx_base_carbonud-2.8.a(baselib_strconv.o) "_libiconv", referenced from: wxMBConv_iconv::GetMBNulLen() const in libwx_base_carbonud-2.8.a(baselib_strconv.o) wxMBConv_iconv::WC2MB(char*, wchar_t const*, unsigned long) constin libwx_base_carbonud-2.8.a(baselib_strconv.o) wxMBConv_iconv::WC2MB(char*, wchar_t const*, unsigned long) constin libwx_base_carbonud-2.8.a(baselib_strconv.o) wxMBConv_iconv::MB2WC(wchar_t*, char const*, unsigned long) constin libwx_base_carbonud-2.8.a(baselib_strconv.o) wxMBConv_iconv::MB2WC(wchar_t*, char const*, unsigned long) constin libwx_base_carbonud-2.8.a(baselib_strconv.o) wxMBConv_iconv::wxMBConv_iconv(wchar_t const*)in libwx_base_carbonud-2.8.a(baselib_strconv.o) wxMBConv_iconv::wxMBConv_iconv(wchar_t const*)in libwx_base_carbonud-2.8.a(baselib_strconv.o) "_libiconv_close", referenced from: wxMBConv_iconv::~wxMBConv_iconv()in libwx_base_carbonud-2.8.a(baselib_strconv.o) wxMBConv_iconv::~wxMBConv_iconv()in libwx_base_carbonud-2.8.a(baselib_strconv.o) wxMBConv_iconv::~wxMBConv_iconv()in libwx_base_carbonud-2.8.a(baselib_strconv.o) wxMBConv_iconv::~wxMBConv_iconv()in libwx_base_carbonud-2.8.a(baselib_strconv.o) wxMBConv_iconv::~wxMBConv_iconv()in libwx_base_carbonud-2.8.a(baselib_strconv.o) wxMBConv_iconv::~wxMBConv_iconv()in libwx_base_carbonud-2.8.a(baselib_strconv.o) ld: symbol(s) not found collect2: ld returned 1 exit status
I uninstall wxMac-2.8.12. I installl wxWidgets-2.9.2(./configure --enable-unicode --enable-debug --disable-shared) I compile the test program with g++ hello2.cpp `/usr/local/bin/wx-config --cxxflags --libs` -o hello2 again. There only one warning: ld: warning: in /System/Library/Frameworks//QuickTime.framework/QuickTime, missing required architecture x86_64 in file I think that's OK.