0
votes

I'm using c++ (VS 2012) to make a simple user interface for the first time. I got my app to run but the problem I'm having is adding a default value to my edit boxes. Apparently the only way to do this is to add a class to the main window. The code was easy to follow but I get that

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]

error. If I add the #define _AFXDLL I get these errors.

error C2084: function 'CRuntimeClass *CMyDialog::_GetBaseClass(void)' already has a body
error C2374: 'classCMyDialog' : redefinition; multiple initialization
error C2084: function 'CRuntimeClass *CMyDialog::GetThisClass(void)' already has a body
error C2084: function 'CRuntimeClass *CMyDialog::GetRuntimeClass(void) const' already has a body
error C2084: function 'CMyDialog::CMyDialog(CWnd *)' already has a body
error C2084: function 'CMyDialog::~CMyDialog(void)' already has a body
error C2084: function 'void CMyDialog::DoDataExchange(CDataExchange *)' already has a body
error C2084: function 'const AFX_MSGMAP *CMyDialog::GetMessageMap(void) const' already has a body
error C2084: function 'const AFX_MSGMAP *CMyDialog::GetThisMessageMap(void)' already has a body

So I'm a little confused what I'm to do here. I don't have much experience with user interface programming so maybe its just a learning issue.

2
Post some code. Random guess - you have all these functions defined in .h fileAnton Savin
I don't understand, I didn't create the code the IDE did. As a result of right clicking on the main dialog window in the IDE and hitting add class, all of this occurs. Its makes a new H and CPP file. I named them myDialog and its a base class of CDialog. Its adds the include (#include "afxdialogex.h") and because of this the errors above are generated.user2144480

2 Answers

0
votes

You may have placed _AFXDLL in the wrong place. Remove it and then use Project menu, Properties, set Use of MFC to Use MFC in a shared DLL.

0
votes

Wow never mind, I just found the issue, seems the IDE merged the cpp files with another duplicate cpp file. Every function was int here twice, sorry to waste your time.