visual c++ MSVC dll编译错误,缺少类型说明符和重定义
visual C++ MSVC dll compiling error missing type specifier and redefinition
我正在使用Microsoft Visual Studio Community 2015 Update 3,正在编译一个dll。我想调用InitPreySplitPipe函数,我已经尝试用::pr::InitPreySplitPipe调用它,我将interprocess.cpp代码复制到game_local.cpp和interprocess.hpp代码复制到game_local.h并从那里调用它,但这也不起作用。
如果有人感兴趣,我已经建立了一个GitHub存储库与所有的代码。
谢谢你的阅读,抱歉我的英语不好:/
编译器输出:Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int
Error C2371 'pr::InitPreySplitPipe': redefinition; different basic types
Error C2556 'int InitPreySplitPipe(void)': overloaded function differs only by return type from 'void pr::InitPreySplitPipe(void)'
<标题> interprocess.hpp h1> interprocess.cpp h1> /函数应该被调用的地方
<标题> game_local.cpp h1> div class="answers"> In game_local.cpp:
// PreyRun BEGIN
#include "../PreyRun/interprocess.hpp"
pr::InitPreySplitPipe();
// PreyRun END
你没有从任何内部调用函数,所以编译器认为这是一个新的函数声明。因此,假定类型为int
,其重载函数int pr:InitPreySplitPipe()
与void pr::InitPreySplitPipe()
冲突。这解释了所有3个错误消息。
相关文章:
- 缺少类型说明符,显式类型为"缺少错误"
- 与 tesseract::TessBaseApi() 相关的 Tesseract-OCR 出错(预期的类型说明符)
- 为什么转换函数声明不需要至少一个定义类型说明符
- C++需要所有声明的类型说明符和预期的非限定 id(需要调试帮助)
- printf 数据类型说明符复杂问题
- C++错误:"class name"之前的预期类型说明符
- 缺少类型说明符和另一个问题
- 缺少类型说明符 - 假定为 int.注意 c++ 不支持 default-int
- 错误:C4430:缺少类型说明符-假定为int.注意:C++不支持default-int
- 在C++中出现错误之前,无效使用了不完整的类型和所需的类型说明符
- 缺少类型说明符 - int 假定 声明静态成员后出错
- 不能在类型说明符中定义联合
- 没有带有字符串数组的存储类或类型说明符
- 警告:函数使用不带尾随返回类型的'auto'类型说明符
- 仅为某些模板专用化定义转换运算符:预期类型/预期类型说明符
- 在 C++ 中出现unique_ptr错误之前的预期类型说明符
- 有没有办法将类型说明符存储在变量中
- C 期望类对象的类型说明符
- 是无符号的int"简单类型说明符"
- 在 vscode 上编译错误.类型说明符是 C++11 扩展