0

I have a very specific problem when trying to compile a 'sample' project for the Orbiter space flight simulator. I'm trying to compile the sample for the space shuttle 'Atlantis' using the preview version of Visual Studio 2019, and I'm getting an error like:

LNK2019 unresolved external symbol "__declspec(dllimport) public: __thiscall VESSEL2::VESSEL2(class VESSEL2 &&)" (__imp_??0VESSEL2@@QAE@$$QAV0@@Z) referenced in function "public: __thiscall Atlantis_SRB::Atlantis_SRB(class Atlantis_SRB &&)" (??0Atlantis_SRB@@QAE@$$QAV0@@Z)

This is happening in the Atlantis_SRB project. My code is located at:

C:\Orbiter2016\Orbitersdk\samples\Atlantis\

I have a lot of experience in software engineering, but I'm a C++ noob. I've looked at general help for this error, so I understand that there is something that needs to be linked, but I'm not sure what, or how to do it.

I looked at this question on the Orbiter forum:

https://www.orbiter-forum.com/showthread.php?t=24247

It suggests checking the following under project > properties:

Linker - Input - Additional libraries

and

Linker - Advanced - Library search paths

When I check under the 1st one, I have the following under Linker > Input > Additional Dependencies:

orbiter.lib;orbitersdk.lib;%(AdditionalDependencies)

The 2nd location (Linker - Advanced - Library search paths) doesn't exist.

I'm used to C# reference errors when dlls are missing from 'references' and know how to solve them quickly, but I'm not sure what to do with this type of C++ issue.

How do I identify what the specific problem is, and what do I need to link, where (and how?!)

Chris Halcrow
  • 28,994
  • 18
  • 176
  • 206
  • Possible duplicate of [What is an undefined reference/unresolved external symbol error and how do I fix it?](https://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix) – Dmytro Dadyka Feb 20 '19 at 02:54
  • Thanks @Dmytro Dadyka, I already looked at the question you've marked as a possible dupe. My issue is more that I'm not sure how to identify which specific resources need to be linked, as the error message doesn't make much sense to me in showing what I need to look for. I'm also hoping someone may have some specific help as to which libraries I need to link, and how. – Chris Halcrow Feb 20 '19 at 04:31
  • 1
    Obviously there is no necessary *.lib file with `VESSEL2` implementation in your "Additional dependencies" list. First you need to find out what additional libraries are needed to build your project. Than you need to add this missing files to Additional Dependencies and specify path to this files in the "Additional Library Directories" – Dmytro Dadyka Feb 20 '19 at 05:41
  • 1
    The *.dll files not related to this error. The error occurs during linking and is caused by the lack of the necessary *.lib file. If you are sure that all *.lib files are listed in the "Additional Dependencies", also check "Linker -> General -> Additional Library Directories" and put path to *.lib files. Make sure that the files are really present (open path in the file explorer) – Dmytro Dadyka Feb 20 '19 at 05:45
  • 1
    If you are sure that all the necessary files and paths are specified, I can only advise one thing - see the *.lib export list using DUMPBIN and find symbols. Maybe it really removed in the new library version. – Dmytro Dadyka Feb 20 '19 at 06:03

1 Answers1

0

I posted this problem on the excellent Orbiter forum, and cyph0r provided a fix there which works with VS2017:

https://www.orbiter-forum.com/showthread.php?p=589264&posted=1#post589264

Basically orbiter.lib seems to only be fully compatible 'out of the box' up to VS2013, and apparently the Atlantis sample compiles fine using VS2013. (I went back to using VS2017 and implemented cyph0r's fix, which works - I haven't tried VS2019):

This is the significant part of the error:

__declspec(dllimport) public: __thiscall VESSEL2::VESSEL2(class VESSEL2 &&)" (__imp_??0VESSEL2@@QAE@$$QAV0@@Z) referenced in function "public: __thiscall Atlantis_SRB::Atlantis_SRB(class Atlantis_SRB &&)

It's indicating that a move constructor is being referenced by the Atlantis_SRB class declaration, which can't be found in VS2017. This is the part that's indicating that the move constructor is being referenced:

__declspec(dllimport) public: __thiscall VESSEL2::VESSEL2(class VESSEL2 &&)

The fix is to remove the expectation that this move constructor exists, by editing the Atlantis.h file within the Atlantis sample. The link to the question on the Orbiter forum gives full details of what you need to do.

Chris Halcrow
  • 28,994
  • 18
  • 176
  • 206