- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我正在尝试链接到下一个库:( see docs )
它是一个 C
绑定(bind),用于用 C++
编写的库。但是如果制作静态库然后尝试链接到它。
我收到这些消息:
uchardet//libuchardet.a(uchardet.cpp.o): In function `uchardet_new':
uchardet.cpp:(.text+0x19): undefined reference to `operator new(unsigned long)'
uchardet.cpp:(.text+0x3c): undefined reference to `std::string::_Rep::_S_empty_rep_storage'
uchardet.cpp:(.text+0x4b): undefined reference to `std::string::assign(char const*, unsigned long)'
uchardet.cpp:(.text+0x6c): undefined reference to `operator delete(void*)'
uchardet.cpp:(.text+0x7f): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
uchardet//libuchardet.a(uchardet.cpp.o): In function `HandleUniversalDetector::Reset()':
uchardet.cpp:(.text._ZN23HandleUniversalDetector5ResetEv[_ZN23HandleUniversalDetector5ResetEv]+0x16): undefined reference to `std::string::assign(char const*, unsigned long)'
uchardet//libuchardet.a(uchardet.cpp.o): In function `HandleUniversalDetector::Report(char const*)':
uchardet.cpp:(.text._ZN23HandleUniversalDetector6ReportEPKc[_ZN23HandleUniversalDetector6ReportEPKc]+0x35): undefined reference to `std::string::assign(char const*, unsigned long)'
uchardet//libuchardet.a(uchardet.cpp.o): In function `HandleUniversalDetector::~HandleUniversalDetector()':
uchardet.cpp:(.text._ZN23HandleUniversalDetectorD2Ev[_ZN23HandleUniversalDetectorD5Ev]+0x1a): undefined reference to `std::string::_Rep::_S_empty_rep_storage'
uchardet.cpp:(.text._ZN23HandleUniversalDetectorD2Ev[_ZN23HandleUniversalDetectorD5Ev]+0x4d): undefined reference to `std::string::_Rep::_M_destroy(std::allocator<char> const&)'
uchardet//libuchardet.a(uchardet.cpp.o): In function `HandleUniversalDetector::~HandleUniversalDetector()':
uchardet.cpp:(.text._ZN23HandleUniversalDetectorD0Ev[_ZN23HandleUniversalDetectorD0Ev]+0x1a): undefined reference to `std::string::_Rep::_S_empty_rep_storage'
uchardet.cpp:(.text._ZN23HandleUniversalDetectorD0Ev[_ZN23HandleUniversalDetectorD0Ev]+0x2c): undefined reference to `operator delete(void*)'
uchardet.cpp:(.text._ZN23HandleUniversalDetectorD0Ev[_ZN23HandleUniversalDetectorD0Ev]+0x55): undefined reference to `std::string::_Rep::_M_destroy(std::allocator<char> const&)'
uchardet//libuchardet.a(uchardet.cpp.o):(.rodata._ZTI23HandleUniversalDetector[_ZTI23HandleUniversalDetector]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
uchardet//libuchardet.a(uchardet.cpp.o):(.eh_frame+0xab): undefined reference to `__gxx_personality_v0'
uchardet//libuchardet.a(nsUniversalDetector.cpp.o): In function `nsUniversalDetector::HandleData(char const*, unsigned int)':
nsUniversalDetector.cpp:(.text+0x368): undefined reference to `operator new(unsigned long)'
nsUniversalDetector.cpp:(.text+0x396): undefined reference to `operator new(unsigned long)'
nsUniversalDetector.cpp:(.text+0x3c6): undefined reference to `operator new(unsigned long)'
nsUniversalDetector.cpp:(.text+0x4eb): undefined reference to `operator new(unsigned long)'
nsUniversalDetector.cpp:(.text+0x527): undefined reference to `operator delete(void*)'
nsUniversalDetector.cpp:(.text+0x53a): undefined reference to `operator delete(void*)'
nsUniversalDetector.cpp:(.text+0x554): undefined reference to `operator delete(void*)'
uchardet//libuchardet.a(nsUniversalDetector.cpp.o): In function `nsUniversalDetector::~nsUniversalDetector()':
nsUniversalDetector.cpp:(.text+0x5bc): undefined reference to `operator delete(void*)'
uchardet//libuchardet.a(nsUniversalDetector.cpp.o): In function `nsCharSetProber::~nsCharSetProber()':
nsUniversalDetector.cpp:(.text._ZN15nsCharSetProberD0Ev[_ZN15nsCharSetProberD0Ev]+0x8): undefined reference to `operator delete(void*)'
uchardet//libuchardet.a(nsUniversalDetector.cpp.o):(.rodata._ZTI19nsUniversalDetector[_ZTI19nsUniversalDetector]+0x0): undefined reference to `vtable for __cxxabiv1::__class_type_info'
uchardet//libuchardet.a(nsUniversalDetector.cpp.o):(.rodata._ZTV19nsUniversalDetector[_ZTV19nsUniversalDetector]+0x30): undefined reference to `__cxa_pure_virtual'
uchardet//libuchardet.a(nsUniversalDetector.cpp.o):(.rodata._ZTV15nsCharSetProber[_ZTV15nsCharSetProber]+0x20): undefined reference to `__cxa_pure_virtual'
uchardet//libuchardet.a(nsUniversalDetector.cpp.o):(.rodata._ZTV15nsCharSetProber[_ZTV15nsCharSetProber]+0x28): undefined reference to `__cxa_pure_virtual'
uchardet//libuchardet.a(nsUniversalDetector.cpp.o):(.rodata._ZTV15nsCharSetProber[_ZTV15nsCharSetProber]+0x30): undefined reference to `__cxa_pure_virtual'
uchardet//libuchardet.a(nsUniversalDetector.cpp.o):(.rodata._ZTV15nsCharSetProber[_ZTV15nsCharSetProber]+0x38): undefined reference to `__cxa_pure_virtual'
uchardet//libuchardet.a(nsUniversalDetector.cpp.o):(.rodata._ZTV15nsCharSetProber[_ZTV15nsCharSetProber]+0x40): more undefined references to `__cxa_pure_virtual' follow
uchardet//libuchardet.a(nsUniversalDetector.cpp.o):(.rodata._ZTI15nsCharSetProber[_ZTI15nsCharSetProber]+0x0): undefined reference to `vtable for __cxxabiv1::__class_type_info'
uchardet//libuchardet.a(nsUniversalDetector.cpp.o):(.eh_frame+0xbb): undefined reference to `__gxx_personality_v0'
uchardet//libuchardet.a(nsEscCharsetProber.cpp.o): In function `nsEscCharSetProber::~nsEscCharSetProber()':
nsEscCharsetProber.cpp:(.text+0x1a0): undefined reference to `operator delete(void*)'
nsEscCharsetProber.cpp:(.text+0x1a9): undefined reference to `operator delete(void*)'
nsEscCharsetProber.cpp:(.text+0x1b2): undefined reference to `operator delete(void*)'
nsEscCharsetProber.cpp:(.text+0x1bb): undefined reference to `operator delete(void*)'
uchardet//libuchardet.a(nsEscCharsetProber.cpp.o): In function `nsEscCharSetProber::~nsEscCharSetProber()':
nsEscCharsetProber.cpp:(.text+0x1e0): undefined reference to `operator delete(void*)'
uchardet//libuchardet.a(nsEscCharsetProber.cpp.o):nsEscCharsetProber.cpp:(.text+0x1e9): more undefined references to `operator delete(void*)' follow
uchardet//libuchardet.a(nsEscCharsetProber.cpp.o): In function `nsEscCharSetProber::nsEscCharSetProber(unsigned int)':
nsEscCharsetProber.cpp:(.text+0x276): undefined reference to `operator new(unsigned long)'
nsEscCharsetProber.cpp:(.text+0x296): undefined reference to `operator new(unsigned long)'
nsEscCharsetProber.cpp:(.text+0x2b6): undefined reference to `operator new(unsigned long)'
nsEscCharsetProber.cpp:(.text+0x2d2): undefined reference to `operator new(unsigned long)'
uchardet//libuchardet.a(nsEscCharsetProber.cpp.o): In function `nsEscCharSetProber::~nsEscCharSetProber()':
nsEscCharsetProber.cpp:(.text+0x20b): undefined reference to `operator delete(void*)'
uchardet//libuchardet.a(nsEscCharsetProber.cpp.o):(.rodata._ZTI18nsEscCharSetProber[_ZTI18nsEscCharSetProber]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
uchardet//libuchardet.a(nsEscCharsetProber.cpp.o):(.eh_frame+0x137): undefined reference to `__gxx_personality_v0'
uchardet//libuchardet.a(nsMBCSGroupProber.cpp.o): In function `nsMBCSGroupProber::nsMBCSGroupProber(unsigned int)':
nsMBCSGroupProber.cpp:(.text+0x964): undefined reference to `operator new(unsigned long)'
nsMBCSGroupProber.cpp:(.text+0x97f): undefined reference to `operator new(unsigned long)'
nsMBCSGroupProber.cpp:(.text+0x9d0): undefined reference to `operator new(unsigned long)'
nsMBCSGroupProber.cpp:(.text+0x9f9): undefined reference to `operator new(unsigned long)'
nsMBCSGroupProber.cpp:(.text+0xa22): undefined reference to `operator new(unsigned long)'
uchardet//libuchardet.a(nsMBCSGroupProber.cpp.o):nsMBCSGroupProber.cpp:(.text+0xa43): more undefined references to `operator new(unsigned long)' follow
uchardet//libuchardet.a(nsMBCSGroupProber.cpp.o): In function `nsMBCSGroupProber::nsMBCSGroupProber(unsigned int)':
nsMBCSGroupProber.cpp:(.text+0xd6b): undefined reference to `operator delete(void*)'
nsMBCSGroupProber.cpp:(.text+0xda5): undefined reference to `operator delete(void*)'
uchardet//libuchardet.a(nsMBCSGroupProber.cpp.o): In function `nsMBCSGroupProber::~nsMBCSGroupProber()':
nsMBCSGroupProber.cpp:(.text+0x8f0): undefined reference to `operator delete(void*)'
uchardet//libuchardet.a(nsMBCSGroupProber.cpp.o):(.rodata._ZTI17nsMBCSGroupProber[_ZTI17nsMBCSGroupProber]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
uchardet//libuchardet.a(nsMBCSGroupProber.cpp.o):(.rodata._ZTV23JapaneseContextAnalysis[_ZTV23JapaneseContextAnalysis]+0x10): undefined reference to `__cxa_pure_virtual'
uchardet//libuchardet.a(nsMBCSGroupProber.cpp.o):(.rodata._ZTV23JapaneseContextAnalysis[_ZTV23JapaneseContextAnalysis]+0x18): undefined reference to `__cxa_pure_virtual'
uchardet//libuchardet.a(nsMBCSGroupProber.cpp.o):(.rodata._ZTI23JapaneseContextAnalysis[_ZTI23JapaneseContextAnalysis]+0x0): undefined reference to `vtable for __cxxabiv1::__class_type_info'
uchardet//libuchardet.a(nsMBCSGroupProber.cpp.o):(.eh_frame+0x67): undefined reference to `__gxx_personality_v0'
uchardet//libuchardet.a(nsSBCSGroupProber.cpp.o): In function `nsSBCSGroupProber::nsSBCSGroupProber()':
nsSBCSGroupProber.cpp:(.text+0xdf4): undefined reference to `operator new(unsigned long)'
nsSBCSGroupProber.cpp:(.text+0xe28): undefined reference to `operator new(unsigned long)'
nsSBCSGroupProber.cpp:(.text+0xe5c): undefined reference to `operator new(unsigned long)'
nsSBCSGroupProber.cpp:(.text+0xe90): undefined reference to `operator new(unsigned long)'
nsSBCSGroupProber.cpp:(.text+0xec4): undefined reference to `operator new(unsigned long)'
uchardet//libuchardet.a(nsSBCSGroupProber.cpp.o):nsSBCSGroupProber.cpp:(.text+0xef8): more undefined references to `operator new(unsigned long)' follow
uchardet//libuchardet.a(nsSBCSGroupProber.cpp.o): In function `nsSBCSGroupProber::nsSBCSGroupProber()':
nsSBCSGroupProber.cpp:(.text+0x13fb): undefined reference to `operator delete(void*)'
nsSBCSGroupProber.cpp:(.text+0x1422): undefined reference to `operator delete(void*)'
uchardet//libuchardet.a(nsSBCSGroupProber.cpp.o): In function `nsSBCSGroupProber::~nsSBCSGroupProber()':
nsSBCSGroupProber.cpp:(.text+0xdc9): undefined reference to `operator delete(void*)'
uchardet//libuchardet.a(nsSBCSGroupProber.cpp.o):(.rodata._ZTI17nsSBCSGroupProber[_ZTI17nsSBCSGroupProber]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
uchardet//libuchardet.a(nsSBCSGroupProber.cpp.o):(.eh_frame+0x67): undefined reference to `__gxx_personality_v0'
uchardet//libuchardet.a(nsSBCharSetProber.cpp.o): In function `nsSingleByteCharSetProber::~nsSingleByteCharSetProber()':
nsSBCharSetProber.cpp:(.text._ZN25nsSingleByteCharSetProberD0Ev[_ZN25nsSingleByteCharSetProberD0Ev]+0x8): undefined reference to `operator delete(void*)'
uchardet//libuchardet.a(nsSBCharSetProber.cpp.o):(.rodata._ZTI25nsSingleByteCharSetProber[_ZTI25nsSingleByteCharSetProber]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
uchardet//libuchardet.a(nsSJISProber.cpp.o): In function `nsSJISProber::~nsSJISProber()':
nsSJISProber.cpp:(.text._ZN12nsSJISProberD2Ev[_ZN12nsSJISProberD5Ev]+0x10): undefined reference to `operator delete(void*)'
uchardet//libuchardet.a(nsSJISProber.cpp.o): In function `nsSJISProber::~nsSJISProber()':
nsSJISProber.cpp:(.text._ZN12nsSJISProberD0Ev[_ZN12nsSJISProberD0Ev]+0x10): undefined reference to `operator delete(void*)'
nsSJISProber.cpp:(.text._ZN12nsSJISProberD0Ev[_ZN12nsSJISProberD0Ev]+0x20): undefined reference to `operator delete(void*)'
uchardet//libuchardet.a(nsSJISProber.cpp.o):(.rodata._ZTI12nsSJISProber[_ZTI12nsSJISProber]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
uchardet//libuchardet.a(nsUTF8Prober.cpp.o): In function `nsUTF8Prober::~nsUTF8Prober()':
nsUTF8Prober.cpp:(.text._ZN12nsUTF8ProberD2Ev[_ZN12nsUTF8ProberD5Ev]+0x10): undefined reference to `operator delete(void*)'
uchardet//libuchardet.a(nsUTF8Prober.cpp.o): In function `nsUTF8Prober::~nsUTF8Prober()':
nsUTF8Prober.cpp:(.text._ZN12nsUTF8ProberD0Ev[_ZN12nsUTF8ProberD0Ev]+0x10): undefined reference to `operator delete(void*)'
nsUTF8Prober.cpp:(.text._ZN12nsUTF8ProberD0Ev[_ZN12nsUTF8ProberD0Ev]+0x20): undefined reference to `operator delete(void*)'
uchardet//libuchardet.a(nsUTF8Prober.cpp.o):(.rodata._ZTI12nsUTF8Prober[_ZTI12nsUTF8Prober]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
uchardet//libuchardet.a(nsLatin1Prober.cpp.o): In function `nsLatin1Prober::~nsLatin1Prober()':
nsLatin1Prober.cpp:(.text._ZN14nsLatin1ProberD0Ev[_ZN14nsLatin1ProberD0Ev]+0x8): undefined reference to `operator delete(void*)'
uchardet//libuchardet.a(nsLatin1Prober.cpp.o):(.rodata._ZTI14nsLatin1Prober[_ZTI14nsLatin1Prober]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
uchardet//libuchardet.a(CharDistribution.cpp.o):(.rodata._ZTI24CharDistributionAnalysis[_ZTI24CharDistributionAnalysis]+0x0): undefined reference to `vtable for __cxxabiv1::__class_type_info'
uchardet//libuchardet.a(CharDistribution.cpp.o):(.rodata._ZTI25EUCTWDistributionAnalysis[_ZTI25EUCTWDistributionAnalysis]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
uchardet//libuchardet.a(CharDistribution.cpp.o):(.rodata._ZTI25EUCKRDistributionAnalysis[_ZTI25EUCKRDistributionAnalysis]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
uchardet//libuchardet.a(CharDistribution.cpp.o):(.rodata._ZTI26GB2312DistributionAnalysis[_ZTI26GB2312DistributionAnalysis]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
uchardet//libuchardet.a(CharDistribution.cpp.o):(.rodata._ZTI24Big5DistributionAnalysis[_ZTI24Big5DistributionAnalysis]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
uchardet//libuchardet.a(CharDistribution.cpp.o):(.rodata._ZTI24SJISDistributionAnalysis[_ZTI24SJISDistributionAnalysis]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
uchardet//libuchardet.a(CharDistribution.cpp.o):(.rodata._ZTI25EUCJPDistributionAnalysis[_ZTI25EUCJPDistributionAnalysis]+0x0): more undefined references to `vtable for __cxxabiv1::__si_class_type_info' follow
uchardet//libuchardet.a(nsHebrewProber.cpp.o): In function `nsHebrewProber::~nsHebrewProber()':
nsHebrewProber.cpp:(.text._ZN14nsHebrewProberD0Ev[_ZN14nsHebrewProberD0Ev]+0x8): undefined reference to `operator delete(void*)'
uchardet//libuchardet.a(nsHebrewProber.cpp.o):(.rodata._ZTI14nsHebrewProber[_ZTI14nsHebrewProber]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
uchardet//libuchardet.a(nsBig5Prober.cpp.o): In function `nsBig5Prober::~nsBig5Prober()':
nsBig5Prober.cpp:(.text._ZN12nsBig5ProberD2Ev[_ZN12nsBig5ProberD5Ev]+0x10): undefined reference to `operator delete(void*)'
uchardet//libuchardet.a(nsBig5Prober.cpp.o): In function `nsBig5Prober::~nsBig5Prober()':
nsBig5Prober.cpp:(.text._ZN12nsBig5ProberD0Ev[_ZN12nsBig5ProberD0Ev]+0x10): undefined reference to `operator delete(void*)'
nsBig5Prober.cpp:(.text._ZN12nsBig5ProberD0Ev[_ZN12nsBig5ProberD0Ev]+0x20): undefined reference to `operator delete(void*)'
uchardet//libuchardet.a(nsBig5Prober.cpp.o):(.rodata._ZTI12nsBig5Prober[_ZTI12nsBig5Prober]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
uchardet//libuchardet.a(nsEUCJPProber.cpp.o): In function `nsEUCJPProber::~nsEUCJPProber()':
nsEUCJPProber.cpp:(.text._ZN13nsEUCJPProberD2Ev[_ZN13nsEUCJPProberD5Ev]+0x10): undefined reference to `operator delete(void*)'
uchardet//libuchardet.a(nsEUCJPProber.cpp.o): In function `nsEUCJPProber::~nsEUCJPProber()':
nsEUCJPProber.cpp:(.text._ZN13nsEUCJPProberD0Ev[_ZN13nsEUCJPProberD0Ev]+0x10): undefined reference to `operator delete(void*)'
nsEUCJPProber.cpp:(.text._ZN13nsEUCJPProberD0Ev[_ZN13nsEUCJPProberD0Ev]+0x20): undefined reference to `operator delete(void*)'
uchardet//libuchardet.a(nsEUCJPProber.cpp.o):(.rodata._ZTI13nsEUCJPProber[_ZTI13nsEUCJPProber]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
uchardet//libuchardet.a(nsEUCKRProber.cpp.o): In function `nsEUCKRProber::~nsEUCKRProber()':
nsEUCKRProber.cpp:(.text._ZN13nsEUCKRProberD2Ev[_ZN13nsEUCKRProberD5Ev]+0x10): undefined reference to `operator delete(void*)'
uchardet//libuchardet.a(nsEUCKRProber.cpp.o): In function `nsEUCKRProber::~nsEUCKRProber()':
nsEUCKRProber.cpp:(.text._ZN13nsEUCKRProberD0Ev[_ZN13nsEUCKRProberD0Ev]+0x10): undefined reference to `operator delete(void*)'
nsEUCKRProber.cpp:(.text._ZN13nsEUCKRProberD0Ev[_ZN13nsEUCKRProberD0Ev]+0x20): undefined reference to `operator delete(void*)'
uchardet//libuchardet.a(nsEUCKRProber.cpp.o):(.rodata._ZTI13nsEUCKRProber[_ZTI13nsEUCKRProber]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
uchardet//libuchardet.a(nsEUCTWProber.cpp.o): In function `nsEUCTWProber::~nsEUCTWProber()':
nsEUCTWProber.cpp:(.text._ZN13nsEUCTWProberD2Ev[_ZN13nsEUCTWProberD5Ev]+0x10): undefined reference to `operator delete(void*)'
uchardet//libuchardet.a(nsEUCTWProber.cpp.o): In function `nsEUCTWProber::~nsEUCTWProber()':
nsEUCTWProber.cpp:(.text._ZN13nsEUCTWProberD0Ev[_ZN13nsEUCTWProberD0Ev]+0x10): undefined reference to `operator delete(void*)'
nsEUCTWProber.cpp:(.text._ZN13nsEUCTWProberD0Ev[_ZN13nsEUCTWProberD0Ev]+0x20): undefined reference to `operator delete(void*)'
uchardet//libuchardet.a(nsEUCTWProber.cpp.o):(.rodata._ZTI13nsEUCTWProber[_ZTI13nsEUCTWProber]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
uchardet//libuchardet.a(nsGB2312Prober.cpp.o): In function `nsGB18030Prober::~nsGB18030Prober()':
nsGB2312Prober.cpp:(.text._ZN15nsGB18030ProberD2Ev[_ZN15nsGB18030ProberD5Ev]+0x10): undefined reference to `operator delete(void*)'
uchardet//libuchardet.a(nsGB2312Prober.cpp.o): In function `nsGB18030Prober::~nsGB18030Prober()':
nsGB2312Prober.cpp:(.text._ZN15nsGB18030ProberD0Ev[_ZN15nsGB18030ProberD0Ev]+0x10): undefined reference to `operator delete(void*)'
nsGB2312Prober.cpp:(.text._ZN15nsGB18030ProberD0Ev[_ZN15nsGB18030ProberD0Ev]+0x20): undefined reference to `operator delete(void*)'
uchardet//libuchardet.a(nsGB2312Prober.cpp.o):(.rodata._ZTI15nsGB18030Prober[_ZTI15nsGB18030Prober]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
collect2: error: ld returned 1 exit status
如果 make shared one 并尝试在我的程序中使用它,它会编译,但是当我运行它时,我有:
error while loading shared libraries: libuchardet.so.0: cannot open shared object file: No such file or directory
我是这样编译的:
gcc test.c -Ithird -Lthird/parserutils/lib_amd64/ -lparserutils -I uchardet/ -L uchardet/ -luchardet
好的!这行得通!
LD_LIBRARY_PATH=uchardet/ ./a.out
但是我可以在这里使用静态链接吗?
最佳答案
对于共享库案例:默认情况下,RTLD 仅应用公共(public)库搜索路径。要添加另一个,请在链接二进制文件时添加一个选项:-Wl,-rpath=$libdir
,例如
gcc test.c -Ithird -Lthird/parserutils/lib_amd64/ -lparserutils -I uchardet/ -L uchardet/ -luchardet -Wl,-rpath=`pwd`/uchardet
此选项将要求 RTLD 也在指定目录中搜索库。可以为此处调用的每个附加目录指定多次。
静态库情况发生了什么,您可以确定对共享库使用 ldd
。它很可能需要 libg++、libstdc++ 或模拟,具体取决于您的系统。如果是这样,您还应该为您的链接添加其静态模拟。即使编译了纯 C 代码,g++
也会自动执行此操作,但 gcc
不会。
关于c++ - 与库的 c 绑定(bind)链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20731614/
#include using namespace std; class C{ private: int value; public: C(){ value = 0;
这个问题已经有答案了: What is the difference between char a[] = ?string?; and char *p = ?string?;? (8 个回答) 已关闭
关闭。此题需要details or clarity 。目前不接受答案。 想要改进这个问题吗?通过 editing this post 添加详细信息并澄清问题. 已关闭 7 年前。 此帖子已于 8 个月
除了调试之外,是否有任何针对 c、c++ 或 c# 的测试工具,其工作原理类似于将独立函数复制粘贴到某个文本框,然后在其他文本框中输入参数? 最佳答案 也许您会考虑单元测试。我推荐你谷歌测试和谷歌模拟
我想在第二台显示器中移动一个窗口 (HWND)。问题是我尝试了很多方法,例如将分辨率加倍或输入负值,但它永远无法将窗口放在我的第二台显示器上。 关于如何在 C/C++/c# 中执行此操作的任何线索 最
我正在寻找 C/C++/C## 中不同类型 DES 的现有实现。我的运行平台是Windows XP/Vista/7。 我正在尝试编写一个 C# 程序,它将使用 DES 算法进行加密和解密。我需要一些实
很难说出这里要问什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或夸夸其谈,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开,visit the help center . 关闭 1
有没有办法强制将另一个 窗口置于顶部? 不是应用程序的窗口,而是另一个已经在系统上运行的窗口。 (Windows, C/C++/C#) 最佳答案 SetWindowPos(that_window_ha
假设您可以在 C/C++ 或 Csharp 之间做出选择,并且您打算在 Windows 和 Linux 服务器上运行同一服务器的多个实例,那么构建套接字服务器应用程序的最明智选择是什么? 最佳答案 如
你们能告诉我它们之间的区别吗? 顺便问一下,有什么叫C++库或C库的吗? 最佳答案 C++ 标准库 和 C 标准库 是 C++ 和 C 标准定义的库,提供给 C++ 和 C 程序使用。那是那些词的共同
下面的测试代码,我将输出信息放在注释中。我使用的是 gcc 4.8.5 和 Centos 7.2。 #include #include class C { public:
很难说出这里问的是什么。这个问题是含糊的、模糊的、不完整的、过于宽泛的或修辞性的,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开它,visit the help center 。 已关
我的客户将使用名为 annoucement 的结构/类与客户通信。我想我会用 C++ 编写服务器。会有很多不同的类继承annoucement。我的问题是通过网络将这些类发送给客户端 我想也许我应该使用
我在 C# 中有以下函数: public Matrix ConcatDescriptors(IList> descriptors) { int cols = descriptors[0].Co
我有一个项目要编写一个函数来对某些数据执行某些操作。我可以用 C/C++ 编写代码,但我不想与雇主共享该函数的代码。相反,我只想让他有权在他自己的代码中调用该函数。是否可以?我想到了这两种方法 - 在
我使用的是编写糟糕的第 3 方 (C/C++) Api。我从托管代码(C++/CLI)中使用它。有时会出现“访问冲突错误”。这使整个应用程序崩溃。我知道我无法处理这些错误[如果指针访问非法内存位置等,
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许提问寻求书籍、工具、软件库等的推荐。您可以编辑问题,以便用事实和引用来回答。 关闭 7 年前。
已关闭。此问题不符合Stack Overflow guidelines 。目前不接受答案。 要求我们推荐或查找工具、库或最喜欢的场外资源的问题对于 Stack Overflow 来说是偏离主题的,因为
我有一些 C 代码,将使用 P/Invoke 从 C# 调用。我正在尝试为这个 C 函数定义一个 C# 等效项。 SomeData* DoSomething(); struct SomeData {
这个问题已经有答案了: Why are these constructs using pre and post-increment undefined behavior? (14 个回答) 已关闭 6
我是一名优秀的程序员,十分优秀!