错误:在 Linux 上编译代码时,'...'之前需要类型说明符
Error: expected type-specifier before '...' when compiling code on linux
所以,我有一些依赖于平台的代码,它使用winusb或libusb在Linux和Windows上编译。我使用预编译器指令来包含正确的头文件并创建正确的接口:
#include "../path/myusbint.hpp"
#ifdef WIN32
#include "../path/winusbint.h"
#else
#include "../path/libusbint.h"
#endif
boost::shared_ptr<myusbinerface> usbinterface;
#ifdef WIN32
usbinterface.reset(new winusbint);
#else
usbinterface.reset(new libusbint);
#endif
在Windows上它可以很好地编译,但是在Linux(gcc(上,我收到错误:
error: expected type-specifier before `libusbint'
error: expected ')' before `libusbint'
可能,您尚未向我们展示的某些代码在尚未声明的位置使用名为 USBInterfaceLibUSB
的类型。您需要向我们展示导致错误的实际代码才能确定。
如果这是正确的类型名称,请确保使用它的任何文件都包含定义该类型的标头,或者如果不需要完整定义,则包含前向声明。
如果名称错误,请将其更改为正确的名称。也许应该myusbinerface
匹配您发布的代码?或者,也许您在真实代码中拼写正确(myusbinterface
(?
相关文章:
- 缺少类型说明符,显式类型为"缺少错误"
- 与 tesseract::TessBaseApi() 相关的 Tesseract-OCR 出错(预期的类型说明符)
- 为什么转换函数声明不需要至少一个定义类型说明符
- C++需要所有声明的类型说明符和预期的非限定 id(需要调试帮助)
- 函数模板签名中忽略的成员类型def 的访问说明符
- printf 数据类型说明符复杂问题
- C++错误:"class name"之前的预期类型说明符
- 缺少类型说明符和另一个问题
- 缺少类型说明符 - 假定为 int.注意 c++ 不支持 default-int
- 错误:C4430:缺少类型说明符-假定为int.注意:C++不支持default-int
- 在C++中出现错误之前,无效使用了不完整的类型和所需的类型说明符
- 如何从指针类型和指针到指针类型中删除__unaligned说明符
- 缺少类型说明符 - int 假定 声明静态成员后出错
- 不能在类型说明符中定义联合
- 没有带有字符串数组的存储类或类型说明符
- 警告:函数使用不带尾随返回类型的'auto'类型说明符
- C++:在嵌套名称说明符中命名的不完整类型
- 仅为某些模板专用化定义转换运算符:预期类型/预期类型说明符
- 创建模板函数的每个实例时,模板函数类型定义说明符是否会正确内联?
- C++17异常说明符类型系统将如何工作