visual-studio-2008 - Visual C++ 2008,#include "afxdb.h"时出错

标签 visual-studio-2008 afx

我在使用 adxdb.h 时遇到了问题:

我试过了

#include "afxdb.h"

但是我收到了这个错误:

C:\Program Files\Microsoft Visual Studio 9.0\VC\atlmfc\include\afx.h(24) : fatal error C1189: #error : Building MFC application with /MD[d] (CRT dll version) requires MFC shared dll version. Please #define _AFXDLL or do not use /MD[d]

然后我加了

#define _AFXDLL

如错误消息所述,出现了十几个错误:

C:\Program Files\Microsoft Visual Studio 9.0\VC\atlmfc\include\afxole.h(1455) : error C2504: 'CControlBar' : base class undefined
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\atlmfc\include\afxole.h(1470) : error C2146: syntax error : missing ';' before identifier 'm_tracker'
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\atlmfc\include\afxole.h(1470) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\atlmfc\include\afxole.h(1470) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\atlmfc\include\afxpriv.h(590) : error C2504: 'CControlBar' : base class undefined

关于如何做到这一点有什么想法吗? 附言我是 Visual C++ 的新手

最佳答案

不要直接添加#define _AFXDLL,而是通过项目配置设置间接添加:转到您的项目属性页 |配置属性 |一般 |使用 MFC,并确保设置为在共享 DLL 中使用 MFC。

关于visual-studio-2008 - Visual C++ 2008,#include "afxdb.h"时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6193247/

相关文章:

c# - 在客户端机器上安装字体

c++ - 在带有 msvc2008 编译器的 Qt 中使用 afx_msg

c++ - CoCreateInstance 返回 E_INVALIDARG

c++ - __targv 在我的 MFC Windows 应用程序中为 NULL。参数== 1

c++ - boost asio多播重新加入一个组

visual-studio-2008 - VS2008中如何更改扩展区域标题的颜色?

c++ - OpenCV ARDrone 编译问题

C++ 项目在编译时挂起

c++ - 什么是私有(private)MFC,为什么不能通过普通接口(interface)访问?

c++ - CPreviewView 和命令处理程序