C++ Question VC++ problem

Pithecanthropu

New member
Joined
Jan 23, 2009
Messages
32
Reaction score
0
Points
0
Just a quick note--even people who know a lot about programming can have problems with add-on development if they (a) haven't done any C++ in awhile and (b) until they become familiar with the architecture. I'm having the same issue as the OP, but it looks like there's some good advice here. I'll come back and read the thread later, and see if it gets me over this problem.
 

tblaxland

O-F Administrator
Administrator
Addon Developer
Webmaster
Joined
Jan 1, 2008
Messages
7,344
Reaction score
10
Points
113
Location
Sydney, Australia
I have VS 2008?
Huh? :blink::huh:
That's what "C:\Program Files\Microsoft Visual Studio 9.0" tells us. EDIT: Either you have it, or you used to have it.

How do I use it?
Start|All Programs|... ;)

T.Neo said:
Done that, but now it says it cannot find windows.h again...
From the directories you posted, I would expect to find windows.h in "C:\Program Files\Microsoft Platform SDK\Include". Is that in your list of include directories?
 

T.Neo

SA 2010 Soccermaniac
Addon Developer
Joined
Jun 22, 2008
Messages
6,377
Reaction score
0
Points
0
From the directories you posted, I would expect to find windows.h in "C:program FilesMicrosoft Platform SDKInclude". Is that in your list of include directories?
No. But when I add it, I get that whole long line of funny error messages again:
Code:
Creating library .......Modules/ShuttlePB.lib and object .......Modules/ShuttlePB.exp
ShuttlePB.obj : error LNK2001: unresolved external symbol "const type_info::`vftable'" ([email protected]@[email protected])
ShuttlePB.obj : error LNK2019: unresolved external symbol "void __cdecl operator delete(void *)" ([email protected]@Z) referenced in function "public: virtual void * __thiscall LaunchpadItem::`scalar deleting destructor'(unsigned int)" ([email protected]@[email protected])
ShuttlePB.obj : error LNK2019: unresolved external symbol "void __cdecl operator delete[](void *)" ([email protected]@Z) referenced in function "public: virtual void * __thiscall LaunchpadItem::`vector deleting destructor'(unsigned int)" ([email protected]@[email protected])
ShuttlePB.obj : error LNK2019: unresolved external symbol "void __stdcall `eh vector destructor iterator'(void *,unsigned int,int,void (__thiscall*)(void *))" ([email protected]@[email protected]) referenced in function "public: virtual void * __thiscall LaunchpadItem::`vector deleting destructor'(unsigned int)" ([email protected]@[email protected])
ShuttlePB.obj : error LNK2001: unresolved external symbol __fltused
ShuttlePB.obj : error LNK2001: unresolved external symbol __purecall
ShuttlePB.obj : error LNK2019: unresolved external symbol "void * __cdecl operator new(unsigned int)" ([email protected]@Z) referenced in function _ovcInit
LINK : error LNK2001: unresolved external symbol [email protected]
.......Modules/ShuttlePB.dll : fatal error LNK1120: 8 unresolved externals
 
Last edited:

tblaxland

O-F Administrator
Administrator
Addon Developer
Webmaster
Joined
Jan 1, 2008
Messages
7,344
Reaction score
10
Points
113
Location
Sydney, Australia
No. But when I add it, I get that whole long line of funny error messages again:
What is your setting for Project|Properties|Configuration Properties|C/C++|Code Generation|Runtime Library? My guess is that you are compiling as Multi-threaded DLL (/MD) but are ignoring msvcrt.lib (under Project|Properties|Configuration Properties|Linker|Input|Ignore Specific Library).
 

MajorTom

Ker-splash!
Addon Developer
Donator
Joined
Mar 28, 2008
Messages
354
Reaction score
1
Points
0
Location
Puget Sound
Sorry to break in here, but maybe, just maybe, this thread will help:

http://www.orbiter-forum.com/showthread.php?t=5999

(I've had numerous issues, some similar to T.Neo's, building my compiler, and EveningSky's advice was to basically wipe the slate clean then try again. Disclaimer: I've not yet tried the advice.)
 

T.Neo

SA 2010 Soccermaniac
Addon Developer
Joined
Jun 22, 2008
Messages
6,377
Reaction score
0
Points
0
Ah, yes. I tried redoing my directories, but not removing them first.
I'll try that.
 

tblaxland

O-F Administrator
Administrator
Addon Developer
Webmaster
Joined
Jan 1, 2008
Messages
7,344
Reaction score
10
Points
113
Location
Sydney, Australia
T.Neo, just to put further emphasis on my last post, I could replicate your errors exactly with those settings (Multi-threaded DLL (/MD) & ignore msvcrt.lib). Either don't ignore msvcrt.lib or change to Multi-threaded (/MT).
 

T.Neo

SA 2010 Soccermaniac
Addon Developer
Joined
Jun 22, 2008
Messages
6,377
Reaction score
0
Points
0
T.Neo, just to put further emphasis on my last post, I could replicate your errors exactly with those settings (Multi-threaded DLL (/MD) & ignore msvcrt.lib). Either don't ignore msvcrt.lib or change to Multi-threaded (/MT).
Changing to multi-threaded did the trick!
It compiled!

Now I must see if it works correctly...
 

computerex

Addon Developer
Addon Developer
Joined
Oct 16, 2007
Messages
1,283
Reaction score
16
Points
0
Location
Florida
Steps for making a VC++ 2008 project:

***The platform SDK is not required to compile an Orbiter project if you are using VC++ 2008!

Compiling ShuttlePB

To compile ShuttlePB, simply open the dsp file that is included within the SDK. Once it is open, right click on the project in solution explorer, and click on properties. Inside the configuration type category, make sure the configuration is set as a "dynamic library", and not "executable". Under C/C++->Code generation, make sure the runtime libraries are set to Multi-threaded (M/T), and not "Multi-threaded DLL". Under C++ general, make sure to add the include library ..\..\include. This is the path to the Orbiter SDK's include directory assuming that the project lies inside a folder located within the sample's folder. Relative paths are easier to work with then absolute paths. So make sure to put the appropriete relative path for your configuration! Once you have set the include directory, go to linker->general and add the Orbiter SDK's library directory in the project. Again, for ShuttlePB, this will be ..\..\lib. Add the path and name to the output directory. For creating a vessel (as in this case) the output path would be ..\..\..\Modules\ShuttlePB.dll. For MFD's and other plug-ins, the output path would be..\..\..\Modules\Plugin\myModule.dll. Click on "Input", and add "msvcirt.lib, msvcrt.lib" inside the "Ignore Specific Libraries" field. Click OK to save the settings. Then right click on the project in the solution explorer, and click on add->Add existing items. Navigate to Orbiter SDK's lib directory, and add the Orbiter.lib and OrbiterSDK.lib. If a dialog box pops up asking something about rules, hit no. Once that is done, you are ready to make a few modifications to the code in order for the ShuttlePB to compile. Change the line:

Code:
for (int i = 0; i < nlift-1 && AOA[i+1] < aoa; i++);
to:

Code:
int i;
for (i = 0; i < nlift-1 && AOA[i+1] < aoa; i++);
The reason for this change is because there is a bug inside the VC++ 2003 compiler. i is used outside the scope it's declared in. This needs to be changed for the code to successfully compile. Once the modifications are done (you may need to modify the code in another place in the code) you are ready to compile the project. Simply click on build, and build project.
 

T.Neo

SA 2010 Soccermaniac
Addon Developer
Joined
Jun 22, 2008
Messages
6,377
Reaction score
0
Points
0
Now, when I try to compile Delta Glider, it says it cannot find " orbitersdk.h". I'm sure I have this file, as I have the SDK, yet it says this.
How do I fix this?
 

Hielor

Defender of Truth
Donator
Beta Tester
Joined
May 30, 2008
Messages
5,632
Reaction score
0
Points
0
Now, when I try to compile Delta Glider, it says it cannot find " orbitersdk.h". I'm sure I have this file, as I have the SDK, yet it says this.
How do I fix this?
Nearly two pages ago I told you:
Additionally, I have the following settings in the project in order to grab the Orbiter stuff. Note that the given directory points to where ever you have the orbiter SDK installed, and will likely be different on your machine:

Project..Properties...Configuration Properties...C/C++...General...Additional Include Directories
Code:
C:\Program Files\Orbiter-Build\Orbitersdk\include
Project..Properties...Configuration Properties...Linker...General...Additional Library Directories
Code:
C:\Program Files\Orbiter-Build\Orbitersdk\lib
These two settings can safely be moved to the global "Tools" setting earlier rather than being set on a per-project basis, if you prefer.

HTH
 

T.Neo

SA 2010 Soccermaniac
Addon Developer
Joined
Jun 22, 2008
Messages
6,377
Reaction score
0
Points
0
Nearly two pages ago I told you:
I have a short attention span. :p

You mean additional library directories, next to GDI32.lib, user32.lib and kernel32.lib?
 

escapetomsfate

OBSP Developer
Addon Developer
Joined
Jun 21, 2008
Messages
287
Reaction score
0
Points
0
Location
GB
You have to set all the include + library directories again if you start a new project. They are not permanent unless you set them in Tools>Options.
 

T.Neo

SA 2010 Soccermaniac
Addon Developer
Joined
Jun 22, 2008
Messages
6,377
Reaction score
0
Points
0
You have to set all the include + library directories again if you start a new project. They are not permanent unless you set them in Tools>Options.
I understand I have to reset GDI32.lib, user32.lib and kernel32.lib every time, but where do I put

C:\Orbiter\Orbitersdk\include
and
C:\Orbiter\Orbitersdk\lib

so I have orbitersdk.h?
 

computerex

Addon Developer
Addon Developer
Joined
Oct 16, 2007
Messages
1,283
Reaction score
16
Points
0
Location
Florida
I understand I have to reset GDI32.lib, user32.lib and kernel32.lib every time, but where do I put

C:OrbiterOrbitersdkinclude
and
C:OrbiterOrbitersdklib

so I have orbitersdk.h?
Dude, read the posts we have posted. The post I made above tells you pretty much how to set up any sample project.
 

Hielor

Defender of Truth
Donator
Beta Tester
Joined
May 30, 2008
Messages
5,632
Reaction score
0
Points
0
I have a short attention span. :p

You mean additional library directories, next to GDI32.lib, user32.lib and kernel32.lib?
Did you try it? Considering the long turnaround time of asking a question here and waiting for an answer, you could've known by now.

I mean "Additional library directories", but that is not next to GDI32 and friends. They are in the "Input" section, in the "Additional Dependencies" box.

I understand I have to reset GDI32.lib, user32.lib and kernel32.lib every time, but where do I put

C:OrbiterOrbitersdkinclude
and
C:OrbiterOrbitersdklib

so I have orbitersdk.h?
Here, I'll try quoting myself again, and this time I'll replace my directories with yours. Note that I tell you exactly where to put them.
Project..Properties...Configuration Properties...C/C++...General...Additional Include Directories
Code:
C:\Orbiter\Orbitersdk\include
Project..Properties...Configuration Properties...Linker...General...Additional Library Directories
Code:
C:\Orbiter\Orbitersdk\lib
 

T.Neo

