外部"C"和错误 C4430
extern "C" and error C4430
我在Visual Studio 2008下编译C++项目时遇到错误:
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
错误的行是:extern "C"
错误的行是以下头文件中的第 5 行:
#ifndef _BY_PORT_H
#define _BY_PORT_H
#ifdef __cplusplus
extern "C"
{
#endif
#if ( defined( WIN32 ) || defined(UNDER_CE) )
#if !defined(WIN)
#define WIN
#endif
#endif
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
// Inclusion conditionnelle des headers systŠme
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
#ifdef INCL_SYSTEM
# define INCL_DOS
# define INCL_WIN
# define INCL_GPI
#endif
#if ( defined( INCL_DOS ) || defined( INCL_WIN ) || defined( INCL_GPI ) )
# define SYSTEM_INCLUDED
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
// Inclusion minimum dans Windows.h
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
# define WIN32_LEAN_AND_MEAN
# define _INC_OLE_
# define _OLE2_
# define _WINCON_
# define _WINVER_
# define _WINNETWK_
# define NORASTEROPS
# define OEMRESOURCE
# define NOKERNEL
# define NOUSER
# define NOMETAFILE
# define NOMINMAX
# define NOMSG
# define NOOPENFILE
# define NOSERVICE
# define NOWH
# define NOCOMM
# define NOKANJI
# define NOHELP
# define NOPROFILER
# if !defined(INCL_WIN)
# define NODEFERWINDOWPOS
# endif
# ifdef INCL_WIN
# undef NOUSER
# undef NOMSG
# undef NOOPENFILE
# undef NOWH
# endif
# ifdef INCL_HELP
# undef NOHELP
# endif
# ifdef INCL_GPI
# undef NOMETAFILE
# undef NORASTEROPS
# endif
# ifdef INCL_DOS
# undef NOKERNEL
# endif
# if (defined(UNDER_CE))
# undef NOUSER
# endif
# if defined(UNDER_CE)
# define min(a,b) ((a)<(b))?(a):(b)
# define max(a,b) ((a)>(b))?(a):(b)
# endif
# ifndef STRICT
# define STRICT
# endif
# include <windows.h>
# if ( defined(UNICODE) && !defined(UNDER_CE) )
# undef UNICODE
# endif
# define ANSI_ONLY
# include <commctrl.h>
typedef HDC HPS;
typedef HANDLE HAB;
# ifndef RC_INVOKED
# if ( defined(INCL_WIN) )
# include <windowsx.h>
# endif
# endif
#else
# define TRUE 1
# define FALSE 0
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
// D‚finition des types de donn‚es portables
//ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
typedef char CHAR;
typedef char * PCHAR;
typedef unsigned char UCHAR;
typedef unsigned char BYTE;
typedef short SHORT;
typedef unsigned short USHORT;
typedef unsigned short WORD;
typedef long LONG;
typedef unsigned long ULONG;
typedef unsigned long DWORD;
typedef int INT;
typedef unsigned int UINT;
typedef void VOID;
typedef char * PSZ;
typedef int BOOL;
typedef void * PVOID;
typedef void * HANDLE;
#endif
// ----------------------- Defines communs ------------------------------------
// -------------------------------------------------------------------------------------
#ifdef NULL
#undef NULL
#endif
#define NULL 0
#define CHSTDSEP (char)1
#define SZSTDSEP "1"
typedef char ** PPSZ;
typedef void ** PPVOID;
typedef long Coord;
# define LITTLE_ENDIAN // I386
#if (defined(BYSTATICLIB) || defined (_LIB))
# define DLLIMPORT extern
# define DLLEXPORT
#else
# define DLLIMPORT __declspec( dllimport )
# define DLLEXPORT __declspec( dllexport )
#endif
# define _APIFUNC __stdcall
# define _APICFUNC __cdecl
# define _CALLBFUNC __stdcall
#if defined(BYSTATICLIB)
# define BY_LINK
#else
# define BY_LINK DLLIMPORT
#endif
#define MAX_REGKEY_LENGHT 1024
#if defined (UNDER_CE)
# include <4CE.hpp>
#endif
#ifdef __cplusplus
}
#endif
#endif // _BY_PORT_H
我已经用谷歌搜索了一段时间,但我还没有找到为什么出现 C4430 错误。
有谁知道为什么?
您问题中的代码编译良好。可以在包含它的源文件中找到该问题。该文件将包含#include "..."
语句,该语句在问题中包含头文件,在不适合编写extern "C"
的位置。
相关文章:
- 如何在C++中克服此 C4430 编译器错误?
- 错误:C4430:缺少类型说明符-假定为int.注意:C++不支持default-int
- Qt <winInet.h> 在构建时输出许多 C4430 和 C2146 错误
- 声明 Windows API 结构 (DCB) 的对象 - 错误 C4430:缺少类型说明符 - 假定为 int
- 错误C4430:丢失类型指定词 - 假设INT.注意:C 不支持对我的构造函数的默认设置
- 简单代码给出C 错误C4430和C2143
- 如何修复这些错误:C2146 和 C4430(在 C++ 中)
- C++假定错误 C4430 int
- 错误 C2144 和错误 C4430 在同一行上
- 尝试双重多集对象后出现 C4430 错误
- 模板类中函数的错误 C4430、C2143 和 C2244
- 外部"C"和错误 C4430
- CREATESTRUCT错误C4430:缺少类型说明符-假定为int.注意:C++不支持默认的int C:xdc
- C++编译错误C4430
- 在VC++中使用模板时发生C4430错误
- 缺少类型说明符-int假定C4430错误
- C++快速地板模板:Windows上的Visual Studio出现C4430错误
- c++宏给出了C4430错误:缺少类型说明符
- C2143, c4430错误,不知道原因
- C4430错误-缺少类型说明符-假定为int