I just downloaded assimp 3.0 library and build the required make files with cmake, then compiled and build the library itself the process was successfull (with little modification to StepFile.h),
my assimp header folder is located in:
/usr/local/include
and my libassimp.a is located in:
/usr/local/lib
however when i specify library and header files in my command line project and try to test my project i get the following error:
Undefined symbols for architecture x86_64:
"Assimp::Importer::Importer()", referenced from:
_main in main.o
"Assimp::Importer::~Importer()", referenced from:
_main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
and when i add -lassimp to Other Linker Flags i get the following errors:
Undefined symbols for architecture x86_64:
"_crc32", referenced from:
_unzReadCurrentFile in libassimp.a(unzip.c.o)
"_get_crc_table", referenced from:
_unzOpenCurrentFile3 in libassimp.a(unzip.c.o)
"_inflate", referenced from:
Assimp::XGLImporter::InternReadFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, aiScene*, Assimp::IOSystem*) in libassimp.a(XGLLoader.cpp.o)
Assimp::BlenderImporter::InternReadFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, aiScene*, Assimp::IOSystem*) in libassimp.a(BlenderLoader.cpp.o)
Assimp::XFileParser::XFileParser(std::__1::vector<char, std::__1::allocator<char> > const&) in libassimp.a(XFileParser.cpp.o)
_unzReadCurrentFile in libassimp.a(unzip.c.o)
"_inflateEnd", referenced from:
Assimp::XGLImporter::InternReadFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, aiScene*, Assimp::IOSystem*) in libassimp.a(XGLLoader.cpp.o)
Assimp::BlenderImporter::InternReadFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, aiScene*, Assimp::IOSystem*) in libassimp.a(BlenderLoader.cpp.o)
Assimp::XFileParser::XFileParser(std::__1::vector<char, std::__1::allocator<char> > const&) in libassimp.a(XFileParser.cpp.o)
_unzCloseCurrentFile in libassimp.a(unzip.c.o)
"_inflateInit2_", referenced from:
Assimp::XGLImporter::InternReadFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, aiScene*, Assimp::IOSystem*) in libassimp.a(XGLLoader.cpp.o)
Assimp::BlenderImporter::InternReadFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, aiScene*, Assimp::IOSystem*) in libassimp.a(BlenderLoader.cpp.o)
Assimp::XFileParser::XFileParser(std::__1::vector<char, std::__1::allocator<char> > const&) in libassimp.a(XFileParser.cpp.o)
_unzOpenCurrentFile3 in libassimp.a(unzip.c.o)
"_inflateReset", referenced from:
Assimp::XFileParser::XFileParser(std::__1::vector<char, std::__1::allocator<char> > const&) in libassimp.a(XFileParser.cpp.o)
"_inflateSetDictionary", referenced from:
Assimp::XFileParser::XFileParser(std::__1::vector<char, std::__1::allocator<char> > const&) in libassimp.a(XFileParser.cpp.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 had the same issue recently. The actual solution for me was to ensure that the project where I was using the compiled libassimp.a also linked to libz.dylib rather than turn assimp into a .dylib.
i rebuild assimp so that the makefile yields three library files namely libassimp.3.0.255.dylib libassimp.3.dylib libassimp.dylib, i included them in my project and it worked.
Related
When I try to convert my program to run in netanim I get the following error.
Undefined symbols for architecture arm64:
"ns3::AnimationInterface::SetConstantPosition(ns3::Ptr<ns3::Node>, double, double, double)", referenced from:
experiment(bool, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in wifi-hidden-terminal.cc.16.o
"ns3::AnimationInterface::AnimationInterface(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >)", referenced from:
experiment(bool, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in wifi-hidden-terminal.cc.16.o
"ns3::AnimationInterface::~AnimationInterface()", referenced from:
experiment(bool, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in wifi-hidden-terminal.cc.16.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Waf: Leaving directory `/Users/nithindeepkumar/Mtech/Wireless/ns-allinone-3.35/ns-3.35/build'
Build failed
-> task in 'wifi-hidden-terminal' failed with exit status 1 (run with -v to display more information)
The code I try to run is :
anim.SetConstantPosition(nodes.Get(0),1.0, 2.0 );
anim.SetConstantPosition(nodes.Get(1), 3.0 , 2.0 );
anim.SetConstantPosition(nodes.Get(2), 4.0, 2.0);
I am running ns3-3.35.
I am trying to build a conan source with dependency, I am getting
Undefined symbols for architecture x86_64:
I am trying to use geolite2pp in a c++ project, But I am getting this error
Here is content of conanfile.py
class AppConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
requires = "geolite2pp/0.0.1-2561#avantize/stable"
generators = "cmake"
Got error, while running
conan install -s build_type=Release --build=missing
Undefined symbols for architecture x86_64:
"_MMDB_aget_value", referenced from:
GeoLite2PP::DB::get_field(MMDB_lookup_result_s*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::vector<char const*, std::__1::allocator<char const*> > const&) in GeoLite2PP.cpp.o
"_MMDB_close", referenced from:
GeoLite2PP::DB::~DB() in GeoLite2PP.cpp.o
GeoLite2PP::DB::~DB() in GeoLite2PP.cpp.o
"_MMDB_free_entry_data_list", referenced from:
GeoLite2PP::DB::to_json(MMDB_entry_data_list_s*) in GeoLite2PP.cpp.o
"_MMDB_get_entry_data_list", referenced from:
GeoLite2PP::DB::lookup(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in GeoLite2PP.cpp.o
"_MMDB_get_metadata_as_entry_data_list", referenced from:
GeoLite2PP::DB::get_metadata() in GeoLite2PP.cpp.o
"_MMDB_lib_version", referenced from:
GeoLite2PP::DB::get_lib_version_mmdb() const in GeoLite2PP.cpp.o
"_MMDB_lookup_string", referenced from:
GeoLite2PP::DB::lookup_raw(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in GeoLite2PP.cpp.o
"_MMDB_open", referenced from:
GeoLite2PP::DB::DB(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in GeoLite2PP.cpp.o
"_MMDB_strerror", referenced from:
GeoLite2PP::ErrorCategory::message(int) const in GeoLite2PP_error_category.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[2]: *** [src-lib/CMakeFiles/geolite2++s.dir/build.make:99: src-lib/libgeolite2++.dylib] Error 1
[ 75%] Built target geolite2++
gmake[1]: *** [CMakeFiles/Makefile2:93: src-lib/CMakeFiles/geolite2++s.dir/all] Error 2
I want to enable debug version of libc++ in macOS, so I define _LIBCPP_DEBUG=1 in cxx_build_flags [Debug Version of libC++],
but unable to link debug function of libc++. I guess there is only release version of libc++ in my system, so how can I get the debug version of libc++ in macOS
Undefined symbols for architecture x86_64:
"std::__1::__libcpp_db::__decrementable(void const*) const", referenced from:
void std::__1::__nth_element<std::__1::__debug_less<std::__1::__less<float, float> >&, std::__1::__wrap_iter<float*> >(std::__1::__wrap_iter<float*>, std::__1::__wrap_iter<float*>, std::__1::__wrap_iter<float*>, std::__1::__debug_less<std::__1::__less<float, float> >&)
I think I got this to work!
So the steps I took,
Check your toolchains __config file for _LIBCPP_VERSION's value.
Browse the source repo for the commit where that version was set
From that commit, find the debug.cpp file
Include/compile/link the debug.cpp with your project (and remember to set _LIBCPP_DEBUG=1).
For me the intermediate results for the steps were (with Catalina, XCode Version 11.3.1)
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__config was at version 8000
Looking at the history at https://github.com/llvm/llvm-project/commits/main?&path[]=libcxx&path[]=include&path[]=__config I found commit https://github.com/llvm/llvm-project/commit/25977548aa5ad7cfe45a17e4ba136abfa4613b96#diff-0a85f740cd20254bc3bb03975c89d93a
The debug.cpp for that commit is at https://github.com/llvm/llvm-project/blob/25977548aa5ad7cfe45a17e4ba136abfa4613b96/libcxx/src/debug.cpp
I try to reactivate this thread without an answer with more details.
I have the same issue. This is very easy to reproduce:
#include <string>
int main()
{
std::string name;
return 0;
}
and then compile with:
clang++ -D_LIBCPP_DEBUG=1 main.cpp
We obtain:
Undefined symbols for architecture x86_64:
"std::__1::__libcpp_db::__insert_c(void*)", referenced from:
void std::__1::__libcpp_db::__insert_c<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*) in main-7ff3c5.o
"std::__1::__libcpp_db::__erase_c(void*)", referenced from:
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string() in main-7ff3c5.o
"std::__1::__c_node::~__c_node()", referenced from:
std::__1::_C_node<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::~_C_node() in main-7ff3c5.o
"std::__1::__get_db()", referenced from:
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string() in main-7ff3c5.o
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string() in main-7ff3c5.o
"typeinfo for std::__1::__c_node", referenced from:
typeinfo for std::__1::_C_node<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > in main-7ff3c5.o
"vtable for std::__1::__c_node", referenced from:
std::__1::__c_node::__c_node(void*, std::__1::__c_node*) in main-7ff3c5.o
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
And if I use g++-9 providen by brew (a real g++ not a disguised Apple Clang compiler), it compiles and runs perfectly.
Forgetting to use debug mode of libc++, is it the only solution?
NB: I saw the same question in https://forums.developer.apple.com/thread/99194
and still no answer.
I have read a few related answers and some articles online as well as the official Google Test documentation, but since I lack experience in this area I am very insecure about a few things and seek guidance.
I am starting a brand new pet project in c++ and I want to write proper tests as I code along, ran into Google Test and decided to give it a try.
Currently this is my folder structure:
/
/bin
/main.cpp
/lib
/lib/db
/lib/external/googletest
My idea is to have the tests and class files in their own folders, for example:
/lib/db/db.h
/lib/db/db.cpp
/lib/db/db.test
Question #1
Is there a naming convention or expectation for the file containing the tests? (/lib/db/db.test in that example above)
Question #2
I ran the following commands
cd lib/external/googletest/googletest
cmake .
make
make install
cp lib*.a /usr/local/lib
cp -r include/gtest/ /usr/local/include/
And seeing how it ended up creating a series of .h files in /usr/local/include/gtest, I expected to be able to #include <gtest/gtest.h> and be able to run tests, I added this to my main.cpp:
TEST(Param1, Param2) {
EXPECT_EQ(1, 1);
}
and when building the following error showed up:
Undefined symbols for architecture x86_64:
"testing::AssertionSuccess()", referenced from:
testing::AssertionResult testing::internal::CmpHelperEQ<int, int>(char const*, char const*, int const&, int const&) in main-230b96.o
"testing::Test::SetUp()", referenced from:
vtable for Param1_Param2_Test in main-230b96.o
"testing::Test::TearDown()", referenced from:
vtable for Param1_Param2_Test in main-230b96.o
"testing::Test::Test()", referenced from:
Param1_Param2_Test::Param1_Param2_Test() in main-230b96.o
"testing::Test::~Test()", referenced from:
Param1_Param2_Test::~Param1_Param2_Test() in main-230b96.o
"testing::Message::Message()", referenced from:
Param1_Param2_Test::TestBody() in main-230b96.o
"testing::internal::AssertHelper::AssertHelper(testing::TestPartResult::Type, char const*, int, char const*)", referenced from:
Param1_Param2_Test::TestBody() in main-230b96.o
"testing::internal::AssertHelper::~AssertHelper()", referenced from:
Param1_Param2_Test::TestBody() in main-230b96.o
"testing::internal::GetTestTypeId()", referenced from:
___cxx_global_var_init in main-230b96.o
"testing::internal::MakeAndRegisterTestInfo(char const*, char const*, char const*, char const*, testing::internal::CodeLocation, void const*, void (*)(), void (*)(), testing::internal::TestFactoryBase*)", referenced from:
___cxx_global_var_init in main-230b96.o
"testing::internal::IsTrue(bool)", referenced from:
testing::internal::scoped_ptr<std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::reset(std::__1::basic_stringstream<char, std::__1::char_traits<char>, std::__1::allocator<char> >*) in main-230b96.o
testing::internal::scoped_ptr<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::reset(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*) in main-230b96.o
"testing::internal::EqFailure(char const*, char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool)", referenced from:
testing::AssertionResult testing::internal::CmpHelperEQFailure<int, int>(char const*, char const*, int const&, int const&) in main-230b96.o
"testing::internal::AssertHelper::operator=(testing::Message const&) const", referenced from:
Param1_Param2_Test::TestBody() in main-230b96.o
"typeinfo for testing::Test", referenced from:
typeinfo for Param1_Param2_Test in main-230b96.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [all] Error 1
Solution
Thanks to trojanfoe I fixed my makefile to look like this:
CC=g++
target_folder=bin
all:
$(CC) *.cpp -o $(target_folder)/prod
./bin/prod
test:
$(CC) *.cpp -o $(target_folder)/test lib/external/googletest/googletest/libgtest.a lib/external/googletest/googletest/libgtest_main.a
./bin/test
clean:
rm -f $(target_folder)/* *.o
And now it works just fine, please keep in mind that this is a skeleton project and I need to structure the test files and entry point, so at this point its just compiling a basic test.
You have forgotten to link-in the google test library with your executable.
I have been trying to link the very useful AssImp-library in my OpenGl project in Eclipse (CDT)
I successfully installed the AssImp library by following the answer to this question:
Trouble building the Open Asset Import Library (Assimp)
I also successfully set up OpenGl in Eclipse(CDT) by following the answer to this question:
OpenGL and GLUT in Eclipse on OS X
Now when i try to build some code where the AssImp-lib is being used the following error appears:
ld: warning: in /usr/local/lib/libassimp.a, file was built for unsupported file format which is not the architecture being linked (i386)
I guess the library is built for the wrong architecture ...
I tried filling in "i386"in the CMake's "CMAKE_OSX_ARCHITECTURES:" flag but this does not help in any way...
Ok I changed the architecture but it still gives some linking errors..
does anybody have the same errors ?
Undefined symbols:
"_get_crc_table", referenced from:
_unzOpenCurrentFile3 in libassimp.a(unzip.c.o)
"inflateInit2", referenced from:
Assimp::XGLImporter::InternReadFile(std::basic_string, std::allocator > const&, aiScene*, Assimp::IOSystem*)in libassimp.a(XGLLoader.cpp.o)
Assimp::BlenderImporter::InternReadFile(std::basic_string, std::allocator > const&, aiScene*, Assimp::IOSystem*)in libassimp.a(BlenderLoader.cpp.o)
Assimp::XFileParser::XFileParser(std::vector > const&)in libassimp.a(XFileParser.cpp.o)
Assimp::XFileParser::XFileParser(std::vector > const&)in libassimp.a(XFileParser.cpp.o)
_unzOpenCurrentFile3 in libassimp.a(unzip.c.o)
"_inflateEnd", referenced from:
Assimp::XGLImporter::InternReadFile(std::basic_string, std::allocator > const&, aiScene*, Assimp::IOSystem*)in libassimp.a(XGLLoader.cpp.o)
Assimp::BlenderImporter::InternReadFile(std::basic_string, std::allocator > const&, aiScene*, Assimp::IOSystem*)in libassimp.a(BlenderLoader.cpp.o)
Assimp::XFileParser::XFileParser(std::vector > const&)in libassimp.a(XFileParser.cpp.o)
Assimp::XFileParser::XFileParser(std::vector > const&)in libassimp.a(XFileParser.cpp.o)
_unzCloseCurrentFile in libassimp.a(unzip.c.o)
"_inflateSetDictionary", referenced from:
Assimp::XFileParser::XFileParser(std::vector > const&)in libassimp.a(XFileParser.cpp.o)
Assimp::XFileParser::XFileParser(std::vector > const&)in libassimp.a(XFileParser.cpp.o)
"_inflate", referenced from:
Assimp::XGLImporter::InternReadFile(std::basic_string, std::allocator > const&, aiScene*, Assimp::IOSystem*)in libassimp.a(XGLLoader.cpp.o)
Assimp::BlenderImporter::InternReadFile(std::basic_string, std::allocator > const&, aiScene*, Assimp::IOSystem*)in libassimp.a(BlenderLoader.cpp.o)
Assimp::XFileParser::XFileParser(std::vector > const&)in libassimp.a(XFileParser.cpp.o)
Assimp::XFileParser::XFileParser(std::vector > const&)in libassimp.a(XFileParser.cpp.o)
_unzReadCurrentFile in libassimp.a(unzip.c.o)
"_crc32", referenced from:
_unzReadCurrentFile in libassimp.a(unzip.c.o)
_unzReadCurrentFile in libassimp.a(unzip.c.o)
"_inflateReset", referenced from:
Assimp::XFileParser::XFileParser(std::vector > const&)in libassimp.a(XFileParser.cpp.o)
Assimp::XFileParser::XFileParser(std::vector > const&)in libassimp.a(XFileParser.cpp.o)
ld: symbol(s) not found
I fixed the problem by adding the zlib library in the linker libraries -> add "z"
as suggested by gabor papp in the assimp-mailinglist