469,336 Members | 5,157 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,336 developers. It's quick & easy.

CStringArray (how do I include the .h)

I would like to use CStringArray, but when I try to include afxcol.h my
compiler (VS.NET) complains that...

WINDOWS.H already included. MFC apps must not #include <windows.h>

Any suggestions???
Nov 16 '05 #1
11 9331
Try
#include <afxwin.h>

instead of
#include <afxcoll.h>

--
Cheers
Check Abdoul [ VC++ MVP ]
-----------------------------------

#include <afxwin.h> // MFC core and standard components
"Duncan Winn" <te**@test1.co.uk> wrote in message
news:Os**************@tk2msftngp13.phx.gbl...
I would like to use CStringArray, but when I try to include afxcol.h my
compiler (VS.NET) complains that...

WINDOWS.H already included. MFC apps must not #include <windows.h>

Any suggestions???

Nov 16 '05 #2
Thanks,

but it still comes up with the same error??

"CheckAbdoul" <636865636B6162646F756C406E6F7370616D2E6D7670732E6 F7267> wrote
in message news:uq**************@TK2MSFTNGP12.phx.gbl...
Try
#include <afxwin.h>

instead of
#include <afxcoll.h>

--
Cheers
Check Abdoul [ VC++ MVP ]
-----------------------------------

#include <afxwin.h> // MFC core and standard components
"Duncan Winn" <te**@test1.co.uk> wrote in message
news:Os**************@tk2msftngp13.phx.gbl...
I would like to use CStringArray, but when I try to include afxcol.h my
compiler (VS.NET) complains that...

WINDOWS.H already included. MFC apps must not #include <windows.h>

Any suggestions???


Nov 16 '05 #3
Do you have a

#include <windows.h>
before including
#include <afxwin.h>

If so, remove it.

--
Cheers
Check Abdoul [ VC++ MVP ]
-----------------------------------

"Duncan Winn" <te**@test1.co.uk> wrote in message
news:eU*************@TK2MSFTNGP11.phx.gbl...
Thanks,

but it still comes up with the same error??

"CheckAbdoul" <636865636B6162646F756C406E6F7370616D2E6D7670732E6 F7267> wrote in message news:uq**************@TK2MSFTNGP12.phx.gbl...
Try
#include <afxwin.h>

instead of
#include <afxcoll.h>

--
Cheers
Check Abdoul [ VC++ MVP ]
-----------------------------------

#include <afxwin.h> // MFC core and standard components
"Duncan Winn" <te**@test1.co.uk> wrote in message
news:Os**************@tk2msftngp13.phx.gbl...
I would like to use CStringArray, but when I try to include afxcol.h my compiler (VS.NET) complains that...

WINDOWS.H already included. MFC apps must not #include <windows.h>

Any suggestions???



Nov 16 '05 #4
No I am not including <windows.h> anywhere !!

Thanks,

Duncan


"CheckAbdoul" <636865636B6162646F756C406E6F7370616D2E6D7670732E6 F7267> wrote
in message news:uI*************@TK2MSFTNGP11.phx.gbl...
Do you have a

#include <windows.h>
before including
#include <afxwin.h>

If so, remove it.

--
Cheers
Check Abdoul [ VC++ MVP ]
-----------------------------------

"Duncan Winn" <te**@test1.co.uk> wrote in message
news:eU*************@TK2MSFTNGP11.phx.gbl...
Thanks,

but it still comes up with the same error??

"CheckAbdoul" <636865636B6162646F756C406E6F7370616D2E6D7670732E6 F7267>

wrote
in message news:uq**************@TK2MSFTNGP12.phx.gbl...
Try
#include <afxwin.h>

instead of
#include <afxcoll.h>

--
Cheers
Check Abdoul [ VC++ MVP ]
-----------------------------------

#include <afxwin.h> // MFC core and standard components
"Duncan Winn" <te**@test1.co.uk> wrote in message
news:Os**************@tk2msftngp13.phx.gbl...
> I would like to use CStringArray, but when I try to include afxcol.h my > compiler (VS.NET) complains that...
>
> WINDOWS.H already included. MFC apps must not #include <windows.h>
>
> Any suggestions???
>
>



Nov 16 '05 #5
"Duncan Winn" <te**@test1.co.uk> wrote in message
news:ed**************@TK2MSFTNGP12.phx.gbl...
No I am not including <windows.h> anywhere !!


If all else fails, try turning off the precompiled header option (at least
temporarily) and then rebuild everything.

Regards,
Will
Nov 16 '05 #6
What kind of app is this? And can you show us the includes you do have?

--
Adam Clauss
ca*****@tamu.edu
"Duncan Winn" <te**@test1.co.uk> wrote in message
news:ed**************@TK2MSFTNGP12.phx.gbl...
No I am not including <windows.h> anywhere !!

Thanks,

Duncan


"CheckAbdoul" <636865636B6162646F756C406E6F7370616D2E6D7670732E6 F7267> wrote in message news:uI*************@TK2MSFTNGP11.phx.gbl...
Do you have a

