链接错误与Poco Net [英] Linking error with Poco Net
问题描述
我尝试建立
时会得到以下结果:架构的未定义符号x86_64:
Poco :: Net :: SocketAddress :: SocketAddress(std :: __ 1 :: basic_string< char,std: :__ 1 :: char_traits< char>,std :: __ 1 :: allocator< char>> const& unsigned short),引用自:
.....
ld:symbol )未找到架构x86_64
现在这里是catch:我链接-lpocoFoundation -lPocoNet - lPocoUtil
我错过了什么?
(我应该说我正在Mac OS X 10.8.2
我也有同样的问题, > 1.4.6。
我唯一需要做的就是再次编译Poco库(因为它是用C + +11支持):
./ configure --config = Darwin64-gcc
make
sudo make安装
另一种方法是使用C ++ 11编译Poco库,它有点复杂。
首先我必须在Foundation中修改两个源文件:
Foundation / src / NumberParser.cpp: b
$ b
127c127
< return std :: sscanf(s.c_str(),%I64_FMTd%c,& value,& temp)== 1;
---
> return std :: sscanf(s.c_str(),%I64_FMTd%c,& value,& temp)== 1;
144c144
< return std :: sscanf(s.c_str(),%I64_FMTu%c,& value,& temp)
---
> return std :: sscanf(s.c_str(),%I64_FMTu%c,& value,& temp)
161c161
< return std :: sscanf(s.c_str(),%I64_FMTx%c,& value,& temp)== 1;
---
> return std :: sscanf(s.c_str(),%I64_FMTx%c,& value,& temp)== 1;
Foundation / src / DirectoryWatcher.cpp:
$ b
51a52
> #include< unistd.h>
我修改了 build / config / Darwin-clang p>
55,56c55,56
< CXXFLAGS = $(ARCHFLAGS)-Wall -Wno-sign-comparison
< LINKFLAGS = $(ARCHFLAGS)
---
> CXXFLAGS = $(ARCHFLAGS)-Wall -Wno-sign-compare -std = c ++ 11 -stdlib = libc ++
> LINKFLAGS = $(ARCHFLAGS)-stdlib = libc ++
80c80
< SYSLIBS = -ldl
---
> SYSLIBS = -ldl -lstdc ++
我只需要静态库,所以我只编译: p>
./ configure --static --omit = Data --config = Darwin64-clang --poquito -no-tests -no-示例-no-shared
make clean
make
sudo make install
如果你还需要样本和测试,那么我想你应该做一个xcode项目并设置它或深入里面的makefiles ...
我希望这个帮助...
I am stuck trying to get some code to build using the POCO libraries.
I get the following when I try to build
Undefined symbols for architecture x86_64:
"Poco::Net::SocketAddress::SocketAddress(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned short)", referenced from:
.....
ld: symbol(s) not found for architecture x86_64
Now here is the catch: I am linking with -lPocoFoundation -lPocoNet -lPocoUtil
What am I missing?
(I should say that I am compiling with clang on Mac OS X 10.8.2
I had the same problem and it worked fine for me what Leezi wrote. I'm using version 1.4.6.
The only thing what I had to do more is to compile the Poco library again (because it was compiled for clang with C++11 support):
./configure --config=Darwin64-gcc
make
sudo make install
The other way what you can do is to compile Poco library with C++11 support, but it's a little bit complicated. First I had to modify two source file in Foundation:
Foundation/src/NumberParser.cpp:
127c127
< return std::sscanf(s.c_str(), "%"I64_FMT"d%c", &value, &temp) == 1;
---
> return std::sscanf(s.c_str(), "%" I64_FMT "d%c", &value, &temp) == 1;
144c144
< return std::sscanf(s.c_str(), "%"I64_FMT"u%c", &value, &temp) == 1;
---
> return std::sscanf(s.c_str(), "%" I64_FMT "u%c", &value, &temp) == 1;
161c161
< return std::sscanf(s.c_str(), "%"I64_FMT"x%c", &value, &temp) == 1;
---
> return std::sscanf(s.c_str(), "%" I64_FMT "x%c", &value, &temp) == 1;
Foundation/src/DirectoryWatcher.cpp:
51a52
> #include <unistd.h>
I modified build/config/Darwin-clang file too:
55,56c55,56
< CXXFLAGS = $(ARCHFLAGS) -Wall -Wno-sign-compare
< LINKFLAGS = $(ARCHFLAGS)
---
> CXXFLAGS = $(ARCHFLAGS) -Wall -Wno-sign-compare -std=c++11 -stdlib=libc++
> LINKFLAGS = $(ARCHFLAGS) -stdlib=libc++
80c80
< SYSLIBS = -ldl
---
> SYSLIBS = -ldl -lstdc++
I needed only for static libraries, so I only compiled that:
./configure --static --omit=Data --config=Darwin64-clang --poquito -no-tests -no-samples -no-shared
make clean
make
sudo make install
If you need for samples and tests too, then I think you should make an xcode project and set up it or go deep inside the makefiles... I hope this help...
这篇关于链接错误与Poco Net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!