Linking error with Poco Net

◇◆丶佛笑我妖孽 提交于 2019-12-05 19:53:16

I have the same problem. I found change xcode build setting is useful. Change C++ Standard Library from libc++(LLVM C++ standard library with C++ 11 support) to libstdc++(GNU C++ standard library). Then it will pass building.

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...

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!