#include <windows.h>
before including
#include <afxwin.h>

If so, remove it.

--
Cheers
Check Abdoul [ VC++ MVP ]
-----------------------------------

"Duncan Winn" <te**@test1.co.uk> wrote in message
news:eU*************@TK2MSFTNGP11.phx.gbl...
Thanks,

but it still comes up with the same error??

"CheckAbdoul" <636865636B6162646F756C406E6F7370616D2E6D7670732E6 F7267>

wrote
in message news:uq**************@TK2MSFTNGP12.phx.gbl...
> Try
> #include <afxwin.h>
>
> instead of
> #include <afxcoll.h>
>
> --
> Cheers
> Check Abdoul [ VC++ MVP ]
> -----------------------------------
>
> #include <afxwin.h> // MFC core and standard components
> "Duncan Winn" <te**@test1.co.uk> wrote in message
> news:Os**************@tk2msftngp13.phx.gbl...
> > I would like to use CStringArray, but when I try to include afxcol.h
my
> > compiler (VS.NET) complains that...
> >
> > WINDOWS.H already included. MFC apps must not #include

<windows.h> > >
> > Any suggestions???
> >
> >
>
>



Nov 16 '05 #7
The error indicates that you are including <windows.h> somewhere. Search
for the text "windows.h" in your project directory and see it if is included
in any header file that gets added before stdafx.h.

--
Cheers
Check Abdoul [ VC++ MVP ]
-----------------------------------

"Duncan Winn" <te**@test1.co.uk> wrote in message
news:ed**************@TK2MSFTNGP12.phx.gbl...
No I am not including <windows.h> anywhere !!

Thanks,

Duncan


"CheckAbdoul" <636865636B6162646F756C406E6F7370616D2E6D7670732E6 F7267> wrote in message news:uI*************@TK2MSFTNGP11.phx.gbl...
Do you have a

#include <windows.h>
before including
#include <afxwin.h>

If so, remove it.

--
Cheers
Check Abdoul [ VC++ MVP ]
-----------------------------------

"Duncan Winn" <te**@test1.co.uk> wrote in message
news:eU*************@TK2MSFTNGP11.phx.gbl...
Thanks,

but it still comes up with the same error??

"CheckAbdoul" <636865636B6162646F756C406E6F7370616D2E6D7670732E6 F7267>

wrote
in message news:uq**************@TK2MSFTNGP12.phx.gbl...
> Try
> #include <afxwin.h>
>
> instead of
> #include <afxcoll.h>
>
> --
> Cheers
> Check Abdoul [ VC++ MVP ]
> -----------------------------------
>
> #include <afxwin.h> // MFC core and standard components
> "Duncan Winn" <te**@test1.co.uk> wrote in message
> news:Os**************@tk2msftngp13.phx.gbl...
> > I would like to use CStringArray, but when I try to include afxcol.h
my
> > compiler (VS.NET) complains that...
> >
> > WINDOWS.H already included. MFC apps must not #include

<windows.h> > >
> > Any suggestions???
> >
> >
>
>



Nov 16 '05 #8
Adam,
What kind of app is this?
An Ole Db Provider
And can you show us the includes you do have?


in the stdafx.h...............
#include <atlbase.h>
#include <atlcom.h>
#include <atlwin.h>
#include <atltypes.h>
#include <atlctl.h>
#include <atlhost.h>
#include <atldb.h>

in my curerent file ...............
stdafx.h
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <String.h>
#include <iostream.h>
#include <atlpath.h>

Thanks

Duncan
Nov 16 '05 #9
Check,

I can not see any place windows.h is includes explicitly. However my
application is an Ole Db provider created using the ATL, and I believe the
ATL may use windows.h?
"CheckAbdoul" <636865636B6162646F756C406E6F7370616D2E6D7670732E6 F7267> wrote
in message news:uU**************@TK2MSFTNGP09.phx.gbl...
The error indicates that you are including <windows.h> somewhere. Search for the text "windows.h" in your project directory and see it if is included in any header file that gets added before stdafx.h.

--
Cheers
Check Abdoul [ VC++ MVP ]
-----------------------------------

"Duncan Winn" <te**@test1.co.uk> wrote in message
news:ed**************@TK2MSFTNGP12.phx.gbl...
No I am not including <windows.h> anywhere !!

Thanks,

Duncan


"CheckAbdoul" <636865636B6162646F756C406E6F7370616D2E6D7670732E6 F7267>

wrote
in message news:uI*************@TK2MSFTNGP11.phx.gbl...
Do you have a

#include <windows.h>
before including
#include <afxwin.h>

If so, remove it.

--
Cheers
Check Abdoul [ VC++ MVP ]
-----------------------------------

