Compile test program with wxWidgets in MAC - macos

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.

Related

How do I compile my application with static library?

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

QtMac::toNSImage Undefined symbols for architecture x86_64

I am trying to use notifications in a Qt application on Mac.
Here is part of my class
#include <Cocoa/Cocoa.h>
#include <QtMacExtras/QtMac>
#include <objc/objc.h>
#include <QString>
#include <QPixmap>
void QgsMacNative::showDesktopNotification( const QString &summary,
const QString &body,
const QgsNative::NotificationSettings &settings )
{
NSUserNotification *notification = [[NSUserNotification alloc] init];
notification.title = summary.toNSString();
notification.informativeText = body.toNSString();
notification.soundName = NSUserNotificationDefaultSoundName; //Will play a default sound
notification.contentImage = QtMac::toNSImage( QPixmap::fromImage( settings.image ) );
[[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification: notification];
[notification autorelease];
}
Here is the error message I get:
Undefined symbols for architecture x86_64:
"QtMac::toNSImage(QPixmap const&)", referenced from:
QgsMacNative::showDesktopNotification(QString const&, QString const&, QgsNative::NotificationSettings const&) in qgsmacnative.mm.o
ld: symbol(s) not found for architecture x86_64
Any idea what's going on?
Finally found it.
In CMakeLists.txt, I had
FIND_PACKAGE(Qt5MacExtras)
but was missing
TARGET_LINK_LIBRARIES(qgis_native Qt5::MacExtras)
In my case, I was missing QT += entries in my .pro file.
Example:
QT += widgets core gui
Should have been:
QT += widgets core macextras gui

Error LNK2019 unresolved external symbol _cmd_ln_init referenced in function _main

I am trying to run my code using the library pocketsphinx. Even though I have used the .lib files for the library it still isn't working. My code:
#include "stdafx.h"
#include <pocketsphinx.h>
#define MODELDIR "c:/sphinx/model"
int main(int argc, char *argv[])
{
ps_decoder_t *ps = NULL;
cmd_ln_t *config = NULL;
config = cmd_ln_init(NULL, ps_args(), TRUE,
"-hmm", MODELDIR "/en-us/en-us",
"-lm", MODELDIR "/en-us/en-us.lm.bin",
"-dict", MODELDIR "/en-us/cmudict-en-us.dict",
NULL);
return 0;
}
Errors:
Error LNK2019 unresolved external symbol _cmd_ln_init referenced in function _main
Error LNK2019 unresolved external symbol _ps_args referenced in function _main

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?

Compiling IBPP with VS2010 - linking issue

I have a C++ project that uses IBPP to access a firebird database. I simply do it by including the file "all_in_one.cpp" in my project, and all went well with both VS6 (yes, I still have some of those) and VS2008.
Now I am considering using VS2010. It is compiling ok but does not link. I know VS2010 comes with a new implementation of the STL, and the linking problem obviously is around the STL.
I have tried creating a new project with VS2010, just adding the all_in_one.cpp file. It is a simple project that does not contain anything else, and it still fails to link with the same missing symbols. I can't figure out what's missing, incorrect. I have tried linking to the same libraries as in VS2008 (including the path). Nothing is working so far.
Here are the errors:
all_in_one.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) struct std::_Smanip<__int64> __cdecl std::setw(__int64)" (__imp_?setw#std##YA?AU?$_Smanip#_J#1#_J#Z) referenced in function "public: char const * __thiscall IBPP::DBKey::AsString(void)const " (?AsString#DBKey#IBPP##QBEPBDXZ)
all_in_one.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall std::_Container_base12::_Orphan_all(void)" (__imp_?_Orphan_all#_Container_base12#std##QAEXXZ) referenced in function "public: class std::vector<double,class std::allocator<double> > & __thiscall std::vector<double,class std::allocator<double> >::operator=(class std::vector<double,class std::allocator<double> > const &)" (??4?$vector#NV?$allocator#N#std###std##QAEAAV01#ABV01##Z)
all_in_one.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::_Lock(void)" (?_Lock#?$basic_streambuf#DU?$char_traits#D#std###std##UAEXXZ)
all_in_one.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::_Unlock(void)" (?_Unlock#?$basic_streambuf#DU?$char_traits#D#std###std##UAEXXZ)
all_in_one.obj : error LNK2001: unresolved external symbol "protected: virtual __int64 __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::showmanyc(void)" (?showmanyc#?$basic_streambuf#DU?$char_traits#D#std###std##MAE_JXZ)
all_in_one.obj : error LNK2001: unresolved external symbol "protected: virtual __int64 __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::xsgetn(char *,__int64)" (?xsgetn#?$basic_streambuf#DU?$char_traits#D#std###std##MAE_JPAD_J#Z)
all_in_one.obj : error LNK2001: unresolved external symbol "protected: virtual __int64 __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::xsputn(char const *,__int64)" (?xsputn#?$basic_streambuf#DU?$char_traits#D#std###std##MAE_JPBD_J#Z)
all_in_one.obj : error LNK2001: unresolved external symbol "protected: virtual class std::basic_streambuf<char,struct std::char_traits<char> > * __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::setbuf(char *,__int64)" (?setbuf#?$basic_streambuf#DU?$char_traits#D#std###std##MAEPAV12#PAD_J#Z)
all_in_one.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) __int64 const std::_BADOFF" (__imp_?_BADOFF#std##3_JB)
all_in_one.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl std::_Xlength_error(char const *)" (__imp_?_Xlength_error#std##YAXPBD#Z) referenced in function "public: void __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::_Xlen(void)const " (?_Xlen#?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##QBEXXZ)
all_in_one.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl std::_Xout_of_range(char const *)" (__imp_?_Xout_of_range#std##YAXPBD#Z) referenced in function "public: void __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::_Xran(void)const " (?_Xran#?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##QBEXXZ)
all_in_one.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall std::_Container_base12::~_Container_base12(void)" (__imp_??1_Container_base12#std##QAE#XZ) referenced in function __unwindfunclet$??0?$_String_val#DV?$allocator#D#std###std##QAE#V?$allocator#D#1##Z$0
all_in_one.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall std::_Container_base12::_Container_base12(void)" (__imp_??0_Container_base12#std##QAE#XZ) referenced in function "public: __thiscall std::_String_val<char,class std::allocator<char> >::_String_val<char,class std::allocator<char> >(class std::allocator<char>)" (??0?$_String_val#DV?$allocator#D#std###std##QAE#V?$allocator#D#1##Z)
all_in_one.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: struct std::_Iterator_base12 * * __thiscall std::_Container_base12::_Getpfirst(void)const " (__imp_?_Getpfirst#_Container_base12#std##QBEPAPAU_Iterator_base12#2#XZ) referenced in function "protected: void __thiscall std::vector<class ibpp_internals::TransactionImpl *,class std::allocator<class ibpp_internals::TransactionImpl *> >::_Orphan_range(class ibpp_internals::TransactionImpl * *,class ibpp_internals::TransactionImpl * *)const " (?_Orphan_range#?$vector#PAVTransactionImpl#ibpp_internals##V?$allocator#PAVTransactionImpl#ibpp_internals###std###std##IBEXPAPAVTransactionImpl#ibpp_internals##0#Z)
all_in_one.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __int64 __thiscall std::ios_base::width(__int64)" (__imp_?width#ios_base#std##QAE_J_J#Z) referenced in function "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::operator<<<struct std::char_traits<char> >(class std::basic_ostream<char,struct std::char_traits<char> > &,char const *)" (??$?6U?$char_traits#D#std###std##YAAAV?$basic_ostream#DU?$char_traits#D#std###0#AAV10#PBD#Z)
all_in_one.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __int64 __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::sputn(char const *,__int64)" (__imp_?sputn#?$basic_streambuf#DU?$char_traits#D#std###std##QAE_JPBD_J#Z) referenced in function "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::operator<<<struct std::char_traits<char> >(class std::basic_ostream<char,struct std::char_traits<char> > &,char const *)" (??$?6U?$char_traits#D#std###std##YAAAV?$basic_ostream#DU?$char_traits#D#std###0#AAV10#PBD#Z)
all_in_one.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __int64 __thiscall std::ios_base::width(void)const " (__imp_?width#ios_base#std##QBE_JXZ) referenced in function "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl std::operator<<<struct std::char_traits<char> >(class std::basic_ostream<char,struct std::char_traits<char> > &,char const *)" (??$?6U?$char_traits#D#std###std##YAAAV?$basic_ostream#DU?$char_traits#D#std###0#AAV10#PBD#Z)
It seems your library/DLL is exporting some templated/STL stuff.
STL is not binary compatible among different compiler versions.
You need to use same compiler/linker/bitness to compile and link the DLL/EXE if STL/template is involved.
Remove the all_in_one.cpp from build and use the other files from core to build the library.
Concerning linker errors 10 and 11 from the error list above, I have the following solution
(probably it fixes all errors).
Open the property pages of your project by right clicking your project inside the Solution Explorer and selecting "Properties".
Inside the "Property Pages"-window:
--> open "Configuration Properties" from left menu
--> select "VC++ Directories" on the left
--> go to "Library Directories" on the right
--> the corresponding string should contain a sub-string like
"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\lib"
--> replace "9.0" by "10.0"
to make the changes working "re"build your solution (perhaps clean your solution first).

Resources