Question

I'm working on a project in Qt with the msvc2008 compiler, as the title says.

The sample code, which I'm trying to work from makes use of afx_maps, and as far as I can tell (I don't really have a clue how afx works), the code below means that when the message WM_PI_RAWDATA_READY is received (I have no idea where or how it's received), the function OnRawDataReady is triggered.

//{{AFX_MSG_MAP(CPDImfcDlg)
ON_MESSAGE(WM_PI_RAWDATA_READY, OnRawDataReady )
//}}AFX_MSG_MAP

I tried copying the code into my project, and then adding #include in the header, but it gives me the following error:

D:\Program Files\Microsoft Visual Studio 9.0\VC\ATLMFC\INCLUDE\afx.h:24: 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]

The fixes I've found elsewhere for this seem to be project settings in visual studio, so I'm not sure how to get around it.

Any ideas on how to fix this, or how to work around the afx_msg stuff?

Many thanks

Was it helpful?

Solution

What about just doing what the error message said and #defineing the _AFXDLL preprocessor symbol. Depending on your build environtment you just need to add it to the complier command line as an argument (/D_AFXDLL, if I remember correctly). But when you're working with Qt you probably got a *.pro file anyway and can just add it there (using the DEFINES variable). So just add this line to you *.pro file

DEFINES += _AFXDLL

But just integrating MFC code into a Qt application (which are two completely different GUI and OS abstraction libraries) won't be of too much help, as they both won't work together that good, not to speak of the design issue. Perhaps you can port the application from MFC to Qt.

OTHER TIPS

It basically says that you have to either use static libraries or DLLs. You cannot mix.

Like you say, this is part of the project settings.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top