Friday, July 31, 2009

C++/MFC compilation error, help (c++ newbie)?

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 %26lt;afxwin.h%26gt;








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-%26gt;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?

C++/MFC compilation error, help (c++ newbie)?
From a google search: http://www.thescripts.com/forum/thread46...





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.
Reply:is this VC++ 2005 express, if it is AFAIK MFC is not supported on the express version
Reply: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.


No comments:

Post a Comment