Comments (26)
gcc7.2+即可 支持c17
from cinatra.
在windows上要求vs2017 15.5+版本。
另外编译不通过的错误能否发出来。
from cinatra.
centos7.5
yum install centos-release-scl
yum install devtoolset-7
scl enable devtoolset-7 bash
gcc -v
gcc version 7.3.1 20180303 (Red Hat 7.3.1-5) (GCC)
git clone cinatra
cd cinatra && mkdir gcc-build && cd gcc-build
cmake ..
make
/root/cinatra/uuid.h: In member function ‘uuids::uuid uuids::uuid_system_generator::operator()()’:
/root/cinatra/uuid.h:833:17: error: aggregate ‘uuid_t id’ has incomplete type and cannot be defined
uuid_t id;
^~
/root/cinatra/uuid.h:834:10: error: ‘uuid_generate’ was not declared in this scope
uuid_generate(id);
^~~~~~~~~~~~~
/root/cinatra/uuid.h:834:10: note: suggested alternative: ‘uuid_create’
uuid_generate(id);
^~~~~~~~~~~~~
uuid_create
截图:
from cinatra.
这里需要安装一下uuid库
sudo apt-get install uuid
或者
sudo yum install libuuid-devel.x86_64
from cinatra.
这个库文件已经装过了
Package libuuid-devel-2.23.2-52.el7.x86_64 already installed and latest version
Package uuid-1.6.2-26.el7.x86_64 already installed and latest version
from cinatra.
mac 10.13.6
Apple LLVM version 9.1.0 (clang-902.0.39.2)
http_server.hpp:11:10: fatal error: 'experimental/filesystem' file not found #include <experimental/filesystem>
这个实验性的文件夹已经没有这个文件了
/Library/Developer/CommandLineTools/usr/include/c++/v1/experimental
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/experimental
用clion打开 cinatra 这个工程,也是个找不到这个文件,找的路径也是 上面的路径
from cinatra.
Clang 下是不是已经在std里面了?
from cinatra.
这个错误有点奇怪,按理说你是mac的话,不应该会进到__linux__的编译选项里。
from cinatra.
mac中没有带 filesystem这个头文件 find / 也找不到
#include <any>
connection.hpp:6:10: fatal error: 'any' file not found
std中没有这个头文件
#include <experimental/any>
any头文件 在 experimental
这个试验性功能文件夹中
from cinatra.
你的编译器版本可能低了,或者是你没有打开c++17的编译选项的,any是c++17编译器都支持了的。
from cinatra.
Apple's LLVM and Clang from Xcode 9 are based on version 4.0 of the main LLVM/Clang. You'll need at least LLVM/Clang 5.0 for more C++17 compatibility.
To be fair, modern C++ support is not a priority for Apple, their efforts are more toward Swift.
没准还真是 xcode9系列是基于 llvm/clang-4 的,,,,,不然不会这么奇怪
from cinatra.
https://news.ycombinator.com/item?id=16545037
4个月前的帖子
from cinatra.
已经启用了c++最新草案标准及实验性模块: /std:c++latest /experimental:module
from cinatra.
代码更新导致的编译错误,正在处理。
from cinatra.
@tfjiang 已经修复更新代码即可。
from cinatra.
mac osx 10.13
llvm6.0
clang++ --version
clang version 6.0.1 (tags/RELEASE_601/final)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
编译通过,测试运行正常,,,真是扎心呀,老铁!!!!!!!!!!!
brew install llvm --with-toolchain --with-shared-libs 主要这两项ok
export PATH="/usr/local/opt/llvm/bin:$PATH"
export CC="/usr/local/opt/llvm/bin/clang"
export CXX="/usr/local/opt/llvm/bin/clang++"
这样`cmake ..`时用的 CC CXX 就会是你安装的新版本编译器
需要修改CMakeLists.txt
在 CMakeLists.txt 添加llvm类库搜索路径
link_directories(/usr/local/opt/llvm/lib)
在CMakeLists.txt中替换 -lstdc++fs
为 -lc++experimental
因为llvm中没有这个动态类库(lib),,,,gcc中才带有这个类库(lib)
在cinatra中针对 mac osx 系统,使用的 uuid ,是 #include <CoreFoundation/CFUUID.h> 在项目源文件 uuid.h
所以编译时还需要链接 mac osx 平台自己framework library
在 CMakeLists.txt 中添加 "-framework CoreFoundation"
完整形式
target_link_libraries(cinatra ${Boost_LIBRARIES} uuid -lc++experimental "-framework CoreFoundation")
开始编译
mkdir clang-build && clang-build
cmake ..
make
./cinatra
打开浏览器 看到 ` hello world`
在build目录中(clang-build)/CMakeFiles/cinatra.dir 的几个 文件可以帮助找到一些问题的推断.
from cinatra.
mac上的llvm编译我们没环境测试,现在你测试通过了太棒了,谢谢。
from cinatra.
另外请用最新的代码,最近做了较大的更新。
from cinatra.
囧~
嗯,代码一直用的最近的 git pull
from cinatra.
也许是我这边的问题……?
from cinatra.
@sunhao474 其他头文件呢 还有项目是依赖boost的
from cinatra.
@xmh0511 抱歉没有注意是boost库内部报的错误……跟本项目应该无关,不好意思,我再看看
from cinatra.
m_flag{ ATOMIC_FLAG_INIT }
error C2664: “std::atomic_flag::atomic_flag(const std::atomic_flag &)”: 无法将参数 1 从“initializer list”转换为“const std::atomic_flag &”
vs2019 遇到了这个问题。
from cinatra.
不好意思,升级到最新VS2019 16.1.0以后没错了。
from cinatra.
VC2017 版本15.9.41 X64
严重性 代码 说明 项目 文件 行 禁止显示状态
错误 C2664 “cinatra::simple_client::simple_client(cinatra::simple_client &&)”: 无法将参数 1 从“_Ty2”转换为“const cinatra::simple_client &” ssPixrClient c:\program files (x86)\microsoft visual studio\2017\enterprise\vc\tools\msvc\14.16.27023\include\memory 1801
查了下是这句编译不通过
auto client = cinatra::client_factory::instance().new_client();
from cinatra.
最新代码需要C++20
from cinatra.
Related Issues (20)
- websocket服务端一些问题 HOT 14
- refactor cinatra server to support c++20 coroutine HOT 4
- 编译报错,‘_M_set_length’ is not a member of ‘std::string’ HOT 5
- 如何使用已有的io_context运行cinatra HOT 1
- 如何获取coro_http_client调接口 耗时 HOT 3
- Highly concurrent downloading of 2m js files will increase memory usage HOT 1
- websocket,1分钟没有消息交互,服务端会主动把链接掐断 HOT 2
- Windows visit Chinese filename not found
- 请问下,考虑支持unix套接字吗. HOT 10
- 是否可以让server对象的listen函数支持设置连接队列的长度? HOT 6
- bug: gcc resize_and_overwrite 導致髒數據的問題 HOT 21
- fatal error: 'asio/dispatch.hpp' file not found HOT 2
- https question HOT 18
- Failed to connect websocket with `Connection: upgrade` HOT 3
- [需求] 处理程序相关 HOT 12
- client URL 检测 的奇怪 bug HOT 7
- 上传二进制文件无法使用 HOT 2
- async_download 没有写入内容到文件 HOT 5
- 请问下,当链接断开时,如何获取到具体原因? HOT 3
- 【错误与需求】Nginx与chunked模式 HOT 16
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cinatra.