I am trying to compile my c++ files using cygwin.
\Files are compiled but linking time errors occur
These kind of errors...
undefined reference to `std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::size() const'
and some more errors like
undefined reference to `sqlite3_mprintf'
undefined reference to `sqlite3_exec'
undefined reference to `sqlite3_free'
undefined reference to `sqlite3_free'
undefined reference to `sqlite3_free'
undefined reference to `sqlite3_exec'
please help me out?
Thank you.
It looks like the standard C++ library is not getting linked in. Are you linking your code with g++, gcc or ld? If using the first, that library gets linked in automatically, but not if you're using the other two.
For the errors about sqlite3, you need to add -lsqlite3 to the link command (assuming you have it installed, of course).
Related
i get many undefined reference errors when i code opencv under android NDK, such as:
system.cpp:(.text.unlikely._ZNSs4_Rep10_M_disposeERKSaIcE.part.5+0x1c):
undefined reference to `std::string::_Rep::_M_destroy(std::allocator
const&)'
G:/AndroidProjects/SprayingPrjJNI/app/src/main/cpp/../jniLibs/arm64-v8a/libopencv_core.a(system.cpp.o):
In function `void std::_Destroy(std::string*, std::string*,
std::allocator&) [clone .isra.88]':
system.cpp:(.text.unlikely._ZSt8_DestroyIPSsSsEvT_S1_RSaIT0_E.isra.88+0x18):
undefined reference to `std::string::_Rep::_S_empty_rep_storage'
system.cpp:(.text.unlikely._ZSt8_DestroyIPSsSsEvT_S1_RSaIT0_E.isra.88+0x2c):
undefined reference to `std::string::_Rep::_S_empty_rep_storage'
..................
i really dont know how to fix these errors, please help me, thanks
See NDK - problems after GNUSTL has been removed from the NDK (revision r18).
But if you don't have very strong reasons to stay with the old version of OpenCV, the easiest approach is to switch to prebuilt OpenCV 4.01 which is compatible with NDK r19.
Setup is according to given in Github/FacebookSDK and every thing is just fine,
but when run command apportable build it gives error like this
.../Source/AppDelegate.m:function L_OBJC_CLASSLIST_REFERENCES_$_125: error: undefined reference to 'OBJC_CLASS_$_FBSession'
.../Source/EndGame.m:function L_OBJC_CLASSLIST_REFERENCES_$_125: error: undefined reference to 'OBJC_CLASS_$_FBSession'
.../Source/EndGame.m:function L_OBJC_CLASSLIST_REFERENCES_$_147: error: undefined reference to 'OBJC_CLASS_$_FBRequest'
.../Source/EndGame.m:function L_OBJC_CLASSLIST_REFERENCES_$_257: error: undefined reference to 'OBJC_CLASS_$_FBRequestConnection'
what i am doing wrong ?
thanks
Apportable starter SDK version does not support Facebook ios SDK compilation. You must have an Indie Version to have support for social media SDKs.
I want to develop and android application which will help annotate the PDF files in android. Thus, I am using MuPDF to read and Parse the PDF files in android. I am trying to build it as specified in http://www.mupdf.com/doc/how-to-build-mupdf-for-android , but I have encountered the following error:
C:/Android-NDK/android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi-v7a/libmupdfcore.a(image.o): in function fz_decomp_image_from_stream:jni/../../../source/fitz/image.c:182: error: undefined reference to 'fz_unpack_tile'
C:/Android-NDK/android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi-v7a/libmupdfcore.a(image.o): in function fz_decomp_image_from_stream:jni/../../../source/fitz/image.c:193: error: undefined reference to 'fz_decode_indexed_tile'
C:/Android-NDK/android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi-v7a/libmupdfcore.a(image.o): in function fz_decomp_image_from_stream:jni/../../../source/fitz/image.c:200: error: undefined reference to 'fz_decode_tile'
C:/Android-NDK/android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi-v7a/libmupdfcore.a(load-tiff.o): in function fz_load_tiff:jni/../../../source/fitz/load-tiff.c:804: error: undefined reference to 'fz_unpack_tile'
C:/Android-NDK/android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi-v7a/libmupdfcore.a(load-png.o): in function fz_load_png:jni/../../../source/fitz/load-png.c:567: error: undefined reference to 'fz_unpack_tile'
On analyzing the first error, I understood that fz_unpack_tile, fz_decode_tile, fz_decode_indexed_tile are defined in fitz/draw-unpack.c
Now, I am not sure of how to continue from here
You asked this on irc yesterday, and I suggested that you do a complete clean, then rebuild from scratch capturing the logs and post them somewhere.
The code as supplied in git builds just fine in android for us. Without more information, no one is going to be able to help you.
I tried to compile swiften (a XMPP client library) into a lib for Android JNI but failed. Is there anyone successed? Any suggestion would be appreciated.
I compiled swiften as follow steps:
Downloaded swiften from http://swift.im/git/swift/commit/?id=13a3f7812520d44e374d7c391daf2128335ac067
Do as follow document: http://swift.im/git/swift/commit/?h=sandbox/tobias/android&id=b8e69ea59b471e1aff9c8db06aceb7108db0657b
since I only need swiften, so I compile as: ./scons Swiften target=android toolchain=/home/XXX/toolchain
Then I got follow problems:
can't find cryptlib.c, so I downloaded openssl and this fixed.
can't find arpa/nameser_compat.h. Then I copied this header files from /usr/include to tool-chain, and added #define BSD 199307 at the begining.
can't find the declarations of res_init(), res_query(), dn_expand(), dn_skipname(). So I added the declarations.
And finally I got libSwiften.a which the size is 260M. And there are about 200 link errors:
AR Swiften/libSwiften.a
RANLIB Swiften/libSwiften.a
LINK Swiften/Examples/BenchTool/BenchTool
3rdParty/OpenSSL/openssl/crypto/objects/obj_dat.c:489: error: undefined reference to 'BUF_strlcpy'
3rdParty/OpenSSL/openssl/crypto/objects/obj_dat.c:579: error: undefined reference to 'BUF_strlcpy'
3rdParty/OpenSSL/openssl/crypto/objects/obj_dat.c:601: error: undefined reference to 'BUF_strlcpy'
3rdParty/OpenSSL/openssl/crypto/bio/bss_file.c:368: error: undefined reference to 'BUF_strlcpy'
3rdParty/OpenSSL/openssl/crypto/err/err.c:1104: error: undefined reference to 'BUF_strlcat'
3rdParty/OpenSSL/openssl/crypto/x509v3/v3_enum.c:94: error: undefined reference to 'BUF_strdup'
3rdParty/OpenSSL/openssl/crypto/x509v3/v3_purp.c:199: error: undefined reference to 'BUF_strdup'
3rdParty/OpenSSL/openssl/crypto/x509v3/v3_purp.c:200: error: undefined reference to 'BUF_strdup'
some more......
I am creating an android application which is having native C code along with sqlite database.
When I do a ndk-build from my jni folder,I am getting the following error.
undefined reference to `sqlite3_open'
peard.c:(.text+0x588): undefined reference to `sqlite3_exec'
peard.c:(.text+0x5f8): undefined reference to `sqlite3_exec'
peard.c:(.text+0x668): undefined reference to `sqlite3_exec'
peard.c:(.text+0x6d8): undefined reference to `sqlite3_prepare_v2'
peard.c:(.text+0x720): undefined reference to `sqlite3_column_count'
peard.c:(.text+0x734): undefined reference to `sqlite3_step'
peard.c:(.text+0x774): undefined reference to `sqlite3_column_text'
peard.c:(.text+0x78c): undefined reference to `sqlite3_column_name'
peard.c:(.text+0x800): undefined reference to `sqlite3_close'
I tried to run along with -lsqlite3 command also,but doesn't work.
Thanks.
I solved the problem by adding sqlite3.c source file to my dependency files list in my Android.mk file.Special thanks to hirschhomsalz.
Narain.
You need to build or install sqlite3 (and all other non standard libraries you project depends on) for android, and the build your project with the -L and -I parameters pointing to the arm version of you sqlite libraries and headers.