ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Error C2664

4 REPLIES 4
Reply
Message 1 of 5
ehuskamp
774 Views, 4 Replies

Error C2664

I am trying to compile an existing ARX app for AutoCAD 2007. The last time it was compiled was for AutoCAD 2004 and it has worked in 2004, 2005, and 2006.

While trying to compile, I am getting a C2664 error in all the subroutines.

Any ideas ? Is there something I need to have in the includes or something needed to prevent this error ?

I am a novice ObjectArx app, so please don't assume I know much. I'm just trying to compile the code to work in 2007.

1>layermanip.cpp
1>c:\2007project\layermanip.cpp(63) : error C2664: 'acedGetVar' : cannot convert parameter 1 from 'const char [7]' to 'const ACHAR *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\2007project\layermanip.cpp(64) : error C2664: 'acedGetVar' : cannot convert parameter 1 from 'const char [8]' to 'const ACHAR *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\2007project\layermanip.cpp(65) : error C2664: 'acedGetVar' : cannot convert parameter 1 from 'const char [8]' to 'const ACHAR *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\2007project\layermanip.cpp(72) : error C2664: 'acutPrintf' : cannot convert parameter 1 from 'const char [73]' to 'const ACHAR *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\2007project\layermanip.cpp(75) : error C2440: '=' : cannot convert from 'char [5]' to 'ACHAR *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\2007project\layermanip.cpp(89) : error C2440: '=' : cannot convert from 'char *' to 'ACHAR *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\2007project\layermanip.cpp(90) : error C2664: 'acdbFail' : cannot convert parameter 1 from 'const char [31]' to 'const ACHAR *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\2007project\layermanip.cpp(94) : error C2664: 'strcpy' : cannot convert parameter 1 from 'ACHAR *' to 'char *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\2007project\layermanip.cpp(97) : error C2440: '=' : cannot convert from 'char [5]' to 'ACHAR *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\2007project\layermanip.cpp(99) : error C2664: 'acedSSGet' : cannot convert parameter 1 from 'const char [2]' to 'const ACHAR *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\2007project\layermanip.cpp(112) : error C2664: 'acutPrintf' : cannot convert parameter 1 from 'const char [21]' to 'const ACHAR *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\2007project\layermanip.cpp(136) : error C2664: 'acdbFail' : cannot convert parameter 1 from 'const char [28]' to 'const ACHAR *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\2007project\layermanip.cpp(140) : error C2664: 'acdbFail' : cannot convert parameter 1 from 'const char [36]' to 'const ACHAR *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\2007project\layermanip.cpp(143) : error C2440: '=' : cannot convert from 'char *' to 'ACHAR *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\2007project\layermanip.cpp(144) : error C2664: 'acdbFail' : cannot convert parameter 1 from 'const char [31]' to 'const ACHAR *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\2007project\layermanip.cpp(147) : error C2664: 'strcpy' : cannot convert parameter 1 from 'ACHAR *' to 'char *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\2007project\layermanip.cpp(149) : error C2664: 'acedSetVar' : cannot convert parameter 1 from 'const char [8]' to 'const ACHAR *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\2007project\layermanip.cpp(156) : error C2664: 'acdbFail' : cannot convert parameter 1 from 'const char [36]' to 'const ACHAR *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\2007project\layermanip.cpp(159) : error C2664: 'strlen' : cannot convert parameter 1 from 'ACHAR *' to 'const char *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\2007project\layermanip.cpp(160) : error C2664: 'acdbFail' : cannot convert parameter 1 from 'const char [31]' to 'const ACHAR *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\2007project\layermanip.cpp(163) : error C2664: 'strcpy' : cannot convert parameter 1 from 'ACHAR *' to 'char *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\2007project\layermanip.cpp(165) : error C2664: 'acedSetVar' : cannot convert parameter 1 from 'const char [7]' to 'const ACHAR *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\2007project\layermanip.cpp(180) : error C2664: 'acdbFail' : cannot convert parameter 1 from 'const char [36]' to 'const ACHAR *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\2007project\layermanip.cpp(185) : error C2440: '=' : cannot convert from 'char *' to 'ACHAR *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\2007project\layermanip.cpp(186) : error C2664: 'acdbFail' : cannot convert parameter 1 from 'const char [32]' to 'const ACHAR *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\2007project\layermanip.cpp(189) : error C2664: 'strcpy' : cannot convert parameter 1 from 'ACHAR *' to 'char *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\2007project\layermanip.cpp(192) : error C2440: '=' : cannot convert from 'char *' to 'ACHAR *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\2007project\layermanip.cpp(193) : error C2664: 'acdbFail' : cannot convert parameter 1 from 'const char [32]' to 'const ACHAR *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\2007project\layermanip.cpp(196) : error C2664: 'strcpy' : cannot convert parameter 1 from 'ACHAR *' to 'char *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\2007project\layermanip.cpp(199) : error C2440: '=' : cannot convert from 'char *' to 'ACHAR *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\2007project\layermanip.cpp(200) : error C2664: 'acdbFail' : cannot convert parameter 1 from 'const char [32]' to 'const ACHAR *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\2007project\layermanip.cpp(203) : error C2664: 'sprintf' : cannot convert parameter 1 from 'ACHAR *' to 'char *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\2007project\layermanip.cpp(207) : error C2664: 'acedSetVar' : cannot convert parameter 1 from 'const char [8]' to 'const ACHAR *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\2007project\layermanip.cpp(229) : error C2664: 'acdbFail' : cannot convert parameter 1 from 'const char [21]' to 'const ACHAR *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\2007project\layermanip.cpp(238) : error C2664: 'acdbFail' : cannot convert parameter 1 from 'const char [21]' to 'const ACHAR *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\2007project\layermanip.cpp(246) : error C2664: 'acdbFail' : cannot convert parameter 1 from 'const char [21]' to 'const ACHAR *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\2007project\layermanip.cpp(252) : error C2664: 'acdbFail' : cannot convert parameter 1 from 'const char [21]' to 'const ACHAR *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\2007project\layermanip.cpp(258) : error C2664: 'acdbFail' : cannot convert parameter 1 from 'const char [21]' to 'const ACHAR *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\2007project\layermanip.cpp(266) : error C2664: 'acdbFail' : cannot convert parameter 1 from 'const char [21]' to 'const ACHAR *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\2007project\layermanip.cpp(272) : error C2664: 'acdbFail' : cannot convert parameter 1 from 'const char [21]' to 'const ACHAR *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\2007project\layermanip.cpp(291) : error C2440: '=' : cannot convert from 'char [5]' to 'ACHAR *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\2007project\layermanip.cpp(305) : error C2664: 'acdbFail' : cannot convert parameter 1 from 'const char [26]' to 'const ACHAR *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\2007project\layermanip.cpp(313) : error C2664: 'acedSetVar' : cannot convert parameter 1 from 'const char [7]' to 'const ACHAR *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\2007project\layermanip.cpp(314) : error C2664: 'acedSetVar' : cannot convert parameter 1 from 'const char [8]' to 'const ACHAR *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\2007project\layermanip.cpp(324) : error C2664: 'acedGetVar' : cannot convert parameter 1 from 'const char [9]' to 'const ACHAR *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
4 REPLIES 4
Message 2 of 5
Arrowstick
in reply to: ehuskamp

