C++ Question LNK2019 error despite including directories?

Hlynkacg

Aspiring rocket scientist
Addon Developer
Tutorial Publisher
Donator
Joined
Dec 27, 2010
Messages
1,870
Reaction score
3
Points
0
Location
San Diego
So I'm working with VS2010 and like the title says. I'm getting lnk2019 errors for all functions declared as the part of "ComponentVessel" class despite having instrument.h included in my project and Orbiter/Orbitersdk/samples/common/vessel is on my list of additional include directories. Visual studio clearly knows where to find the file as a right-click + "go to declaration" on the effected functions works normally. Ass such the error clearly lies in the linker. Is there somewhere else I need to add the folder string too?
 

Face

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 18, 2008
Messages
4,403
Reaction score
581
Points
153
Location
Vienna
So I'm working with VS2010 and like the title says. I'm getting lnk2019 errors for all functions declared as the part of "ComponentVessel" class despite having instrument.h included in my project and Orbiter/Orbitersdk/samples/common/vessel is on my list of additional include directories. Visual studio clearly knows where to find the file as a right-click + "go to declaration" on the effected functions works normally. Ass such the error clearly lies in the linker. Is there somewhere else I need to add the folder string too?

Could it be that you try to access a non-virtual method of a class not implemented in your project? If so, the linker does not know where the JMP address is, so it gives you link errors. Try to declare the method virtual, this way the linker knows where to look: the virtual table of the class.
 
Top