C ++不允许定义dllimport静态数据成员

时间:2015-07-07 22:51:12

标签: c++ visual-studio-2010 visual-c++ dllimport

我正在尝试将某些软件的源/头编译成静态库,但遇到了这个dll问题。我无法将其运行,标准#ifndef / #define _declspec(...)无效。我没有大量的C ++经验,所以我可能只是缺少重要的东西。任何帮助将不胜感激。

错误发生在源代码部分的最后4行,但我不知道如何修复它。

这里的标题和来源有点太长了,但这是jist:

头(.h):

#ifdef CONVERSIONDLL_EXPORTS
#define CONVERSIONDLL_API __declspec(dllexport) 
#else
#define CONVERSIONDLL_API __declspec(dllimport) 
#endif

#ifndef ConversionUtility_h
#define ConversionUtility_h

#include <Config.h>
#include <iostream>
using namespace std;

#include <math.h>
#include <stdio.h>
#include <string>

#include <PropertyFileHandler.h>
#include <GWProperties.h>
#include <PureDataS.h>
#include <PureDataI.h>

class MSR_EXPORT Conversions {

    Msr::GWFramework::Component::PropertyFileHandler propertyFileHandler_;
double sea_level_corr_;

    public:
        double static const PI;
        double static const DEGREES_PER_RADIAN;
        double static const FEET_PER_METER;
        unsigned short static RTCODE_WGS_1984_IDENTITY;
    ...

源(的.cpp):

#include <CountdownTimer.h>
#include "ConversionUtility.h"
#include <Rotation.h>
#include <MsrConversionErrorException.h>
#include <sstream>
#include <stdlib.h>
#include <ctime>
#include <GWTime.h>
#include <GWManagerDefines.h>


double const Conversions::PI = 3.14159265359; // low precision: atan(1.0)*4;
double const Conversions::DEGREES_PER_RADIAN = 180/PI;
double const Conversions::FEET_PER_METER = 1/0.3048;
unsigned short Conversions::RTCODE_WGS_1984_IDENTITY = 341; // from TENA-TSPI tdl

0 个答案:

没有答案