FMOD结果未被识别为有效类型
FMOD Result not being recognized as a valid type?
我几乎逐字逐句地从fmod教程中复制了以下代码块,并对变量名进行了轻微修改,以免与任何内容发生冲突。我的代码在没有任何fmod语句的情况下编译得很好。当我放入FMOD_RESULT fm_result
行,然后我得到一个错误,说明error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
我有VS2010,如果没有fmod代码,就没有链接器或包含文件错误。错误是关于线fm_result = FMOD::System_Create(&fm_system);
,我在同一线上也得到错误error C2371: 'fm_result' : redefinition; different basic types
。
FMOD_RESULT fm_result;
FMOD::System *fm_system;
fm_result = FMOD::System_Create(&fm_system); // Create the main system object.
if(fm_result != FMOD_OK){
printf("FMOD error! (%d) %sn", fm_result, FMOD_ErrorString(fm_result));
exit(-1);
}
fm_result = fm_system->init(100, FMOD_INIT_NORMAL, 0); // Initialize FMOD.
if(fm_result != FMOD_OK){
printf("FMOD error! (%d) %sn", fm_result, FMOD_ErrorString(fm_result));
exit(-1);
}
我不知道,它一定是关于Visual Studio的东西,或者你没有告诉我们的其他东西…以下内容在GCC 4.6中对我来说很好:
#include <fmod.hpp>
#include <fmod_errors.h>
#include <cstdio>
#include <cstdlib>
int main()
{
FMOD_RESULT fm_result;
FMOD::System *fm_system;
fm_result = FMOD::System_Create(&fm_system); // Create the main system object.
if(fm_result != FMOD_OK)
{
printf("FMOD error! (%d) %sn", fm_result, FMOD_ErrorString(fm_result));
exit(-1);
}
fm_result = fm_system->init(100, FMOD_INIT_NORMAL, 0); // Initialize FMOD.
if(fm_result != FMOD_OK)
{
printf("FMOD error! (%d) %sn", fm_result, FMOD_ErrorString(fm_result));
exit(-1);
}
}
我将fmodapi43405linux.tar.gz
提取到/tmp/
中,并调用如下编译器:
g++ -W -Wall -Wextra -s -O3 -march=native -o prog prog.cpp
-I /tmp/fmodapi43405linux/api/inc/
/tmp/fmodapi43405linux/api/lib/libfmodex.so
如果我附加-std=c++0x
,它也会起作用。
关于错误:错误C4430:缺少类型说明符-假定为int。注意:C++不支持默认的int
如果你在第一次包含FMOD之前放上FMOD_RESULT等等,你就会得到这个。你能确定不是这样吗?也许您有一个包含链,在包含FMOD.h之前使用FMOD_RESULT。
相关文章:
- C++模板 t 不是有效的模板类型
- "std::shared_ptr":不是参数"_Ty"的有效模板类型参数
- 错误:在尝试检测 std::cout 是否<< t 时,功能强制转换为数组类型;有效
- 此递归模板类型定义是否有效C++?
- 用于随机数据访问的最有效文件类型
- 错误 - 自定义数据类型作为有效负载,带有提升::几何
- 从浮点数中删除小数部分但保留类型的有效方法
- 我应该将哪种有效负载类型发送给webrtc::P ayloadRouter的构造函数?
- 将一种数据类型的向量复制到同一数据类型的结构向量中的有效方法是什么
- 张量(多维数组)是树前瞻数据的有效存储类型吗?
- 自定义类型转换运算符在转发引用上调用时不起作用(当对象按值传递时有效)
- 通过 typedef 模板<类型名 T、T> 强制模板实例化 - 为什么有效?
- 为什么重写方法并将 const 添加到参数类型有效
- 这是有效的C++代码吗?(在声明范围之外使用本地类型)
- 如何有效地将底层数据从 std::string 移动到其他类型的变量?
- 作为模板非类型参数的 C 字符串在 gcc 6.3 中有效,但在 Visual Studio 2017(x64 为 19
- 自 C++17 年以来,具有正确地址和类型的指针始终是有效的指针
- 函数类型不是模板非类型参数的有效类型
- boost::enable_if_c 错误:不是模板非类型参数的有效类型
- FMOD结果未被识别为有效类型