Thread overview | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
July 23, 2003 problems with MFC CArray<,> | ||||
---|---|---|---|---|
| ||||
I am having problems using the MFC template CArray. I am trying to create a CArray of a structure, nothing fancy, and I cannot get it to compile. I have used this successfully under VC++ 6.0 so it is probably just a matter of compiler flags and such. I have the 8.26 CD and have downloaded all the updates. In order to use the CArray<,> I need to include the file <afxtempl.h>. The problem is that if I do include it I get this message: Error: D:\PROGRAM FILES\DM\BIN\..\mfc\include\32-bit\afxtempl.h(305): no But if I do not include the file I get this message: Error: D:\PROJECTS\TESTDLG\CPrompt.h(66): 'CArray' is not a class template match for function '?_P(unsigned ,char *,int )' Thanks! Andy |
July 23, 2003 Re: problems with MFC CArray<,> | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andy C | "Andy C" <Andy_member@pathlink.com> wrote in message news:bfmaki$1f1q$1@digitaldaemon.com... > I am having problems using the MFC template CArray. I am trying to create a > CArray of a structure, nothing fancy, and I cannot get it to compile. I have > used this successfully under VC++ 6.0 so it is probably just a matter of compiler flags and such. I have the 8.26 CD and have downloaded all the updates. > > In order to use the CArray<,> I need to include the file <afxtempl.h>. The > problem is that if I do include it I get this message: > Error: D:\PROGRAM FILES\DM\BIN\..\mfc\include\32-bit\afxtempl.h(305): no Is that all of the error message? It looks truncated. > But if I do not include the file I get this message: > Error: D:\PROJECTS\TESTDLG\CPrompt.h(66): 'CArray' is not a class template > match for function '?_P(unsigned ,char *,int )' > > Thanks! > > Andy > > > |
July 23, 2003 Re: problems with MFC CArray<,> | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andy C | You might have to add afxtempl.h into your stdafx.h
Jan
Andy C wrote:
> I am having problems using the MFC template CArray. I am trying to create a CArray of a structure, nothing fancy, and I cannot get it to compile. I have used this successfully under VC++ 6.0 so it is probably just a matter of compiler flags and such. I have the 8.26 CD and have downloaded all the updates.
>
> In order to use the CArray<,> I need to include the file <afxtempl.h>. The
> problem is that if I do include it I get this message:
> Error: D:\PROGRAM FILES\DM\BIN\..\mfc\include\32-bit\afxtempl.h(305): no
> But if I do not include the file I get this message:
> Error: D:\PROJECTS\TESTDLG\CPrompt.h(66): 'CArray' is not a class template
> match for function '?_P(unsigned ,char *,int )'
>
> Thanks!
>
> Andy
--
ManiaC++
Jan Knepper
|
July 23, 2003 Re: problems with MFC CArray<,> | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jan Knepper | Sorry, my first post got clipped. Here is the code that is in question: ----------------------- #include "stdafx.h" #include <afxtempl.h> #ifdef _DEBUG #undef THIS_FILE static char BASED_CODE THIS_FILE[] = __FILE__; #endif struct my_struct { int a,b,c; CString s; }; void func () { CArray<my_struct,my_struct> ca; } ---------------------------------- When the above is compiled in DEBUG mode it produces the following error. Error: D:\PROGRAM FILES\DM\BIN\..\mfc\include\32-bit\afxtempl.h(305): no match for function '?_P(unsigned ,char *,int )' When compiled in Release mode, or if I don't declare the variable cd, there is no error. Any ideas? Thanks. Andy In article <3F1EC94E.72054AC8@smartsoft.us>, Jan Knepper says... > >You might have to add afxtempl.h into your stdafx.h > >Jan > > > >Andy C wrote: > >> I am having problems using the MFC template CArray. I am trying to create a CArray of a structure, nothing fancy, and I cannot get it to compile. I have used this successfully under VC++ 6.0 so it is probably just a matter of compiler flags and such. I have the 8.26 CD and have downloaded all the updates. >> >> In order to use the CArray<,> I need to include the file <afxtempl.h>. The >> problem is that if I do include it I get this message: >> Error: D:\PROGRAM FILES\DM\BIN\..\mfc\include\32-bit\afxtempl.h(305): no >> But if I do not include the file I get this message: >> Error: D:\PROJECTS\TESTDLG\CPrompt.h(66): 'CArray' is not a class template >> match for function '?_P(unsigned ,char *,int )' >> >> Thanks! >> >> Andy > >-- >ManiaC++ >Jan Knepper > > |
July 23, 2003 Re: problems with MFC CArray<,> | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andy C | Isn't ?_P the mangled name of the overloaded new operator?
Andy C wrote:
> Sorry, my first post got clipped. Here is the code that is in question:
> -----------------------
> #include "stdafx.h"
> #include <afxtempl.h>
>
> #ifdef _DEBUG
> #undef THIS_FILE
> static char BASED_CODE THIS_FILE[] = __FILE__;
> #endif
>
> struct my_struct
> {
> int a,b,c;
> CString s;
> };
>
> void func ()
> {
> CArray<my_struct,my_struct> ca;
> }
> ----------------------------------
>
> When the above is compiled in DEBUG mode it produces the following error.
> Error: D:\PROGRAM FILES\DM\BIN\..\mfc\include\32-bit\afxtempl.h(305):
> no match for function '?_P(unsigned ,char *,int )'
>
> When compiled in Release mode, or if I don't declare the variable cd,
> there is no error. Any ideas?
> Thanks.
>
> Andy
>
> In article <3F1EC94E.72054AC8@smartsoft.us>, Jan Knepper says...
> >
> >You might have to add afxtempl.h into your stdafx.h
> >
> >Jan
> >
> >
> >
> >Andy C wrote:
> >
> >> I am having problems using the MFC template CArray. I am trying to create a CArray of a structure, nothing fancy, and I cannot get it to compile. I have used this successfully under VC++ 6.0 so it is probably just a matter of compiler flags and such. I have the 8.26 CD and have downloaded all the updates.
> >>
> >> In order to use the CArray<,> I need to include the file <afxtempl.h>. The
> >> problem is that if I do include it I get this message:
> >> Error: D:\PROGRAM FILES\DM\BIN\..\mfc\include\32-bit\afxtempl.h(305): no
> >> But if I do not include the file I get this message:
> >> Error: D:\PROJECTS\TESTDLG\CPrompt.h(66): 'CArray' is not a class template
> >> match for function '?_P(unsigned ,char *,int )'
> >>
> >> Thanks!
> >>
> >> Andy
> >
> >--
> >ManiaC++
> >Jan Knepper
> >
> >
--
ManiaC++
Jan Knepper
|
July 23, 2003 Re: problems with MFC CArray<,> | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jan Knepper | I have no idea, but the offending line in "afxtempl.h" is.... m_pData = (TYPE*) new BYTE[nNewSize * sizeof(TYPE)]; Does this help? Andy In article <3F1EF2D7.AE398D51@smartsoft.us>, Jan Knepper says... > >Isn't ?_P the mangled name of the overloaded new operator? > > > >Andy C wrote: > >> Sorry, my first post got clipped. Here is the code that is in question: >> ----------------------- >> #include "stdafx.h" >> #include <afxtempl.h> >> >> #ifdef _DEBUG >> #undef THIS_FILE >> static char BASED_CODE THIS_FILE[] = __FILE__; >> #endif >> >> struct my_struct >> { >> int a,b,c; >> CString s; >> }; >> >> void func () >> { >> CArray<my_struct,my_struct> ca; >> } >> ---------------------------------- >> >> When the above is compiled in DEBUG mode it produces the following error. >> Error: D:\PROGRAM FILES\DM\BIN\..\mfc\include\32-bit\afxtempl.h(305): >> no match for function '?_P(unsigned ,char *,int )' >> >> When compiled in Release mode, or if I don't declare the variable cd, >> there is no error. Any ideas? >> Thanks. >> >> Andy >> >> In article <3F1EC94E.72054AC8@smartsoft.us>, Jan Knepper says... >> > >> >You might have to add afxtempl.h into your stdafx.h >> > >> >Jan >> > >> > >> > >> >Andy C wrote: >> > >> >> I am having problems using the MFC template CArray. I am trying to create a CArray of a structure, nothing fancy, and I cannot get it to compile. I have used this successfully under VC++ 6.0 so it is probably just a matter of compiler flags and such. I have the 8.26 CD and have downloaded all the updates. >> >> >> >> In order to use the CArray<,> I need to include the file <afxtempl.h>. The >> >> problem is that if I do include it I get this message: >> >> Error: D:\PROGRAM FILES\DM\BIN\..\mfc\include\32-bit\afxtempl.h(305): no >> >> But if I do not include the file I get this message: >> >> Error: D:\PROJECTS\TESTDLG\CPrompt.h(66): 'CArray' is not a class template >> >> match for function '?_P(unsigned ,char *,int )' >> >> >> >> Thanks! >> >> >> >> Andy >> > >> >-- >> >ManiaC++ >> >Jan Knepper >> > >> > > >-- >ManiaC++ >Jan Knepper > > |
July 23, 2003 Re: problems with MFC CArray<,> | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andy C | Yes... I think that 'new' should be replaced with DEBUG_NEW.
Andy C wrote:
> I have no idea, but the offending line in "afxtempl.h" is....
> m_pData = (TYPE*) new BYTE[nNewSize * sizeof(TYPE)];
>
> Does this help?
>
> Andy
>
> In article <3F1EF2D7.AE398D51@smartsoft.us>, Jan Knepper says...
> >
> >Isn't ?_P the mangled name of the overloaded new operator?
> >
> >
> >
> >Andy C wrote:
> >
> >> Sorry, my first post got clipped. Here is the code that is in question:
> >> -----------------------
> >> #include "stdafx.h"
> >> #include <afxtempl.h>
> >>
> >> #ifdef _DEBUG
> >> #undef THIS_FILE
> >> static char BASED_CODE THIS_FILE[] = __FILE__;
> >> #endif
> >>
> >> struct my_struct
> >> {
> >> int a,b,c;
> >> CString s;
> >> };
> >>
> >> void func ()
> >> {
> >> CArray<my_struct,my_struct> ca;
> >> }
> >> ----------------------------------
> >>
> >> When the above is compiled in DEBUG mode it produces the following error.
> >> Error: D:\PROGRAM FILES\DM\BIN\..\mfc\include\32-bit\afxtempl.h(305):
> >> no match for function '?_P(unsigned ,char *,int )'
> >>
> >> When compiled in Release mode, or if I don't declare the variable cd,
> >> there is no error. Any ideas?
> >> Thanks.
> >>
> >> Andy
> >>
> >> In article <3F1EC94E.72054AC8@smartsoft.us>, Jan Knepper says...
> >> >
> >> >You might have to add afxtempl.h into your stdafx.h
> >> >
> >> >Jan
> >> >
> >> >
> >> >
> >> >Andy C wrote:
> >> >
> >> >> I am having problems using the MFC template CArray. I am trying to create a CArray of a structure, nothing fancy, and I cannot get it to compile. I have used this successfully under VC++ 6.0 so it is probably just a matter of compiler flags and such. I have the 8.26 CD and have downloaded all the updates.
> >> >>
> >> >> In order to use the CArray<,> I need to include the file <afxtempl.h>. The
> >> >> problem is that if I do include it I get this message:
> >> >> Error: D:\PROGRAM FILES\DM\BIN\..\mfc\include\32-bit\afxtempl.h(305): no
> >> >> But if I do not include the file I get this message:
> >> >> Error: D:\PROJECTS\TESTDLG\CPrompt.h(66): 'CArray' is not a class template
> >> >> match for function '?_P(unsigned ,char *,int )'
> >> >>
> >> >> Thanks!
> >> >>
> >> >> Andy
--
ManiaC++
Jan Knepper
|
July 23, 2003 Re: problems with MFC CArray<,> | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jan Knepper | I thought I had the latest updates from the DM web site. Is there a compiler setting? Is this the first you have heard of this? Should I be doing a global replace in the .h files? Please elaborate on this problem. Thanks. Andy In article <3F1EFDAE.DDFBBE12@smartsoft.us>, Jan Knepper says... > >Yes... I think that 'new' should be replaced with DEBUG_NEW. > > > >Andy C wrote: > >> I have no idea, but the offending line in "afxtempl.h" is.... >> m_pData = (TYPE*) new BYTE[nNewSize * sizeof(TYPE)]; >> >> Does this help? >> >> Andy >> >> In article <3F1EF2D7.AE398D51@smartsoft.us>, Jan Knepper says... >> > >> >Isn't ?_P the mangled name of the overloaded new operator? >> > >> > >> > >> >Andy C wrote: >> > >> >> Sorry, my first post got clipped. Here is the code that is in question: >> >> ----------------------- >> >> #include "stdafx.h" >> >> #include <afxtempl.h> >> >> >> >> #ifdef _DEBUG >> >> #undef THIS_FILE >> >> static char BASED_CODE THIS_FILE[] = __FILE__; >> >> #endif >> >> >> >> struct my_struct >> >> { >> >> int a,b,c; >> >> CString s; >> >> }; >> >> >> >> void func () >> >> { >> >> CArray<my_struct,my_struct> ca; >> >> } >> >> ---------------------------------- >> >> >> >> When the above is compiled in DEBUG mode it produces the following error. >> >> Error: D:\PROGRAM FILES\DM\BIN\..\mfc\include\32-bit\afxtempl.h(305): >> >> no match for function '?_P(unsigned ,char *,int )' >> >> >> >> When compiled in Release mode, or if I don't declare the variable cd, >> >> there is no error. Any ideas? >> >> Thanks. >> >> >> >> Andy >> >> >> >> In article <3F1EC94E.72054AC8@smartsoft.us>, Jan Knepper says... >> >> > >> >> >You might have to add afxtempl.h into your stdafx.h >> >> > >> >> >Jan >> >> > >> >> > >> >> > >> >> >Andy C wrote: >> >> > >> >> >> I am having problems using the MFC template CArray. I am trying to create a CArray of a structure, nothing fancy, and I cannot get it to compile. I have used this successfully under VC++ 6.0 so it is probably just a matter of compiler flags and such. I have the 8.26 CD and have downloaded all the updates. >> >> >> >> >> >> In order to use the CArray<,> I need to include the file <afxtempl.h>. The >> >> >> problem is that if I do include it I get this message: >> >> >> Error: D:\PROGRAM FILES\DM\BIN\..\mfc\include\32-bit\afxtempl.h(305): no >> >> >> But if I do not include the file I get this message: >> >> >> Error: D:\PROJECTS\TESTDLG\CPrompt.h(66): 'CArray' is not a class template >> >> >> match for function '?_P(unsigned ,char *,int )' >> >> >> >> >> >> Thanks! >> >> >> >> >> >> Andy > >-- >ManiaC++ >Jan Knepper > > |
July 23, 2003 Re: problems with MFC CArray<,> | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andy C | Andy C wrote: > I thought I had the latest updates from the DM web site. That is very possible. That version comes out of CVS I think and I have not committed changes to CVS in ages... (Lack of interest) > Is there a compiler setting? No for what? > Is this the first you have heard of this? Not sure... certainly have not seen any other questions about this in particular that I remember. > Should I be doing a global replace in the .h files? You could... Now I am thinking about it, it was one or the other... Either MFC redefined new as DEBUG_NEW or instead of new DEBUG_NEW should be used... Sorry, I work so many different things that I would have to look in the header files to see what is actually being done. What they do in the source files is: #define new DEBUG_NEW They do the same in afxtempl.h Than in afx.h: #defne DEBUG_NEW new(THIS_FILE, __LINE__) which I guess should replace 'new' with DEBUG_NEW with new(THIS_FILE,__LINE__) which is what for some reason is not happening in your code as this would require: operator new ( unsigned, char *, int ); which the compiler does not seem to be able to find... Weird... > Please elaborate on this problem. Enough? > Thanks. > > Andy > > In article <3F1EFDAE.DDFBBE12@smartsoft.us>, Jan Knepper says... > > > >Yes... I think that 'new' should be replaced with DEBUG_NEW. > > > > > > > >Andy C wrote: > > > >> I have no idea, but the offending line in "afxtempl.h" is.... > >> m_pData = (TYPE*) new BYTE[nNewSize * sizeof(TYPE)]; > >> > >> Does this help? > >> > >> Andy > >> > >> In article <3F1EF2D7.AE398D51@smartsoft.us>, Jan Knepper says... > >> > > >> >Isn't ?_P the mangled name of the overloaded new operator? > >> > > >> > > >> > > >> >Andy C wrote: > >> > > >> >> Sorry, my first post got clipped. Here is the code that is in question: > >> >> ----------------------- > >> >> #include "stdafx.h" > >> >> #include <afxtempl.h> > >> >> > >> >> #ifdef _DEBUG > >> >> #undef THIS_FILE > >> >> static char BASED_CODE THIS_FILE[] = __FILE__; > >> >> #endif > >> >> > >> >> struct my_struct > >> >> { > >> >> int a,b,c; > >> >> CString s; > >> >> }; > >> >> > >> >> void func () > >> >> { > >> >> CArray<my_struct,my_struct> ca; > >> >> } > >> >> ---------------------------------- > >> >> > >> >> When the above is compiled in DEBUG mode it produces the following error. > >> >> Error: D:\PROGRAM FILES\DM\BIN\..\mfc\include\32-bit\afxtempl.h(305): > >> >> no match for function '?_P(unsigned ,char *,int )' > >> >> > >> >> When compiled in Release mode, or if I don't declare the variable cd, > >> >> there is no error. Any ideas? > >> >> Thanks. > >> >> > >> >> Andy > >> >> > >> >> In article <3F1EC94E.72054AC8@smartsoft.us>, Jan Knepper says... > >> >> > > >> >> >You might have to add afxtempl.h into your stdafx.h > >> >> > > >> >> >Jan > >> >> > > >> >> > > >> >> > > >> >> >Andy C wrote: > >> >> > > >> >> >> I am having problems using the MFC template CArray. I am trying to create a CArray of a structure, nothing fancy, and I cannot get it to compile. I have used this successfully under VC++ 6.0 so it is probably just a matter of compiler flags and such. I have the 8.26 CD and have downloaded all the updates. > >> >> >> > >> >> >> In order to use the CArray<,> I need to include the file <afxtempl.h>. The > >> >> >> problem is that if I do include it I get this message: > >> >> >> Error: D:\PROGRAM FILES\DM\BIN\..\mfc\include\32-bit\afxtempl.h(305): no > >> >> >> But if I do not include the file I get this message: > >> >> >> Error: D:\PROJECTS\TESTDLG\CPrompt.h(66): 'CArray' is not a class template > >> >> >> match for function '?_P(unsigned ,char *,int )' > >> >> >> > >> >> >> Thanks! > >> >> >> > >> >> >> Andy > > > >-- > >ManiaC++ > >Jan Knepper > > > > |
July 27, 2003 Re: problems with MFC CArray<,> | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jan Knepper | Yes, you are correct. The following 5 lines are present in MS VC++ files: #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif However, Now I get the compile error, (even with the compiler setting for allowing new[] and delete[] operator overloading): Error: D:\PROGRAM FILES\DM\BIN\..\include\stddef.h(78): not an overloadable operator token. Any suggestions? (I have access to VC++ and I will start a list of changes to be able to switch from MS to DM and post it as I learn more.) Thanks! Andy In article <3F1F0A70.756826DE@smartsoft.us>, Jan Knepper says... > >Andy C wrote: > >> I thought I had the latest updates from the DM web site. > >That is very possible. That version comes out of CVS I think and I have not committed changes to CVS in ages... (Lack of interest) > >> Is there a compiler setting? > >No for what? > >> Is this the first you have heard of this? > >Not sure... certainly have not seen any other questions about this in particular that I remember. > >> Should I be doing a global replace in the .h files? > >You could... >Now I am thinking about it, it was one or the other... >Either MFC redefined new as DEBUG_NEW or instead of new DEBUG_NEW should be used... Sorry, >I work so many different things that I would have to look in the header files to see what >is actually being done. >What they do in the source files is: >#define new DEBUG_NEW >They do the same in afxtempl.h > >Than in afx.h: >#defne DEBUG_NEW new(THIS_FILE, __LINE__) > >which I guess should replace 'new' with DEBUG_NEW with new(THIS_FILE,__LINE__) which is >what for some reason is not happening in your code as this would require: >operator new ( unsigned, char *, int ); >which the compiler does not seem to be able to find... Weird... > >> Please elaborate on this problem. > >Enough? > >> Thanks. >> >> Andy >> >> In article <3F1EFDAE.DDFBBE12@smartsoft.us>, Jan Knepper says... >> > >> >Yes... I think that 'new' should be replaced with DEBUG_NEW. >> > >> > >> > >> >Andy C wrote: >> > >> >> I have no idea, but the offending line in "afxtempl.h" is.... >> >> m_pData = (TYPE*) new BYTE[nNewSize * sizeof(TYPE)]; >> >> >> >> Does this help? >> >> >> >> Andy >> >> >> >> In article <3F1EF2D7.AE398D51@smartsoft.us>, Jan Knepper says... >> >> > >> >> >Isn't ?_P the mangled name of the overloaded new operator? >> >> > >> >> > >> >> > >> >> >Andy C wrote: >> >> > >> >> >> Sorry, my first post got clipped. Here is the code that is in question: >> >> >> ----------------------- >> >> >> #include "stdafx.h" >> >> >> #include <afxtempl.h> >> >> >> >> >> >> #ifdef _DEBUG >> >> >> #undef THIS_FILE >> >> >> static char BASED_CODE THIS_FILE[] = __FILE__; >> >> >> #endif >> >> >> >> >> >> struct my_struct >> >> >> { >> >> >> int a,b,c; >> >> >> CString s; >> >> >> }; >> >> >> >> >> >> void func () >> >> >> { >> >> >> CArray<my_struct,my_struct> ca; >> >> >> } >> >> >> ---------------------------------- >> >> >> >> >> >> When the above is compiled in DEBUG mode it produces the following error. >> >> >> Error: D:\PROGRAM FILES\DM\BIN\..\mfc\include\32-bit\afxtempl.h(305): >> >> >> no match for function '?_P(unsigned ,char *,int )' >> >> >> >> >> >> When compiled in Release mode, or if I don't declare the variable cd, >> >> >> there is no error. Any ideas? >> >> >> Thanks. >> >> >> >> >> >> Andy >> >> >> >> >> >> In article <3F1EC94E.72054AC8@smartsoft.us>, Jan Knepper says... >> >> >> > >> >> >> >You might have to add afxtempl.h into your stdafx.h >> >> >> > >> >> >> >Jan >> >> >> > >> >> >> > >> >> >> > >> >> >> >Andy C wrote: >> >> >> > >> >> >> >> I am having problems using the MFC template CArray. I am trying to create a CArray of a structure, nothing fancy, and I cannot get it to compile. I have used this successfully under VC++ 6.0 so it is probably just a matter of compiler flags and such. I have the 8.26 CD and have downloaded all the updates. >> >> >> >> >> >> >> >> In order to use the CArray<,> I need to include the file <afxtempl.h>. The >> >> >> >> problem is that if I do include it I get this message: >> >> >> >> Error: D:\PROGRAM FILES\DM\BIN\..\mfc\include\32-bit\afxtempl.h(305): no >> >> >> >> But if I do not include the file I get this message: >> >> >> >> Error: D:\PROJECTS\TESTDLG\CPrompt.h(66): 'CArray' is not a class template >> >> >> >> match for function '?_P(unsigned ,char *,int )' >> >> >> >> >> >> >> >> Thanks! >> >> >> >> >> >> >> >> Andy >> > >> >-- >> >ManiaC++ >> >Jan Knepper >> > >> > |
Copyright © 1999-2021 by the D Language Foundation