我试图在Visual Studio中创建一个简单的C++项目2015年错误解析外部符号
Peakdetector.h
#ifndef PEAKDETECTOR_H
#define PEAKDETECTOR_H
//-------------------------------------------------------
#ifdef DLL_BUILD_SETUP
#ifdef Q_OS_LINUX
#define DLLSPEC __attribute__((visibility("default")))
#else
#define DLLSPEC __declspec(dllexport)
#endif
#else
#ifdef Q_OS_LINUX
#define DLLSPEC
#else
#define DLLSPEC __declspec(dllimport)
#endif
#endif
namespace vpg {
#ifndef VPG_BUILD_FROM_SOURCE
class DLLSPEC PeakDetector
#else
class PeakDetector
#endif
private:
int __seek(int d) const;
double __getDuration(int start, int stop);
}
inline int PeakDetector::__seek(int d) const
{
return ((m_intervalslength + (d % m_intervalslength)) % m_intervalslength);
}
#endif
PeakDetector.cpp
#include "stdafx.h"
#include "peakdetector.h"
namespace vpg {
void PeakDetector::__updateInterval(double _duration)
{
//other stuff
}
}
当我尝试运行此应用程序我得到错误
LNK2019函数“private:void”中引用的无法解析的外部符号“__declspec(dllimport)private:int __cdecl vpg :: PeakDetector :: __ seek(int)const”(__imp _?_ seek @ PeakDetector @ vpg @@ AEBAHH @ Z) __cdecl VPG :: PeakDetector :: __ updateInterval(双)”(?__ updateInterval @ PeakDetector @ VPG @@ AEAAXN @ Z)MyCustomProject
我是新来这一点,想不通为什么我有这个error.I已只是复制粘贴这个代码从一个例子。请让我知道如果我缺少任何代码。另外我没有任何.lib文件。
C++区分大小写。 –
@NeilButterworth非常感谢你。就像我说的,我对此很新。我应该在这里改变什么?它是'class peakDetector {'?? – Rohit
@Rohit类名“class PeakDetector” – Naidu