【问题标题】:error C4430: missing type specifier - int assumed. Note: C++ does not support default-int - Prev solutions not working错误 C4430:缺少类型说明符 - 假定为 int。注意:C++ 不支持 default-int - Prev 解决方案不起作用
【发布时间】:2016-05-21 00:18:23
【问题描述】:

我正在 Visual Studio 2010 中编译 VC++ 代码。代码中的这一行给出了两个错误:

assert.h
//ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_Export void __ace_assert(const char *file, int line, const ACE_TCHAR *expression);
//ACE_END_VERSIONED_NAMESPACE_DECL

我在这个文件中包含了这些文件:

#include /**/ "ace/pre.h"
#include /**/ "ace/ACE_export.h"
#include /**/ "ace/config-all.h"
#include "ace/Versioned_Namespace.h"

错误:

  1. 错误 C4430:缺少类型说明符 - 假定为 int。注意:C++ 不支持 default-int

  2. 错误 C2143:语法错误:在 '*' 之前缺少 ','

这行有什么问题可能导致这些错误?

我发现其他帖子报告了类似的错误,但到目前为止,没有一个解决方案对我有用。试过了:Error C4430, C2146 - missing type specifier - int assumed. Note: C++ does not support default-int

VC++ missing type specifier - int assumed. Note: C++ does not support default-int

Error 2 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

Compiler error C4430: missing type specifier - int assumed

谢谢。

【问题讨论】:

  • 看起来 Acetchar 没有定义。
  • 哇,这是我第一次看到只有一个代表和金徽章的人。
  • 您是否创建了 ace/config.h 以正确配置 ACE?
  • @Seth - 谢谢,这帮助我解决了这两个错误!看起来他们是有联系的。以供将来参考 - 我在包含区域中添加了 #include /**/ "ace/ACE.h" 并修复了这两个错误!再次感谢。
  • @Johnny - 我在 ace/config.h 中定义了这个 - #include "ace/config-win32.h"。而已。即使我提出这个问题的错误已经解决,但我现在有很多新错误..所以我想知道我的 ACE 配置本身是否错误? ... 包含 config-win32.h 是否正确且足够?

标签: c++ visual-studio-2010 visual-c++ ace tao


【解决方案1】:

如果 assert.h 在您的程序中完全如图所示,那就是问题所在。尝试包括断言。

#include "assert.h"

另外,请确保已定义 ACE_ExportACE_TCHAR

行号和确切的编译器消息会很有帮助。

【讨论】:

  • 谢谢!我在我的代码中包含了 ACE.h,它对 ACE_TCHAR 进行了定义,并且错误消失了。
猜你喜欢
  • 2017-03-28
  • 2022-12-04
  • 2020-03-23
  • 1970-01-01
  • 1970-01-01
  • 2015-01-28
  • 1970-01-01
  • 2013-09-17
  • 1970-01-01
相关资源
最近更新 更多