错误如下:
Linking...
InitCamera.obj : error LNK2001: unresolved external symbol "protected: virtual struct AFX_MSGMAP const * __thiscall InitCamera::GetMessageMap(void)const " (?GetMessageMap@InitCamera@@MBEPBUAFX_MSGMAP@@XZ)
Debug/Canoncamera.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.Canoncamera.exe - 2 error(s), 0 warning(s)最近一直出现这个问题,我查了很多关于这方面的解析,但是还是没能找到解决的方案,请高手帮帮忙,谢谢了。个人觉得好像是"protected:.."出问题了,只是一直不知道到底是那错了,郁闷ing...
Linking...
InitCamera.obj : error LNK2001: unresolved external symbol "protected: virtual struct AFX_MSGMAP const * __thiscall InitCamera::GetMessageMap(void)const " (?GetMessageMap@InitCamera@@MBEPBUAFX_MSGMAP@@XZ)
Debug/Canoncamera.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.Canoncamera.exe - 2 error(s), 0 warning(s)最近一直出现这个问题,我查了很多关于这方面的解析,但是还是没能找到解决的方案,请高手帮帮忙,谢谢了。个人觉得好像是"protected:.."出问题了,只是一直不知道到底是那错了,郁闷ing...
以我自己的经历,在实现部分 func(int a);{}多了分号,或者lib文件连接有问题.我刚学的,说错了别BS我,关怀一下就好..
这里是个虚函数...还有AFX_MSGMAP... 不懂
或者是头文件中声明什么变量的时候出错了,
#include "stdafx.h"#include "EDSDK.h"class InitCamera
{
public:
InitCamera();
virtual ~InitCamera();public:
bool InitializeCamera();
bool DestroyCamera();protected:
DECLARE_MESSAGE_MAP()};InitCamera.cpp#include "stdafx.h"
#include "InitCamera.h"InitCamera::InitCamera()
{
}InitCamera::~InitCamera()
{}bool InitCamera::InitializeCamera()
{
EdsError err = EDS_ERR_OK;
bool isSDKLoaded = false;
//初始化SDK
err = EdsInitializeSDK(); if(err == EDS_ERR_OK)
{
isSDKLoaded = true;
}
return false;
}
bool InitCamera::DestroyCamera()
{
return true;
}编译一直就那两个问题
看看楼主有没有这样的低级失误?
{
EdsError err = EDS_ERR_OK;
bool isSDKLoaded = false;
//初始化SDK
err = EdsInitializeSDK(); if(err == EDS_ERR_OK)
{
isSDKLoaded = true;
}
return false;
}这段代码err的类型跟EdsInitializeSDK();的返回值类型是不是不匹配?
想问一下,如何加??我真的是一个菜鸟
别听他忽悠哈^_^
msdn说明:
DECLARE_MESSAGE_MAP
DECLARE_MESSAGE_MAP( )ResEach CCmdTarget-derived class in your program must provide a message map to handle messages. DECLARE_MESSAGE_MAP宏是用来处理消息映射的
你的类如果从CCmdTarget派生则需要声明他
你的这个InitCamera类是从CObject派生的,当然不需要了