【发布时间】:2013-11-22 07:45:01
【问题描述】:
我正在使用 VS2008。我收到以下错误。
BUILD: [02:0000000295:ERRORE] c:\wince700\platform\am33x_bsp\src\bootloader\bootpart\bootpart_e.cpp(61) : error C2732: linkage specification contradicts earlier specification for 'SdhcInitialize' {log="C:\WINCE700\platform\AM33X_BSP\SRC\BOOTLOADER\bldsys.log(103)"}
BUILD: [02:0000000297:ERRORE] NMAKE : fatal error U1077: 'C:\WINCE700\sdk\bin\i386\ARM\cl.EXE' : return code '0x2' {log="C:\WINCE700\platform\AM33X_BSP\SRC\BOOTLOADER\bldsys.log(104)"}
BUILD: [02:0000000299:ERRORE] clean TargetCompilePass -nologo BUILDMSG=Stop. BUILDROOT=C:\WINCE700\platform\AM33X_BSP CLEANBUILD=1 NOLINK=1 NOPASS0=1 failed - rc = 2. {log="C:\WINCE700\platform\AM33X_BSP\SRC\BOOTLOADER\bldsys.log(105)"}
file_1.cpp
extern "C"
{
// some extern declarations
extern void SdhcInitialize(DWORD slot);
}
file_2.c
void SdhcInitialize(DWORD slot)
{
//some code
}
请指导我如何解决。
【问题讨论】:
-
什么是
SD_API_STATUS?错误日志中是否写了更多内容?请更新问题以包含完整(且未经编辑的)日志。 -
你确定没有
SdhcInitialize的其他声明/定义? -
我假设这是一个状态码返回类型,而不是带有声明说明符的宏。
-
@JoachimPileborg 这只是一个结构。但是,为简单起见,我用
void更新了我的问题。此外,我还包括了未经编辑的日志。谢谢。 -
您的其他声明是否缺少
extern或有static?您是否在.cpp文件中包含.c文件(例如某些C++ 文件中的#include "file_2.c"). Why not have headerfile_2.h` 以及需要的extern声明,这些声明将包含在其他文件中,而不是在整个文件中都包含externs像你现在这样的地方?
标签: c++ c visual-studio-2008 extern