Compiling 2004 applications to 2007 is not that easy 🙂
AutoCAD2007 is a fully Unicode build, 2004 is not a Unicode build.
The type ACHAR from your errormessage is just a typedef for wchar.
In short, all Autodesk functions with a char pararameter are expecting now a wchar parameter.
And this is the background of the erros you have.

What you have to do now is, switch your application also to unicode.

How this is best done, you can find in the Migrationguide, which is part of the arxwhnew.chm in the docs directory of ObjectArx.
Message 3 of 5
csanford34
in reply to: ehuskamp

I'm having a similar problem. I switched the application to unicode, and cast the chars with _T(). One last error i'm still having is.
c:\layertracker\trackerdlg.cpp(267) : error C2065: 'LpcszName' : undeclared identifier

The particular line in the code is
pLayerTblRec->getName (_T(pcszName));

I looked up the definition of the getName function and two of the difinitions take an ACHAR as a param. What am i doing wrong or is there something i'm missing?
Message 4 of 5
Anonymous
in reply to: ehuskamp

For UNICODE, you can't simply wrap your char variables with _T(). All of
your char declarations need to be changed to either TCHAR or ACHAR. When
you set you project up for UNICODE, these two types are set up as w_char.
For Non-UNICODE, they are set up as char. You should only wrap literal
strings with the _T() wrapper ... _T("MyLiteralString").

Joe

wrote in message news:6025456@discussion.autodesk.com...
I'm having a similar problem. I switched the application to unicode, and
cast the chars with _T(). One last error i'm still having is.
c:\layertracker\trackerdlg.cpp(267) : error C2065: 'LpcszName' : undeclared
identifier

The particular line in the code is
pLayerTblRec->getName (_T(pcszName));

I looked up the definition of the getName function and two of the
difinitions take an ACHAR as a param. What am i doing wrong or is there
something i'm missing?
Message 5 of 5
amiltonf
in reply to: ehuskamp

...in other words, the _T macro just sticks an "L" character in front of whatever is between the _T's parentheses if it's a unicode build, so if you code _T(pcszName) it expands to LpcszName which, as you've seen, is not going to work.

To fix it, declare pcszName as a pointer to a TCHAR...

TCHAR* pcszName = 0;
pLayerTblRec->getName(pcszName);

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost