SDK Question Need a VS setup refresher

slaver0110

Member
Joined
Mar 21, 2011
Messages
72
Reaction score
2
Points
6
This is a little embarrassing, so please bear with me...
After a year's hiatus, I'm finally able to get back into my vessel and MFD coding.
I've put together an entirely new rig including hard drives, and needless to say, I've had to reinstall everything from scratch. No big deal.
I was using Visual Studio Community 2013 before, and I elected to go with the latest offering I could find, which was VS 2019.
Most of it seems familiar, and relatively easy to navigate.
However, it became readily apparent that I've completely forgotten how to first set up VS to work with the Orbiter API.
I've looked through the various threads, but for some reason I just can't seem to get it right.
(Maybe It's just age taking the form of forgetfulness).
Anyhow, could someone give me the step-by-step? It would be appreciated.
Thanks, and Cheers!!!
 

GLS

Well-known member
Orbiter Contributor
Addon Developer
Joined
Mar 22, 2008
Messages
5,915
Reaction score
2,919
Points
188
Website
github.com
This is a little embarrassing, so please bear with me...
After a year's hiatus, I'm finally able to get back into my vessel and MFD coding.
I've put together an entirely new rig including hard drives, and needless to say, I've had to reinstall everything from scratch. No big deal.
I was using Visual Studio Community 2013 before, and I elected to go with the latest offering I could find, which was VS 2019.
Most of it seems familiar, and relatively easy to navigate.
However, it became readily apparent that I've completely forgotten how to first set up VS to work with the Orbiter API.
I've looked through the various threads, but for some reason I just can't seem to get it right.
(Maybe It's just age taking the form of forgetfulness).
Anyhow, could someone give me the step-by-step? It would be appreciated.
Thanks, and Cheers!!!


I think this quick list should cover it:
- the project should output a dll (no need for "windows stuff");
- you can delete the x64 build configs at it should be x86 (32 bits);
- all the settings below apply to both debug and release builds, so in the project properties having "All Configurations" selected will change this for all builds and save you time;
- the project must include the orbiter libraries (in orbitersdk\lib), so add that path to the libs path and also the libs in it to your project (should be in the Linker tab of the project properties);
- the project must include the orbiter include files (in orbitersdk\include), so add that path to the project (I'm too lazy to check but it should be in the compiler tab of the project properties);
- set the project output to the Modules folder, so you don't have to move the output around everytime you compile.
 

slaver0110

Member
Joined
Mar 21, 2011
Messages
72
Reaction score
2
Points
6
Followed your procedure, and intellisense has stopped complaining about the code, but the compile for a simple vessel gives me errors for lines not even in the code:

CODE: (Simple, very basic vessel to test)
#define STRICT
#define ORBITER_MODULE
#include "orbitersdk.h"

class TestShip : public VESSEL3
{
public:
TestShip (OBJHANDLE hVessel, int flightmodel);
~TestShip ();
void clbkSetClassCaps (FILEHANDLE cfg);
private:
};

TestShip::TestShip (OBJHANDLE hVessel, int flightmodel) : VESSEL3 (hVessel, flightmodel){}
TestShip::~TestShip (){}

void TestShip::clbkSetClassCaps (FILEHANDLE cfg)
{
SetSize (3);
SetEmptyMass (12.0);
SetCameraOffset (_V(0,0.8,0));
AddMesh ("StationCore");
}

DLLCLBK VESSEL *ovcInit (OBJHANDLE hvessel, int flightmodel)
{
return new TestShip (hvessel, flightmodel);
}

DLLCLBK void ovcExit (VESSEL *vessel)
{
if (vessel) delete (TestShip*)vessel;
}

COMPILE ERROR LIST:
Severity Code Description Project File Line Suppression State
Error (active) E0020 identifier "ATMOSPHERE" is undefined TestVessel E:\Orbiter\Orbitersdk\include\CelBodyAPI.h 441
Error (active) E0020 identifier "ATMOSPHERE" is undefined TestVessel E:\Orbiter\Orbitersdk\include\CelBodyAPI.h 486
Error (active) E0020 identifier "ATMOSPHERE" is undefined TestVessel E:\Orbiter\Orbitersdk\include\CelBodyAPI.h 523
Error (active) E0020 identifier "Instrument_User" is undefined TestVessel E:\Orbiter\Orbitersdk\include\MFDAPI.h 265
Error C2440 'return': cannot convert from 'const char [12]' to 'char *' TestVessel E:\Orbiter\Orbitersdk\include\OrbiterAPI.h 7227
With only 33 lines of code, I can't see how it's showing compile errors from lines 441 to 7227...
Obviously, I'm missing something...all I can think of is that I'm botching the setup somehow...
BTW, I appreciate the help.
Cheers!
 

slaver0110

Member
Joined
Mar 21, 2011
Messages
72
Reaction score
2
Points
6
See here: https://www.orbiter-forum.com/showthread.php?t=39252

TL;DR: add
Code:
/Zc:strictStrings-
in the Additional options window in Configuration properties->C/C++->Command line.

That cured the "char" error, but the others still remain. Honestly, I don't recall having these problems with the previous version of VS.
Perhaps Microsoft changed something that is causing this.
Is anyone else using VS 2019?
I've tried using an "Empty Project" approach, but with the same result. I'm using the updated property sheets, with Orbiterroot set to my orbiter directory.
Frustrating...I'm going to keep at it.
Again, I appreciate the help.
Cheers!
 

GLS

Well-known member
Orbiter Contributor
Addon Developer
Joined
Mar 22, 2008
Messages
5,915
Reaction score
2,919
Points
188
Website
github.com
Did you check the Windows CRT SDK when installing VS?
Also, in the general tab of project configuration, what Windows SDK do you have selected?
 

slaver0110

Member
Joined
Mar 21, 2011
Messages
72
Reaction score
2
Points
6
Did you check the Windows CRT SDK when installing VS?
I don't recall VS Setup ever prompting me about it. Is it something I can rectify?

Also, in the general tab of project configuration, what Windows SDK do you have selected?
The Windows SDK reports as "Version 10 (Latest Installed Version)".
Just FYI, I'm running Windows 8.1.

Thanks again, and cheers!
 

GLS

Well-known member
Orbiter Contributor
Addon Developer
Joined
Mar 22, 2008
Messages
5,915
Reaction score
2,919
Points
188
Website
github.com
I don't recall VS Setup ever prompting me about it. Is it something I can rectify?


The Windows SDK reports as "Version 10 (Latest Installed Version)".
Just FYI, I'm running Windows 8.1.

Thanks again, and cheers!

OK, so please rerun the VS setup (or go to installed programs and choose modify).
There should be a place to choose the components to install, and there should be a ton of them to choose from... :facepalm:
Anyway, find the CRT option and select it. Then find the Windows SDK options and check at least one of them (10.0.15063.0 works fine for me, but other should work as well).
After the installer finishes, make sure that the project also has selected the Windows SDK you installed.
 

slaver0110

Member
Joined
Mar 21, 2011
Messages
72
Reaction score
2
Points
6
Ok, so I've spent the last four days (on and off) trying to get VS2019 to cooperate, to no avail.
I've tried the suggested remedies, for which I am grateful for those who tried to help. I have also gone back into the SDK threads, and tried even the seemingly-outdated setup procedures from VS2008. Still, no avail.

Currently, I've been starting with an "Empty Project", and setting up the project from there, using the bare-minimum code (which I listed earlier), applying the Property Sheets, and placing the appropriate settings in the Project Properties.

Strange thing is, I remember it used to take me less than 30-seconds to get the coding underway; I just can't remember how I did it (typical of me).

As embarrassing as it is to ask, anyone have a "from empty project to Orbiter coding" bullet list?

Again, thanks to all who have given the time to respond.
Cheers!!

ETA:
The code is compiling to the Modules directory, but the following errors remain in the Error List:
Severity Code Description Project File Line Suppression State
Error (active) E0020 identifier "ATMOSPHERE" is undefined TestVessel E:\Orbiter\Orbitersdk\include\CelBodyAPI.h 441
Error (active) E0020 identifier "ATMOSPHERE" is undefined TestVessel E:\Orbiter\Orbitersdk\include\CelBodyAPI.h 486
Error (active) E0020 identifier "ATMOSPHERE" is undefined TestVessel E:\Orbiter\Orbitersdk\include\CelBodyAPI.h 523
Error (active) E0020 identifier "Instrument_User" is undefined TestVessel E:\Orbiter\Orbitersdk\include\MFDAPI.h 265
 
Last edited:

GLS

Well-known member
Orbiter Contributor
Addon Developer
Joined
Mar 22, 2008
Messages
5,915
Reaction score
2,919
Points
188
Website
github.com
Let's take another path: could you download my MegaZoomMFD addon from Orbit Hangar? It includes the source files for that very simple project. They are for VS2017, so lets see if your VS updates that simple project. Just unzip it into your Orbiter instalation (no path changes should be required), open the solution file and the update process should begin.
 

slaver0110

Member
Joined
Mar 21, 2011
Messages
72
Reaction score
2
Points
6
Ok, did that, and after redirecting the IDE to my Orbiter\Lib and Orbiter\Include directories, there were absolutely no compile or intellisense errors.

Embarrassingly enough, this means that I did indeed botch the setup somehow.
I'm just looking through the MegaZoomMFD Property Pages. Wouold it be reasonable to assume that all I need to do is copy the entries in there to any fresh project? I'll try anyway, and see what happens.

Again, thanks for taking the time to help; it's much appreciated.
Cheers!
 

ADSWNJ

Scientist
Addon Developer
Joined
Aug 5, 2011
Messages
1,667
Reaction score
3
Points
38
[ame]http://www.youtube.com/watch?v=knftMag1qc8&t=1s[/ame]

I wrote this more as a reminder to my future self, as I am semi-retired from active MFD work these days due to real life.
 
Top