Sign in to follow this  
Guest Airtower

another dilema with the sample code...

Recommended Posts

i have added what i needed to and tweeked the code a little but not much.yet, when i go to compile it, it says it is not finding some of the global variables that were previously set up.BTW, the code hasn't worked from the beggining.either the global variables are not being recognized or they not pointing like they shouldthanks again

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

If you expect an answer, please provide more detail, such as, the coding sample you are talking about.Are you talking about gauges, scenery, aircraft, flight simulator software?W. Sieffert

Share this post


Link to post
Share on other sites

oops, sorry about that...FS9 is the platform using microsoft VC for the programming in Call i am really trying to do is take all the sample codes given in the SDK and get them to work.after that i can tweak em, but i think i might be missing a library file or something i might need cus i have been getting this error saying uknown link library or something to that effect.i'll investigate and put some more detail in a bit.EDIT:ok, my problem is occuring in ANY of the sample codes given by misrosoft.i get the error saying "GAUGE_NAME" is an undeclared identifier, like its' not there. but i have all the header files required for those sample codes.thanksPS. GAUGE_NAME is not the only problem, but i think if i can fix it the other 6 problems will get fixed.

Share this post


Link to post
Share on other sites

Ok, well 1st, it sounds like you might be trying to compile them separately. Download and read the SDK. You'll see that the samples are part of a multi-gauge.You'll probably want to download a file sd2gau17.zip from flightsim.com, or another major site. There is also a file idehowto.zip that will help you to setup your development environment (the IDE) to compile gauges.Basically, you'll open a blank Win32 dll project, and add the files, then add some link libraries and then compile. The IDEHowto.zip gives complete info on how to do this.

Share this post


Link to post
Share on other sites

thanks,i knew it was for a mutlipart gauge but it didn't matter cus it said the same thing.thanks for the link that exactly what i was looking for.the SDK documentation doesn't explain how to set up the compiler so thatlink is perfect.thanks

Share this post


Link to post
Share on other sites

well,still the same error after trying following the tutorials and everyhting and setting up the compiler correctly.the first line of this sample code is just not working...// Set up gauge headerchar attitude_gauge_name[] = GAUGE_NAME;extern PELEMENT_HEADER attitude_list;extern MOUSERECT attitude_mouse_rect[];GAUGE_HEADER_FS700(GAUGE_W, attitude_gauge_name, &attitude_list, attitude_mouse_rect, 0, 0, 0, 0);i get like 7 errors 3 warnings...:DownloadsMSFS DesignPanelSDKsampleSDK.Attitude.c(10) : error C2065: 'GAUGE_NAME' : undeclared identifierC:DownloadsMSFS DesignPanelSDKsampleSDK.Attitude.c(10) : error C2099: initializer is not a constantC:DownloadsMSFS DesignPanelSDKsampleSDK.Attitude.c(15) : error C2065: 'GAUGE_W' : undeclared identifierC:DownloadsMSFS DesignPanelSDKsampleSDK.Attitude.c(15) : error C2099: initializer is not a constantC:DownloadsMSFS DesignPanelSDKsampleSDK.Attitude.c(15) : warning C4244: 'initializing' : conversion from 'const double ' to 'unsigned int ', possible loss of dataC:DownloadsMSFS DesignPanelSDKsampleSDK.Attitude.c(15) : error C2115: 'initializing' : incompatible typesC:DownloadsMSFS DesignPanelSDKsampleSDK.Attitude.c(15) : error C2078: too many initializersC:DownloadsMSFS DesignPanelSDKsampleSDK.Attitude.c(15) : warning C4047: 'initializing' : 'int ' differs in levels of indirection from 'void *'C:DownloadsMSFS DesignPanelSDKsampleSDK.Attitude.c(15) : warning C4047: 'initializing' : 'int ' differs in levels of indirection from 'struct MOUSERECT *'C:DownloadsMSFS DesignPanelSDKsampleSDK.Attitude.c(15) : error C2115: 'initializing' : incompatible typesError executing cl.exe.*********BY THE WAY, i did not alter their sample at ALL!*******also,still not understanding how to use the "makefile"PLEASE HELP!

Share this post


Link to post
Share on other sites

For most sample code, the C file is actually supposed to be an INCLUDE file, but this throws you off because the extension is a C file (or .CPP), which logically should compile to an obj file and then added to the final DLL (the .gau file). What's more, you go ahead an put a project together, and all kinds of errors pop up because the compiler and linker correctly assume that it's a standalone file, not a header file.So, the scenario is this: you have a main file. This is the only file that makes a reference to gauges.h and serves as the main entry point. Your gauge (or gauges) are included in this main file. These include files have a .c extension, which is very unfortunate.So, the code looks something like this:// main.c// the one and only file#include // this defines DLL main and other things#include // needed for a slew of things#include // custom draw gauges (requires gdiplus.lib in the additional linker library)// subgauges go here#define GAUGE_NAME "mygauge" ......#include "mygauge.c" // your problem lies here, must be an include#undef GAUGE_NAME // gauge header table goes here// one entry per gauge you have...// end of fileYou may also have to exclude the include .c files from compilation in the project to avoid duplicate symbol linker errors. I've come to the conclusion that if clarity is what you seek, gauge programming using the current SDK is probably not the way to enlightenment :)But, once you get beyond these minor things, it's really neat.

Share this post


Link to post
Share on other sites

Your error is due to you not having the gauge.h or fs9gauge.h file as part of the project under headers, and having that "include" directory in the directories in which the compiler searches for include (.h) files.To fix this, add the .h file to your project, and put it in the same directory as your .c files.

Share this post


Link to post
Share on other sites

i tried adding the .h file to the project, still no joy.i'll try the first suggestion and i appreciate the help!thank you

Share this post


Link to post
Share on other sites

Whenever you see these errors, do a "clean". Then, do a build. This should clear up your problem if your code is good.If it doesn't, then often this problem is the result of a small syntax error somewhere in your program. If you're compiling the unaltered sample code, and have the IDE setup correctly, then it will compile without error or warning messages.

Share this post


Link to post
Share on other sites

i think i asked the wrong question...i need help making VS output all the debug and final fileslike the .gau the .lib and .pdb so i can debug it in fs9.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this