VC++ 2008 help

V8Li

Member
Joined
Apr 9, 2008
Messages
200
Reaction score
0
Points
16
Hi.

I finally got the VC++2008 and decided to give it a try to learn the basics.
I have some questions:

1: I've built the ShuttlePB.dll. And the file is smaller than the original, the original is 32Kb and mine is 24Kb. I've only modified it so that the ship is 5000Kg and not 500Kg, no other changes to the source. It ran OK, in-game the PB was 5t heavy and everything worked. So is this normal? I haven't used any other versions of VC++.
2: I got the eHUD source by computerex from here: http://www.orbiter-forum.com/showthread.php?t=1150&highlight=ehud . And only uncommented some lines so that the PeA and ApA are not displayed. I got an error and some warnings:


Code:
------ Build started: Project: EHUD, Configuration: Release Win32 ------
Compiling...
parser.cpp
C:\Program Files\Microsoft Visual Studio 9.0\VC\include\stdio.h(358) : error C3163: '_vsnprintf': attributes inconsistent with previous declaration
        C:\Program Files\Microsoft Visual Studio 9.0\VC\include\stdio.h(350) : see declaration of '_vsnprintf'
main.cpp
c:\documents and settings\v\my documents\visual studio 2008\projects\orbitersdk\samples\ehud\EHUD.h(90) : warning C4018: '<' : signed/unsigned mismatch
EHUD.cpp
c:\documents and settings\v\my documents\visual studio 2008\projects\orbitersdk\samples\ehud\EHUD.h(90) : warning C4018: '<' : signed/unsigned mismatch
.\EHUD.cpp(14) : warning C4018: '<' : signed/unsigned mismatch
.\EHUD.cpp(25) : warning C4018: '<' : signed/unsigned mismatch
.\EHUD.cpp(57) : warning C4018: '<' : signed/unsigned mismatch
Build log was saved at "file://c:\Documents and Settings\V\My Documents\Visual Studio 2008\Projects\Orbitersdk\samples\ehud\Release\BuildLog.htm"
EHUD - 1 error(s), 5 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========]
I've opened the stdio.h file and commented the 358 line and it worked. Do you have any clues what's up with this error? And what about the warnings?

Thanks!
Long live C++! (not) :p
 

computerex

Addon Developer
Addon Developer
Joined
Oct 16, 2007
Messages
1,282
Reaction score
17
Points
0
Location
Florida
Hi. These warnings are nothing to worry about. You can get rid of them by using a DWORD instead of int i inside the for loops in the EHUD class. Some compilers create their own implementation of libc function, this can conflict with libraries also implementing those functions, so commenting out the line in the header is the easiest solution I think.
 

agentgonzo

Grounded since '09
Addon Developer
Joined
Feb 8, 2008
Messages
1,649
Reaction score
4
Points
38
Location
Hampshire, UK
Website
orbiter.quorg.org
Don't worry about compilation size. Many things affect it, and different compilers compile differently.

Don't mess with standard headers (stdio.h). If it's not compiling, it's a problem with your code. Fix that instead. I know that sprintf functions were declared deprecated in VS2005 in favour of secure ones (s_sprintf). Look at where you're calling sprintf functions and see what's wrong/changed with 2008
 

computerex

Addon Developer
Addon Developer
Joined
Oct 16, 2007
Messages
1,282
Reaction score
17
Points
0
Location
Florida
Don't worry about compilation size. Many things affect it, and different compilers compile differently.

Don't mess with standard headers (stdio.h). If it's not compiling, it's a problem with your code. Fix that instead. I know that sprintf functions were declared deprecated in VS2005 in favour of secure ones (s_sprintf). Look at where you're calling sprintf functions and see what's wrong/changed with 2008

If he is using the vc++ 2008 compiler for compiling other things, he shouldn't have any problems compiling anything, as the vc++ 2008 already implements the vsnprintf function, which causes the error in the first place.
 

V8Li

Member
Joined
Apr 9, 2008
Messages
200
Reaction score
0
Points
16
Thanks for the help guys!
computerex, I know what you mean, I did that and still got the error; the for looks like this:
int i;
for (i = 0; etc...)
It's no big deal, like I said I was able to compile and run it in orbitersim, I just thought is a common mistake with all those VC++ versions.

agentgonzo, computerex used for eHUD the "sprintf" function to print data on the screen. I have both 2005 and 2008 redistributable but my guess is you're right and is safer to compile with standard headers. I'll try the s_sprintf function too.
 
Top