I am working with the API read utilities. One thing is giving me a problem, the char statement in oapiReadItem_string :
The variable in the api call is supposed to be char * (a pointer, right?) and the linker isn't liking the above. I'm not familiar completely familiar with C++ and I am wondering if this has something to do with the length of the string.
This is what I get during linking, I can't make heads or tails of it:
Does anyone see where I am screwing up?
-----Posted Added-----
If I declare only 'char mesh_name', I get the following error:
Here is line 101 of my code:
Any ideas, anyone?
I think the first version of the code above is correct (declaring mesh_name as a pointer variable). I'm not sure if this is some problem with my syntax, or if there is some issue with the general length of the character string.
Code:
char* mesh_name;
void Helicopter::clbkSetClassCaps (FILEHANDLE cfg)
{
oapiReadItem_string (input_file, "MESH_NAME", mesh_name);
}
This is what I get during linking, I can't make heads or tails of it:
Code:
Linking...
Creating library C:OrbiterModulesHelicopter.lib and object C:OrbiterModulesHelicopter.exp
Helicopter.obj : error LNK2019: unresolved external symbol "void * __cdecl operator new[](unsigned int,struct std::_DebugHeapTag_t const &,char *,int)" (??_U@YAPAXIABU_DebugHeapTag_t@std@@PADH@Z) referenced in function "public: char * __cdecl std::_DebugHeapAllocator<char>::allocate(unsigned int,void const *)" (?allocate@?@D@std@@QAAPADIPBX@Z)
Helicopter.obj : error LNK2019: unresolved external symbol "struct std::_DebugHeapTag_t const & __cdecl std::_DebugHeapTag_func(void)" (?_DebugHeapTag_func@std@@YAABU_DebugHeapTag_t@1@XZ) referenced in function "public: char * __cdecl std::_DebugHeapAllocator<char>::allocate(unsigned int,void const *)" (?allocate@?@D@std@@QAAPADIPBX@Z)
C:OrbiterModulesHelicopter.dll : fatal error LNK1120: 2 unresolved externals
-----Posted Added-----
If I declare only 'char mesh_name', I get the following error:
Code:
Compiling...
Helicopter.cpp
c:orbiterorbitersdkmy add-onshelicopterhelicopter.cpp(101) : error C2664: 'oapiReadItem_string' : cannot convert parameter 3 from 'char' to 'char *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
Code:
oapiReadItem_string (input_file, "MESH_NAME", mesh_name);
I think the first version of the code above is correct (declaring mesh_name as a pointer variable). I'm not sure if this is some problem with my syntax, or if there is some issue with the general length of the character string.
Last edited: