Advanced Question getting a pointer to a vessel child-class - possible?

*sigh* no joy. Optimisation wasn't even enabled to begin with.

I heeded your other suggestions, but with the same result. It's interesting to notice, though, that the error goes both ways: If orbiter.lib is loaded first, I get the above error. If ummusdk is loaded first, I get the message inversed, I.E. orbiter.lib complaining about ummusdk.lib...

Did I mention that I hate compilers? :facepalm:

---------- Post added at 09:02 AM ---------- Previous post was at 08:23 AM ----------

I cleaned up all my include paths. Both orbitersdk.h and ummusdk.h are only included in one header file now, , without affecting the result.

What strikes as very weird, though, is that I can completely remove ummusdk from the additional dependencies list and the error still persists. I.E. he seems to be linking it although it isn't mentioned anywhere in the project settings.

Removing orbiter.lib from the additional dependencies, though, results in major mayhem, and the two are located in the same directory...
 
What strikes as very weird, though, is that I can completely remove ummusdk from the additional dependencies list and the error still persists. I.E. he seems to be linking it although it isn't mentioned anywhere in the project settings.

Removing orbiter.lib from the additional dependencies, though, results in major mayhem, and the two are located in the same directory...

This is because Dan used a compiler directive in the ummusdk headers:
PHP:
#pragma comment(lib,"UMmuSDK.lib")

According to MSDN, this directive causes the linker to load the referenced library: http://support.microsoft.com/kb/153901

Maybe you can remove this line, so the linker is not doing something you didn't specify?

regards,
Face
 
Can you check if UMmu_ShuttlePB_Example throws the same linker errors after you add to it version checking of some vessel object, e.g.:
Code:
VESSEL * vessel = oapiGetVesselInterface (vesselObject);
if (vessel->Version () >= 2) {/* either do something or nothing */}
This is what I checked, and it linked just fine, until I enabled "Whole Program Optimization". Then it threw your errors for me. But first I changed the project to use Orbiter property sheets, instead of all parameters defined in the project file, and removed all UMmuSDK files from project explorer.

The version of Visual Studio may be important, too. I have Visual C++ Express 2005, 2008 and 2010, and the appropriate version of it opens for loading solution when I open the solution file (from Explorer / FAR manager), so it opened VC++ Express 2005 for UMmu_ShuttlePB_Example for me.
 
Maybe you can remove this line, so the linker is not doing something you didn't specify?

Well, that explains why I could completely remove all references to UMMUsdk.lib from the project and still having it load. Removing the line produces the expected linker errors until I add the lib to the additional dependencies, but alas that doesn't fix the other problem, no matter what loading order.

The version of Visual Studio may be important, too. I have Visual C++ Express 2005, 2008 and 2010, and the appropriate version of it opens for loading solution when I open the solution file (from Explorer / FAR manager), so it opened VC++ Express 2005 for UMmu_ShuttlePB_Example for me.

I did what you recommended (VS 2008 here), and it works without any trouble in the ShuttlePB example. I even added another cpp file which includes ShuttlePB.h just to make sure that it still works if the header is referenced multiple times in the project, and still no problems. Now I seriously don't know what to do. It seems obvious that the problem originates from some compiler option somewhere, but how to find it? Especially if you don't know what half of them mean...

---------- Post added at 01:25 PM ---------- Previous post was at 01:07 PM ----------

CORRECTION: UMMUShuttlePB does produce the error, but only in debug mode. IMS fails in both debug and release mode. Definitaley an unfriendly compiler option somewhere...

---------- Post added at 04:14 PM ---------- Previous post was at 01:25 PM ----------

Phew, got it working finally after playing around with compiler options for hours, comparing them to the shuttlePB example. It started working when I set optimization to maximise speed... wtf? :beathead:
 
It started working when I set optimization to maximise speed... wtf? :beathead:
This option shouldn't matter. I have it set to optimize for size in the ShuttlePB UMmu example, and it's linking fine. Maybe you also changed something else at that time.
 
Back
Top