www.digitalmars.com         C & C++   DMDScript  

c++.stlsoft - mfcstl afx.h problems

reply "Cláudio Albuquerque" <cláudio nowhere.com> writes:
Hi Mathew,

We upgraded stlsoft to 1.9.16, and had to do this change on 
mfcstl/mfcstl.hpp  because of the inclusion of the <afx.h>

#if _MFC_VER >= 0x0700 || _ATL_VER >= 0x0700


#else

#include <afx.h> // MFC base header

#endif /* _MFC_VER */



I don't know what other type of dependencies STLSoft has on MFC, but if tell 
me I can try to help you find out if it can be broken into simpler includes.
Because including <afx.h> into an ATL project is somewhat complicated.



Regards
Cláudio
Jan 08 2008
next sibling parent "Cláudio Albuquerque" <cláudio nowhere.com> writes:
Hi Mathew,

Also did this change on the file mfcstl\memory\afx_allocator.hpp line 76 
because of the same issue:

#if _MFC_VER >= 0x0700 || _ATL_VER >= 0x0700
    // did no require the #include <atlstr.h>, though don't know if it's a 
paricularity of the project I'm using on
#else
    #include <afx.h> // MFC base header
#endif /* _MFC_VER */

Regards
Cláudio


"Cláudio Albuquerque" <cláudio nowhere.com> wrote in message 
news:fm09qn$7u4$1 digitalmars.com...
 Hi Mathew,

 We upgraded stlsoft to 1.9.16, and had to do this change on 
 mfcstl/mfcstl.hpp  because of the inclusion of the <afx.h>

 #if _MFC_VER >= 0x0700 || _ATL_VER >= 0x0700


 #else

 #include <afx.h> // MFC base header

 #endif /* _MFC_VER */



 I don't know what other type of dependencies STLSoft has on MFC, but if 
 tell me I can try to help you find out if it can be broken into simpler 
 includes.
 Because including <afx.h> into an ATL project is somewhat complicated.



 Regards
 Cláudio



 
Jan 08 2008
prev sibling parent reply "Matthew Wilson" <matthew hat.stlsoft.dot.org> writes:
Hi Cláudio

I'm a bit confused here. Is it that you're using MFCSTL with ATL and *not*
with MFC, in order to get at some of the CString features? If so, I think
I'd like to handle that more elegantly, and have you be able to access such
functionality via ATLSTL. Otherwise, things are going to get rather messy, I
think.

Please clarify.

Thanks

Matt


"Cláudio Albuquerque" <cláudio nowhere.com> wrote in message
news:fm09qn$7u4$1 digitalmars.com...
 Hi Mathew,

 We upgraded stlsoft to 1.9.16, and had to do this change on
 mfcstl/mfcstl.hpp  because of the inclusion of the <afx.h>

 #if _MFC_VER >= 0x0700 || _ATL_VER >= 0x0700


 #else

 #include <afx.h> // MFC base header

 #endif /* _MFC_VER */



 I don't know what other type of dependencies STLSoft has on MFC, but if
tell
 me I can try to help you find out if it can be broken into simpler
includes.
 Because including <afx.h> into an ATL project is somewhat complicated.



 Regards
 Cláudio
Jan 08 2008
parent "Cláudio Albuquerque" <cláudio nowhere.com> writes:
Hi Mathew,

Yes, I'm using the CString class in an ATL project. I started using the 
MFCSTL CString classes because that was what I found in the STLSoft 
libraries.

Since, I think my first post/explanation regarding this subject, the one 
that caused the change on 1.9.10, was probably poorly explained, so I'm 
going to try to make amends now.

CString class and others (CTime,...) since VC++ 7.0 are implemented has 
shared classes between both libraries. Where for an MFC project you should 
use <cstringt.h>, on the other hand for an ATL project the <atlstr.h> should 
be used.

So, if your idea is to "replicate" the MFCSTL CString classes to ATLSTL then 
my suggestion is to use the <atlstr.h> on the ATL part and the on the 
<cstringt.h> MFC part.
Either way in my tests, though I'm only using some small part of the MFCSTL 
CString classes, I didn't see the necessity for VC++ 7.0 and above to 
include such an heavy file like <afx.h>. My suggestion is, if possible, to 
include <cstringt.h> instead.

If you are going with only one definition for both libraries ATL and MFC a 
clear separation of the files to include can be achived with _MFC_VER and 
_ATL_VER defines.

Finally, since I'm the only one with problems on this issue, if you need any 
type of help just say so.

Thanks
Cláudio Albuquerque

"Matthew Wilson" <matthew hat.stlsoft.dot.org> wrote in message 
news:fm1ao9$2o3h$1 digitalmars.com...
 Hi Cláudio

 I'm a bit confused here. Is it that you're using MFCSTL with ATL and *not*
 with MFC, in order to get at some of the CString features? If so, I think
 I'd like to handle that more elegantly, and have you be able to access 
 such
 functionality via ATLSTL. Otherwise, things are going to get rather messy, 
 I
 think.

 Please clarify.

 Thanks

 Matt


 "Cláudio Albuquerque" <cláudio nowhere.com> wrote in message
 news:fm09qn$7u4$1 digitalmars.com...
 Hi Mathew,

 We upgraded stlsoft to 1.9.16, and had to do this change on
 mfcstl/mfcstl.hpp  because of the inclusion of the <afx.h>

 #if _MFC_VER >= 0x0700 || _ATL_VER >= 0x0700


 #else

 #include <afx.h> // MFC base header

 #endif /* _MFC_VER */



 I don't know what other type of dependencies STLSoft has on MFC, but if
tell
 me I can try to help you find out if it can be broken into simpler
includes.
 Because including <afx.h> into an ATL project is somewhat complicated.



 Regards
 Cláudio
Jan 09 2008