错误C2732:链接规范与早期的'log'规范相矛盾

时间:2015-07-29 06:00:00

标签: c++ dll visual-studio-2013

我编写了一些函数,并将其编译为dll模块。在我的头文件中如下:

#ifndef GET_DATAFEED_FORKDB_H
#define GET_DATAFEED_FORKDB_H

#include "..\include\stdafx.h"
#include <windows.h>

#include "..\include\TDFAPI.h"
#include "..\include\TDFAPIStruct.h"
#include "..\include\PathHelper.h"
#include "..\include\ConfigSettings.h"

// some helper functions
// ....

extern "C" void openConnect();
extern "C" void closeConnect();

#endif 

但是,当我使用Visual Studio 2013 Professional编译它时,我遇到了一些错误:

F:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(501) :
  error C2732: linkage specification contradicts earlier specification for  'log'
F:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(501) : 
 see declaration of 'log'
F:\Program Files (x86)\Microsoft Visual Studio12.0\VC\INCLUDE\xtgmath.h(104)
  :error C2732: linkage specification 
  contradicts earlier specification for 'log'
F:\Program Files (x86)\Microsoft Visual Studio12.0\VC\INCLUDE\xtgmath.h(104)
  : see declaration of 'log'
F:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\xlocale(337)
  : warning C4530: C++ exception handler used, but unwind semantics are not 
   enabled. Specify /EHsc

我没有使用数学方法。所以我尝试使用this method来解决它,但它没有用。包含的头文件不能修改,我也试过用这个方法:

 extern "C" {
    #include "..\include\TDFAPI.h"
    #include "..\include\TDFAPIStruct.h"
    #include "..\include\k.h"
    #include "..\include\PathHelper.h"
    #include "..\include\ConfigSettings.h"
  }

,更糟糕的是,它发生了更多错误。

1 个答案:

答案 0 :(得分:1)

我遇到了和你一样的问题。我遇到了和你一样的问题。在包含任何标准标题之后必须放置#include "k.h"