SA 2010 Soccermaniac
Addon Developer
Joined
Jun 22, 2008
Messages
6,377
Reaction score
0
Points
0
When I do that, I get this:
.DeltaGlider.cpp(2322) : warning C4996: 'strnicmp' was declared deprecated
C:program FilesMicrosoft Visual Studio 8VCincludestring.h(215) : see declaration of 'strnicmp'
Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strnicmp. See online help for details.'
.DeltaGlider.cpp(2324) : warning C4996: 'strnicmp' was declared deprecated
C:program FilesMicrosoft Visual Studio 8VCincludestring.h(215) : see declaration of 'strnicmp'
Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strnicmp. See online help for details.'
.DeltaGlider.cpp(2326) : warning C4996: 'strnicmp' was declared deprecated
C:program FilesMicrosoft Visual Studio 8VCincludestring.h(215) : see declaration of 'strnicmp'
Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strnicmp. See online help for details.'
.DeltaGlider.cpp(2328) : warning C4996: 'strnicmp' was declared deprecated
C:program FilesMicrosoft Visual Studio 8VCincludestring.h(215) : see declaration of 'strnicmp'
Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strnicmp. See online help for details.'
.DeltaGlider.cpp(2330) : warning C4996: 'strnicmp' was declared deprecated
C:program FilesMicrosoft Visual Studio 8VCincludestring.h(215) : see declaration of 'strnicmp'
Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strnicmp. See online help for details.'
.DeltaGlider.cpp(2332) : warning C4996: 'strnicmp' was declared deprecated
C:program FilesMicrosoft Visual Studio 8VCincludestring.h(215) : see declaration of 'strnicmp'
Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strnicmp. See online help for details.'
.DeltaGlider.cpp(2334) : warning C4996: 'strnicmp' was declared deprecated
C:program FilesMicrosoft Visual Studio 8VCincludestring.h(215) : see declaration of 'strnicmp'
Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strnicmp. See online help for details.'
.DeltaGlider.cpp(2336) : warning C4996: 'strnicmp' was declared deprecated
C:program FilesMicrosoft Visual Studio 8VCincludestring.h(215) : see declaration of 'strnicmp'
Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strnicmp. See online help for details.'
.DeltaGlider.cpp(2338) : warning C4996: 'strnicmp' was declared deprecated
C:program FilesMicrosoft Visual Studio 8VCincludestring.h(215) : see declaration of 'strnicmp'
Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strnicmp. See online help for details.'
.DeltaGlider.cpp(2340) : warning C4996: 'strnicmp' was declared deprecated
C:program FilesMicrosoft Visual Studio 8VCincludestring.h(215) : see declaration of 'strnicmp'
Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strnicmp. See online help for details.'
.DeltaGlider.cpp(2344) : warning C4996: 'strnicmp' was declared deprecated
C:program FilesMicrosoft Visual Studio 8VCincludestring.h(215) : see declaration of 'strnicmp'
Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strnicmp. See online help for details.'
.DeltaGlider.cpp(2346) : warning C4996: 'strnicmp' was declared deprecated
C:program FilesMicrosoft Visual Studio 8VCincludestring.h(215) : see declaration of 'strnicmp'
Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strnicmp. See online help for details.'
.DeltaGlider.cpp(2351) : warning C4996: 'strnicmp' was declared deprecated
C:program FilesMicrosoft Visual Studio 8VCincludestring.h(215) : see declaration of 'strnicmp'
Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strnicmp. See online help for details.'
.DeltaGlider.cpp(2361) : warning C4996: 'strnicmp' was declared deprecated
C:program FilesMicrosoft Visual Studio 8VCincludestring.h(215) : see declaration of 'strnicmp'
Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strnicmp. See online help for details.'
.DeltaGlider.cpp(2498) : warning C4996: 'stricmp' was declared deprecated
C:program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp'
Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'
.DeltaGlider.cpp(2499) : warning C4996: 'stricmp' was declared deprecated
C:program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp'
Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'
.DeltaGlider.cpp(2501) : warning C4996: 'stricmp' was declared deprecated
C:program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp'
Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'
.DeltaGlider.cpp(2502) : warning C4996: 'stricmp' was declared deprecated
C:program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp'
Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'
.DeltaGlider.cpp(2504) : warning C4996: 'stricmp' was declared deprecated
C:program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp'
Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'
.DeltaGlider.cpp(2505) : warning C4996: 'stricmp' was declared deprecated
C:program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp'
Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'
.DeltaGlider.cpp(2507) : warning C4996: 'stricmp' was declared deprecated
C:program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp'
Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'
.DeltaGlider.cpp(2508) : warning C4996: 'stricmp' was declared deprecated
C:program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp'
Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'
.DeltaGlider.cpp(2510) : warning C4996: 'stricmp' was declared deprecated
C:program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp'
Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'
.DeltaGlider.cpp(2511) : warning C4996: 'stricmp' was declared deprecated
C:program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp'
Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'
.DeltaGlider.cpp(2513) : warning C4996: 'stricmp' was declared deprecated
C:program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp'
Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'
.DeltaGlider.cpp(2514) : warning C4996: 'stricmp' was declared deprecated
C:program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp'
Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'
.DeltaGlider.cpp(2516) : warning C4996: 'stricmp' was declared deprecated
C:program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp'
Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'
.DeltaGlider.cpp(2517) : warning C4996: 'stricmp' was declared deprecated
C:program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp'
Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'
.DeltaGlider.cpp(2519) : warning C4996: 'stricmp' was declared deprecated
C:program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp'
Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'
.DeltaGlider.cpp(2520) : warning C4996: 'stricmp' was declared deprecated
C:program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp'
Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'
.DeltaGlider.cpp(2522) : warning C4996: 'stricmp' was declared deprecated
C:program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp'
Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'
.DeltaGlider.cpp(2523) : warning C4996: 'stricmp' was declared deprecated
C:program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp'
Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'
.DeltaGlider.cpp(2622) : warning C4996: 'hypot' was declared deprecated
C:program FilesMicrosoft Visual Studio 8VCincludemath.h(455) : see declaration of 'hypot'
Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _hypot. See online help for details.'
Generating Code...
Compiling resources...
.DeltaGlider.rc(10) : fatal error RC1015: cannot open include file 'afxres.h'.
I know about afxres.h, but what is the other stuff?
 

T.Neo

SA 2010 Soccermaniac
Addon Developer
Joined
Jun 22, 2008
Messages
6,377
Reaction score
0
Points
0
Ignore the smiley faces.
 

tblaxland

O-F Administrator
Administrator
Addon Developer
Webmaster
Joined
Jan 1, 2008
Messages
7,344
Reaction score
10
Points
113
Location
Sydney, Australia
Firstly, they are warnings, so they won't stop the code compiling (unless you have the "Treat warnings as errors" option on). Fix the issue with afxres.h and you should compile OK.

Secondly, the warning tells you what to do. Type "stricmp" into the help search box (as directed by the warning) and you will find (as detailed in the warning message) that stricmp is deprecated[1] and you should use _stricmp instead. You can do a search and replace of "stricmp" with "_stricmp".

[1] Deprecated: Adjective; said of a construct in a computing language considered obsolete but still available for use, though planned to be phased out.
 

T.Neo

SA 2010 Soccermaniac
Addon Developer
Joined
Jun 22, 2008
Messages
6,377
Reaction score
0
Points
0
Sorry for the idiot question, but which search box?
 
Top