can't compile odrx_heap_operators() in rxobject.h
can't compile odrx_heap_operators() in rxobject.h
a couple of .cpp files in my application generate the following compilation errors:
code:
opentype.cpp
<proj_dir>\dwgdirect\include\rxobject.h(358) : error c2059: syntax error : 'constant'
<proj_dir>\dwgdirect\include\rxobject.h(358) : error c2091: function returns function
<proj_dir>\dwgdirect\include\rxobject.h(358) : error c2802: static member 'operator new' has no formal parameters
<proj_dir>\dwgdirect\include\rxobject.h(358) : error c2333: 'odrxobject:

perator new' : error in function declaration; skipping function body
<proj_dir>\dwgdirect\include\rxobject.h(358) : error c2059: syntax error : 'constant'
<proj_dir>\dwgdirect\include\rxobject.h(358) : error c2090: function returns array
<proj_dir>\dwgdirect\include\rxobject.h(358) : error c2059: syntax error : 'return'
<proj_dir>\dwgdirect\include\rxobject.h(358) : error c2238: unexpected token(s) preceding ';'
<proj_dir>\dwgdirect\include\rxobject.h(358) : error c2628: 'odrxobject' followed by 'void' is illegal (did you forget a ';'?)
<proj_dir>\dwgdirect\include\rxobject.h(358) : error c2556: 'odrxobject operator delete[](void *)' : overloaded function differs only by return type from 'void operator delete[](void *) throw()'
c:\program files\microsoft visual studio .net 2003\vc7\include\new(84) : see declaration of 'operator delete[]'
<proj_dir>\dwgdirect\include\rxobject.h(358) : error c2371: 'operator delete[]' : redefinition; different basic types
c:\program files\microsoft visual studio .net 2003\vc7\include\new(84) : see declaration of 'operator delete[]'
<proj_dir>\dwgdirect\include\rxobject.h(358) : error c2365: 'new' : redefinition; previous definition was a 'member function'
<proj_dir>\dwgdirect\include\rxobject.h(358) : error c2078: too many initializers
<proj_dir>\dwgdirect\include\rxobject.h(358) : error c2440: 'initializing' : cannot convert from 'int' to 'void *'
conversion from integral type to pointer type requires reinterpret_cast, c-style cast or function-style cast
<proj_dir>\dwgdirect\include\rxobject.h(358) : error c2143: syntax error : missing ';' before '('
<proj_dir>\dwgdirect\include\rxobject.h(358) : error c2226: syntax error : unexpected type 'size_t'
<proj_dir>\dwgdirect\include\rxobject.h(358) : error c2059: syntax error : ')'
<proj_dir>\dwgdirect\include\rxobject.h(358) : error c2143: syntax error : missing ';' before '{'
<proj_dir>\dwgdirect\include\rxobject.h(358) : error c2447: '{' : missing function header (old-style formal list?)
<proj_dir>\dwgdirect\include\rxobject.h(358) : error c2084: function 'void operator delete(void *,void *) throw()' already has a body
c:\program files\microsoft visual studio .net 2003\vc7\include\new(67) : see previous definition of 'delete'
<proj_dir>\dwgdirect\include\rxobject.h(358) : error c2365: 'new' : redefinition; previous definition was a 'member function'
<proj_dir>\dwgdirect\include\rxobject.h(358) : error c2078: too many initializers
<proj_dir>\dwgdirect\include\rxobject.h(358) : error c2440: 'initializing' : cannot convert from 'int' to 'void *'
conversion from integral type to pointer type requires reinterpret_cast, c-style cast or function-style cast
<proj_dir>\dwgdirect\include\rxobject.h(358) : error c2143: syntax error : missing ';' before '['
<proj_dir>\dwgdirect\include\rxobject.h(358) : error c3409: empty attribute block is not allowed
<proj_dir>\dwgdirect\include\rxobject.h(358) : warning c4091: '' : ignored on left of 'unsigned int' when no variable is declared
<proj_dir>\dwgdirect\include\rxobject.h(358) : error c2143: syntax error : missing ';' before ','
<proj_dir>\dwgdirect\include\rxobject.h(358) : error c2059: syntax error : ','
<proj_dir>\dwgdirect\include\rxobject.h(358) : error c2059: syntax error : '}'
<proj_dir>\dwgdirect\include\rxobject.h(360) : error c2059: syntax error : 'public'
<proj_dir>\dwgdirect\include\rxobject.h(364) : error c2059: syntax error : ')'
<proj_dir>\dwgdirect\include\rxobject.h(364) : error c2143: syntax error : missing ';' before '{'
<proj_dir>\dwgdirect\include\rxobject.h(364) : error c2447: '{' : missing function header (old-style formal list?)
<proj_dir>\dwgdirect\include\rxobject.h(373) : error c2270: 'queryx' : modifiers not allowed on nonmember functions
<proj_dir>\dwgdirect\include\rxobject.h(382) : error c2270: 'x' : modifiers not allowed on nonmember functions
<proj_dir>\dwgdirect\include\rxobject.h(391) : error c2039: 'queryx' : is not a member of 'odrxobject'
<proj_dir>\dwgdirect\include\rxobject.h(347) : see declaration of 'odrxobject'
<proj_dir>\dwgdirect\include\rxobject.h(391) : error c3861: 'desc': identifier not found, even with argument-dependent lookup
<proj_dir>\dwgdirect\include\rxobject.h(399) : error c2365: 'desc' : redefinition; previous definition was a 'formerly unknown identifier'
<proj_dir>\dwgdirect\include\rxobject.h(406) : error c2270: 'isa' : modifiers not allowed on nonmember functions
<proj_dir>\dwgdirect\include\rxobject.h(411) : error c2575: 'addref' : only member functions and bases can be virtual
<proj_dir>\dwgdirect\include\rxobject.h(411) : error c2072: 'addref' : initialization of a function
<proj_dir>\dwgdirect\include\rxobject.h(411) : fatal error c1903: unable to recover from previous error(s); stopping compilation
the errors appear to be generated by the macro expansion of odrx_heap_operators() used to declare members of class odrxobject in rxobject.h.
the two files that experience problems both #include a file ('symwiz.h') that (eventually) #includes the following files:
odacommon.h
dbdatabase.h
tables.h
entities.h
rxobjectimpl.h
other .cpp files #include symwiz.h and do not experience compilation problems.
any ideas on what is going on here and how to fix it?
i am having a very similar problem
i'm getting may of the same compiler errors but i can't seem to figure out why. i triple-checked that i have all the right include files and #defines but something is missing.
if you've resolved this, please let me know how.
thanks
do you redefine operator new?
(mfc wizard often generates #define new _debug_new, or something like that, at the beginning of the file)
may you localize the problem?, maybe build a separate project which produces the same effect, and post it to forum or directly to me, by private message?
last edited by vkalinin; 27th december 2004 at 05:20 amfff">.
i removed _debug_new and it works
since my project redefines new in stdafx.h, i put a "#undef new" after "#include stdafx.h" in every file that uses dwgdirect and it now compiles and runs. thanks.