Question:
C++/MFC compilation error, help (c++ newbie)?
Amr Hassan
2007-05-22 12:06:01 UTC
hi, i'm trying to learn using MFC and the first example i tried out didn't compile on visual c++ 2005. here it is:
i created a win32 empty project and added one source file with the following:

---

#include


class CMyApp : CWinApp
{
public:
virtual BOOL InitInstance();
};

class CMyWindow : CFrameWnd
{
public:
CMyWindow()
{
Create(0, L"My first app, ehi2");
}
};


BOOL CMyApp::InitInstance()
{
m_pMainWindow = new CMyWindow;

m_pMainWindow->ShowWindow(m_nCmdShow);
return TRUE;
}

CMyApp App;

-------

when i compile it says:
"Error 1 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] c:\program files\microsoft visual studio 8\vc\atlmfc\include\afx.h 24 "

what should i do?
Four answers:
csanon
2007-05-22 12:17:07 UTC
From a google search: http://www.thescripts.com/forum/thread465533.html



And, you're writing MFC apps as a C++ newbie? That's terrible. You should learn C++ first before trying to do anything like MFC, GUI, win32 api, etc.
anonymous
2016-05-20 05:58:33 UTC
Check your variables, make sure none of them are undefined. Undefined reference means it's trying to pass a value that is not defined into a function. Make sure your make file compiles all items in correct order, there could be something that depends on something that was compiled before it's dependency was compiled.
malachi_1616
2007-05-22 12:15:53 UTC
Its been a while since I have programmed C++ but off hand you might want to check and make sure you have all the libraries that you are using linked in the properties in Visual Studio.
Nick F
2007-05-22 12:11:55 UTC
is this VC++ 2005 express, if it is AFAIK MFC is not supported on the express version


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...