Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

不能在VS2013中使用 #114

Open
LukeMouse opened this issue Nov 29, 2023 · 8 comments
Open

不能在VS2013中使用 #114

LukeMouse opened this issue Nov 29, 2023 · 8 comments

Comments

@LukeMouse
Copy link

虽然VS2013没有完整的支持C++11,cplusplus_14.h里面对VS2013的兼容没有起到作用,很多constexptr也不能使用,作者还会支持VS2013吗?

@qicosmos
Copy link
Owner

问题应该不大,我好奇的是为啥不升级msvc呢,13都是10年前的版本了,很老了。

@LukeMouse
Copy link
Author

我们的用户都是传统的国企,甚至还有人在用vs2010,更有甚者有的部门居然在用vc6开发,希望能用上您的库,谢谢!!!

@qicosmos
Copy link
Owner

qicosmos commented Dec 6, 2023

能把具体的编译错误贴出来看看吗?

@LukeMouse
Copy link
Author

vs2013中不支持constexpr,根据网上的说法替换成const后,编译example client 报如下错误:
1>------ Rebuild All started: Project: client, Configuration: Debug Win32 ------
1> main.cpp
1>c:\users\administrator\desktop\rest_rpc\include\rest_rpc\meta_util.hpp(11): error C2039: 'index_sequence' : is not a member of 'std'
1>c:\users\administrator\desktop\rest_rpc\include\rest_rpc\meta_util.hpp(11): error C2061: syntax error : identifier 'index_sequence'
1>c:\users\administrator\desktop\rest_rpc\include\rest_rpc\meta_util.hpp(10): error C3547: template parameter 'Idx' cannot be used because it follows a template parameter pack and cannot be deduced from the function parameters of 'rest_rpc::for_each'
1> c:\users\administrator\desktop\rest_rpc\include\rest_rpc\meta_util.hpp(9) : see declaration of 'Idx'
1>c:\users\administrator\desktop\rest_rpc\include\rest_rpc\meta_util.hpp(17): error C2039: 'index_sequence' : is not a member of 'std'
1>c:\users\administrator\desktop\rest_rpc\include\rest_rpc\meta_util.hpp(17): error C2061: syntax error : identifier 'index_sequence'
1>c:\users\administrator\desktop\rest_rpc\include\rest_rpc\meta_util.hpp(16): error C3547: template parameter 'Idx' cannot be used because it follows a template parameter pack and cannot be deduced from the function parameters of 'rest_rpc::for_each_i'
1> c:\users\administrator\desktop\rest_rpc\include\rest_rpc\meta_util.hpp(15) : see declaration of 'Idx'
1>c:\users\administrator\desktop\rest_rpc\include\rest_rpc\meta_util.hpp(82): error C2039: 'index_sequence' : is not a member of 'std'
1>c:\users\administrator\desktop\rest_rpc\include\rest_rpc\meta_util.hpp(82): error C2065: 'index_sequence' : undeclared identifier
1>c:\users\administrator\desktop\rest_rpc\include\rest_rpc\meta_util.hpp(82): error C2143: syntax error : missing ')' before '...'
1>c:\users\administrator\desktop\rest_rpc\include\rest_rpc\meta_util.hpp(82): error C2059: syntax error : ')'
1>c:\users\administrator\desktop\rest_rpc\include\rest_rpc\meta_util.hpp(89): error C2143: syntax error : missing ';' before '{'
1>c:\users\administrator\desktop\rest_rpc\include\rest_rpc\meta_util.hpp(89): error C2447: '{' : missing function header (old-style formal list?)
1>c:\users\administrator\desktop\rest_rpc\include\rest_rpc\meta_util.hpp(96): error C2039: 'index_sequence' : is not a member of 'std'
1>c:\users\administrator\desktop\rest_rpc\include\rest_rpc\meta_util.hpp(96): error C2061: syntax error : identifier 'index_sequence'
1>c:\users\administrator\desktop\rest_rpc\include\rest_rpc\meta_util.hpp(112): error C2039: 'tuple_element_t' : is not a member of 'std'
1>c:\users\administrator\desktop\rest_rpc\include\rest_rpc\meta_util.hpp(112): error C2061: syntax error : identifier 'tuple_element_t'
原因是vs2013中没有index_sequence的定义,cplusplus_14.h有这个定义,但是不好使,不熟悉模板,不知道这块怎么改,谢谢!

@LukeMouse
Copy link
Author

把 #if __cplusplus == 201103L 改成 #if _MSC_VER == 1800后,删除noexcept【vs2013不支持】,再次编译example客户端代码报错如下:
1>c:\users\administrator\desktop\rest_rpc\include\rest_rpc\cplusplus_14.h(63): error C2386: 'enable_if_t' : a symbol with this name already exists in the current scope
1>c:\users\administrator\desktop\rest_rpc\include\rest_rpc\cplusplus_14.h(65): error C2386: 'remove_const_t' : a symbol with this name already exists in the current scope
1>c:\users\administrator\desktop\rest_rpc\include\rest_rpc\cplusplus_14.h(68): error C2386: 'remove_reference_t' : a symbol with this name already exists in the current scope
1>c:\users\administrator\desktop\rest_rpc\include\rest_rpc\cplusplus_14.h(73): error C2386: 'decay_t' : a symbol with this name already exists in the current scope
1>c:\users\administrator\desktop\rest_rpc\include\rest_rpc\meta_util.hpp(35): fatal error C1903: unable to recover from previous error(s); stopping compilation
1> c:\users\administrator\desktop\rest_rpc\include\rest_rpc\meta_util.hpp(43) : see reference to class template instantiation 'rest_rpc::function_traits<Ret(Arg,Args...)>' being compiled

@qicosmos qicosmos mentioned this issue Jan 28, 2024
@qicosmos
Copy link
Owner

拉一下最新代码试一下。

@LukeMouse
Copy link
Author

还是不行,在一些编译错误的文件中,我增加了
#if MSC_VER < 1900
#define constexpr const
#define noexcept
#endif
解决了2013不支持constexpr和noexcept的问题,
通过在构造函数中初始化的方式解决了
std::atomic_bool has_connected
= {false};的编译错误;
但是再次编译还是提示:
error C2248: 'msgpack::v1::sbuffer::sbuffer' : cannot access private member declared in class 'msgpack::v1::sbuffer'
这好像是因为msgpack兼容2013的问题

@qicosmos
Copy link
Owner

qicosmos commented Mar 3, 2024

换新版本的msvc吧

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants