C1189: #error : MFC requires C++ compilation (use a .cpp suffix)
-
Hi! I am trying to use CString in my project, after including the file afx.h I received the following error:"G:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE\afx.h(15) : fatal error C1189: #error : MFC requires C++ compilation (use a .cpp suffix)". I went to project->settings->C/C++ and I choosed "category"->precompiled headers->use precompiled headers and I added stdafx.h I don't understand! the error is still there! Please help!!:rose:
-
Hi! I am trying to use CString in my project, after including the file afx.h I received the following error:"G:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE\afx.h(15) : fatal error C1189: #error : MFC requires C++ compilation (use a .cpp suffix)". I went to project->settings->C/C++ and I choosed "category"->precompiled headers->use precompiled headers and I added stdafx.h I don't understand! the error is still there! Please help!!:rose:
-
Hi! I am trying to use CString in my project, after including the file afx.h I received the following error:"G:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE\afx.h(15) : fatal error C1189: #error : MFC requires C++ compilation (use a .cpp suffix)". I went to project->settings->C/C++ and I choosed "category"->precompiled headers->use precompiled headers and I added stdafx.h I don't understand! the error is still there! Please help!!:rose:
One of the files that include afx.h has a .c or similar ending (VC++ decides whether to use it's C or C++ compiler based on the file extension). Using CString is not as easy as just #including stdafx.h - you need to link with MFC, change compile settings, etc, and get a whole lot of dependencies. You can either use WTL[^], which comes with a perfectly compatible CString class, or "extract" the CString class from the MFC sources (again, complicated, but there#s a Macro on CodeGuru that can do that. Lost the link though...)
"Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
sighist | Agile Programming | doxygen -
One of the files that include afx.h has a .c or similar ending (VC++ decides whether to use it's C or C++ compiler based on the file extension). Using CString is not as easy as just #including stdafx.h - you need to link with MFC, change compile settings, etc, and get a whole lot of dependencies. You can either use WTL[^], which comes with a perfectly compatible CString class, or "extract" the CString class from the MFC sources (again, complicated, but there#s a Macro on CodeGuru that can do that. Lost the link though...)
"Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
sighist | Agile Programming | doxygenI tried to link with MFC, change compile settings...etc but many other errors appeared...I still don't know how to convert from C to C++...beginner's problem! Maybe I will create a dll with all the MFC functions that I'll need and I'll call them from my application. Thanks a lot for your help.