3
votes

I've got trouble using adxdb.h:

I tried to

#include "afxdb.h"

But I recieved this error:

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]

Then I added

#define _AFXDLL

As error message told, and got that dozen of errors:

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

Any ideas on how to make this right? P.S. I'm new to Visual C++

3

3 Answers

5
votes

Don't directly add the #define _AFXDLL, instead that gets added indirectly by a project configuration setting: go to your project property pages | Configuration Properties | General | Use of MFC, and make sure that is set to Use MFC in a Shared DLL.

1
votes

To solve the problem, you need to open Projects-> Proprties-> Configuration Properties> Generation-> Use of MFC: Use MFC in the Shared DLL.

(Visual Studio 2013) And you will be happy!

0
votes

I had the same problem and to solve it I had to make sure that:

#include <afxcmn.h>

is before:

#include <afxdb.h>

So:

#include <afxcmn.h>
#include <afxdb.h>

Is good and:

#include <afxdb.h>
#include <afxcmn.h>

Is bad.