Are there CStrings without MFC?
Since I am writing a game in DirectX, I am not using MFC; however, I have a class which I created in an old program that I want to bring in my DirectX one which has a few members of CString type. I could write a conversion function, but before I go through the trouble, I was just wondering if there was any way to include CStrings without using the MFC, or the Afx.h file. Thanks for any help/suggestions.
--Vic--
Not AFAIK. Instead of using the CString class, why not use the standard std::string class? Its more portable.
==========================================In a team, you either lead, follow or GET OUT OF THE WAY.
Well, my old program was a dialog based app, and the native text type is CString for dialog based apps in MSVC++. So if I were to use a string, I''d have to convert. If I''m gonna convert, I''ll go to char*, but I just wanted to see if there was any way to do it without converting.
There isn''t a way to use MFC''s CString without the AFX.H file, since that''s the file that defines the class and its functions. MFC insinuates that you don''t have to use MFC in order to use CString, but I''ve never been able to get it to link outside of an MFC project.
You can''t. if you do include CStrings in your game without all the other MFC Windows Hierarchy Baggage then you will be left scratching your head trying to resolve _begintherad, _endthread, which is needed at the link stage.
Do yourself a favour, ween yourself off MFC CString and use std::string.
D.V.
Do yourself a favour, ween yourself off MFC CString and use std::string.
D.V.
D.V.Carpe Diem
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement