API Question Can't use GetClassName

physick

New member
Joined
Aug 10, 2010
Messages
7
Reaction score
0
Points
0
There seems to be something up with Vessel->GetClassName()

If I try to use it I'm getting an unsatisfied reference (I think from from something call GetClassNameW).

I'm using Visual Studio 2010 but this looks like a straight linker error.

Can someone else see if this is replicable?

Thanks
 
In the "Configuration Properties > General" of your project, select "Use Multi-Byte Character Set" for the "Character Set" property. This will solve your issue.

Orbiter uses ANSI and not Widechar/Unicode versions of functions.
 
In my VS 2010 the intellisense autocomplete suggests only GetClassNameA(). It works.

There is no definition of GetClassNameA() in OrbiterAPI. Found this in WinUser.h:
Code:
#ifdef UNICODE
#define GetClassName  GetClassNameW
#else
#define GetClassName  GetClassNameA
#endif // !UNICODE

I'm curious if it is correct to use vessel->GetClassNameA() instead of vessel->GetClassName().
 
Sounds like you're not actually calling the GetClassName in the Vessel class. If you're within the vessel class, use "this->GetClassName()" instead of just GetClassName. If you're calling it on a pointer to a vessel class, post your code.
 
I'm curious if it is correct to use vessel->GetClassNameA() instead of vessel->GetClassName().
It is incorrect. Sometimes Intellisense gets it wrong and you have to type in what you really want - the way we used to do it in the days before Intellisense ;). You could always try writing your code in vim and use its autocomplete options instead :)
 
Sounds like you're not actually calling the GetClassName in the Vessel class. If you're within the vessel class, use "this->GetClassName()" instead of just GetClassName. If you're calling it on a pointer to a vessel class, post your code.
There is a VESSEL method GetClassNameA defined in orbiter.exe (?GetClassNameA@VESSEL@@QBEPADXZ), because Orbiter and OrbiterSDK uses WinUser.h, which defines GetClassName identifier as GetClassNameA when compiled as non-Unicode. Hence the VESSEL::GetClassName is really VESSEL::GetClassNameA.

It is incorrect. Sometimes Intellisense gets it wrong and you have to type in what you really want - the way we used to do it in the days before Intellisense ;). You could always try writing your code in vim and use its autocomplete options instead :)
Using GetClassNameA explicitly isn't incorrect if you know what you're doing, but the correct for Orbiter is to define Multi-byte character set for the project and call it with GetClassName, as other definitions are also different when the UNICODE is defined, and there can be errors when you operate on character strings.


EDIT: Note that VESSEL::GetClassName will be defined as VESSEL::GetClassNameW in the VesselAPI.h header if you use Unicode character set, and because the link library and Orbiter have only defined VESSEL::GetClassNameA, there will be linker error, if you don't redefine the VESSEL class to have there GetClassNameA method instead of GetClassName.
 
Last edited:
Thanks - Changing the character set fixed it. Something else to remeber in the "setup for Orbiter list" when configuring Visual Studio
 
Back
Top