FMOD 结果未被识别为有效类型?
我从 fmod 教程中几乎逐字复制了以下代码块,并对变量名称进行了细微修改,以免与任何内容发生冲突。我的代码在没有任何 fmod 语句的情况下编译良好。当我输入 FMOD_RESULT fm_result 行及其后面的所有内容时,我收到一条错误,指出错误 C4430:缺少类型说明符 - 假定为 int。注意:C++不支持default-int 我有VS2010,没有fmod代码就没有链接器或包含文件错误。该错误与行 fm_result = FMOD::System_Create(&fm_system);
我还收到错误 error C2371: 'fm_result' : redefinition;不同的基本类型在同一行。
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) %s\n", 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) %s\n", fm_result, FMOD_ErrorString(fm_result));
exit(-1);
}
I have following block of code copied almost verbatim out of the fmod tutorials, with a minor modification of variable names so as not to conflict with anything. My code compiles fine without any of the fmod statements. When I put the FMOD_RESULT fm_result
line and all that follows I get an error stating error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
I have VS2010, there are no linker or include file errors without the fmod code. The error is regarding the line fm_result = FMOD::System_Create(&fm_system);
I also get the error error C2371: 'fm_result' : redefinition; different basic types
on the same line.
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) %s\n", 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) %s\n", fm_result, FMOD_ErrorString(fm_result));
exit(-1);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不知道,这一定是有关 Visual Studio 的问题,或者是您没有告诉我们的其他问题...以下内容在 GCC 4.6 中可以正常编译:
我提取了
fmodapi43405linux.tar.gz
进入/tmp/
并像这样调用编译器:如果我附加
-std=c++0x
,它也可以工作。I don't know, it must be something about Visual Studio, or something else you're not telling us... The following compiles fine with me in GCC 4.6:
I extracted
fmodapi43405linux.tar.gz
into/tmp/
and invoked the compiler like this:It also works if I append
-std=c++0x
.关于错误:
错误 C4430:缺少类型说明符 - 假定为 int。注意:C++ 不支持 default-int
如果您在第一次包含 FMOD 之前放置 FMOD_RESULT blah,则会得到此信息。你能确定情况并非如此吗?也许您有一个包含链在包含 fmod.h 之前使用 FMOD_RESULT。
Regarding the error:
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
You would get this if you put FMOD_RESULT blah before your first include of FMOD. Can you make sure that is not the case? Perhaps you have an include chain that is using FMOD_RESULT before including fmod.h.