"Duncan Winn" <te**@test1.co.uk> wrote in message
news:eU*************@TK2MSFTNGP11.phx.gbl...
> Thanks,
>
> but it still comes up with the same error??
>
>
>
>
>
> "CheckAbdoul" <636865636B6162646F756C406E6F7370616D2E6D7670732E6 F7267> wrote
> in message news:uq**************@TK2MSFTNGP12.phx.gbl...
> > Try
> > #include <afxwin.h>
> >
> > instead of
> > #include <afxcoll.h>
> >
> > --
> > Cheers
> > Check Abdoul [ VC++ MVP ]
> > -----------------------------------
> >
> > #include <afxwin.h> // MFC core and standard components
> > "Duncan Winn" <te**@test1.co.uk> wrote in message
> > news:Os**************@tk2msftngp13.phx.gbl...
> > > I would like to use CStringArray, but when I try to include afxcol.h my
> > > compiler (VS.NET) complains that...
> > >
> > > WINDOWS.H already included. MFC apps must not #include <windows.h> > > >
> > > Any suggestions???
> > >
> > >
> >
> >
>
>



Nov 16 '05 #10
See if the following utility helps you to figure out where the windows.h is
coming from.

http://www.codeguru.com/samples/Includes.shtml

--
Cheers
Check Abdoul [ VC++ MVP ]
-----------------------------------

"Duncan Winn" <te**@test1.co.uk> wrote in message
news:ua**************@TK2MSFTNGP12.phx.gbl...
Check,

I can not see any place windows.h is includes explicitly. However my
application is an Ole Db provider created using the ATL, and I believe the
ATL may use windows.h?
"CheckAbdoul" <636865636B6162646F756C406E6F7370616D2E6D7670732E6 F7267> wrote in message news:uU**************@TK2MSFTNGP09.phx.gbl...
The error indicates that you are including <windows.h> somewhere.

Search
for the text "windows.h" in your project directory and see it if is

included
in any header file that gets added before stdafx.h.

--
Cheers
Check Abdoul [ VC++ MVP ]
-----------------------------------

"Duncan Winn" <te**@test1.co.uk> wrote in message
news:ed**************@TK2MSFTNGP12.phx.gbl...
No I am not including <windows.h> anywhere !!

Thanks,

Duncan


"CheckAbdoul" <636865636B6162646F756C406E6F7370616D2E6D7670732E6 F7267>

wrote
in message news:uI*************@TK2MSFTNGP11.phx.gbl...
> Do you have a
>
> #include <windows.h>
> before including
> #include <afxwin.h>
>
> If so, remove it.
>
> --
> Cheers
> Check Abdoul [ VC++ MVP ]
> -----------------------------------
>
> "Duncan Winn" <te**@test1.co.uk> wrote in message
> news:eU*************@TK2MSFTNGP11.phx.gbl...
> > Thanks,
> >
> > but it still comes up with the same error??
> >
> >
> >
> >
> >
> > "CheckAbdoul" <636865636B6162646F756C406E6F7370616D2E6D7670732E6 F7267> > wrote
> > in message news:uq**************@TK2MSFTNGP12.phx.gbl...
> > > Try
> > > #include <afxwin.h>
> > >
> > > instead of
> > > #include <afxcoll.h>
> > >
> > > --
> > > Cheers
> > > Check Abdoul [ VC++ MVP ]
> > > -----------------------------------
> > >
> > > #include <afxwin.h> // MFC core and standard components
> > > "Duncan Winn" <te**@test1.co.uk> wrote in message
> > > news:Os**************@tk2msftngp13.phx.gbl...
> > > > I would like to use CStringArray, but when I try to include

afxcol.h
> my
> > > > compiler (VS.NET) complains that...
> > > >
> > > > WINDOWS.H already included. MFC apps must not #include

<windows.h>
> > > >
> > > > Any suggestions???
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Nov 16 '05 #11
Thanks Check,

I believe that as I am writing an Ole Db provider the atlbase.h or some
other atl component includes windows.h. So I moved my
#include afxwin.h into the stdafx.h before the following:

#include <atlbase.h>
#include <atlcom.h>
#include <atlwin.h>
#include <atltypes.h>
#include <atlctl.h>
#include <atlhost.h>
#include <atldb.h>

This overcame the windows.h problem but this gave the error....

C2065: 'AtlAllocTaskWideString' : undeclared identifier.

So I got over this by including afxdtctl.h. However when I did this I
got the following errors...

CDFProv error LNK2005: _DllMain@12 already defined in CDFProv.obj
CDFProv error LNK2001: unresolved external symbol ___argc
CDFProv error LNK2001: unresolved external symbol ___argv
CDFProv error LNK2001: unresolved external symbol __mbctype
CDFProv error LNK2001: unresolved external symbol __mbctype

So I also then placed define _AFXDLL before all the #includes
Which left me with the error.....

_DllMain@12 already defined in CDFProv.obj

I was told a way to overcoming this about telling the compiler to ignore
the lib files and then include them in order. I did that but it still
did not get rid of the error??
Any further suggestions???
Nov 16 '05 #12

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

138 posts views Thread by Ian Boyd | last post: by
1 post views Thread by 张沈鹏 | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by haryvincent176 | last post: by
reply views Thread by Marylou17 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.