• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

gauges.h compile problem

Messages
5
Country
ireland
Hi Guys,

I'm new to gauge programming and haven't done any C/C++ work in years so I'm a bit rusty.
I've created a simple test gauge using the examples shown in Dai Griffiths document (sd2gau24) as a template and updated gauges.h using the file supplied, however when I try to compile it, I get hundreds of errors regarding gauges.h, the first of which is:
syntax error before IGaugeCDrawableCreateParameters

I'm using DevC++ as my development tool.
I thought that it might be a config error with DevC++ so I downloaded and installed Visual C++ 2008 Express, but still get the same error.
I've also rolled back the gauges.h to the original MS Version
but still get the same error.

The two source files are available here http://web.goldsmith.ie/airbus.c
http://web.goldsmith.ie/electrical.c

I've probably forgotten something, but I cannot for the life of me see what.

Any help would be much appreciated.

Cheers

Trevor
 
Messages
516
Do you perhaps have your compiler set to ANSI C and not C++? It looks like it's baulking when trying to compile the first class it comes across.

Si
 
Messages
5
Country
ireland
It was set to C not C++, so changing it has fixed that error.
Now however it complains about lines 32,50 & 69 in electrical.c

invalid conversion from void(*)(GAUGEHDR*,SINT32,UINT32) to FLOAT64(*)(ELEMENT_ICON*)

These three lines are all MAKE_ICON (.... macros.

It also complains about airbus.c line 23

excess elements in aggregate initializer.

WTF?

Is it too much to expect this to work "Out of the Box", or what?

Again, all help appreciated.

Cheers

Trevor
 
Messages
516
Ok, here's what I think is wrong:

Electrical.c:

Line 32: You reference the function "electrical_update" in the macro, but it has not been previously defined or forward referenced. In fact you're confusing two different functions because you define "electrical_update" as you gauge callback at the top of the file, but you don't have a gauge callback function.

Above your MAKE_ICON macro, define:

FLOAT64 FSAPI electrical_update( PELEMENT_ICON pelement )
{
return your_return_value;
}

and get rid of the "GAUGE_CALLBACK electrical_update;" and the reference to it in the GAUGE_HEADER_FS700 (replace with NULL.)

You should also write and use a separate function in the second MAKE_ICON because i'm not sure they like the same callbacks to be used multiple times.

I suspect the error in airbus.c will probably go away when you fix those in electrical.

Remember also that because you #include the electrical file in airbus, you shouldn't compile and link electrical, only airbus, as it'll be included at compile time. If you don't then the compiler is likely to complain about redefinitions.

Si
 
Messages
5
Country
ireland
Hi Si,

Thanks for the help. Now that you mention it, I can see where the problem is. I think it is time I found my C course notes and had a read through them.
I'll change the code and give it another go.

Once again, thanks for the help.

Cheers

Trevor
 
Messages
516
Don't worry, you'll get the hang of it in no time if you've done C before. The only trouble I found is that I've never used macros to such a large extent, so despite it being C, it still all looked rather alien. Dai's book is a godsend though.

Si
 
Messages
5
Country
ireland
Hi Si,

That sort of worked - but I still have the excess elements error
which is killing the build.

Last time I did any C programming was almost 15 years ago.
I've done some C++ more recently, 8-9 years ago, but to be perfectly honest, it looks sort of familiar to me at the moment, but I'm struggling to remember what is supposed to go where!
Still, given a bit of time to get my head around it and I expect I'll get the hang of it.

Thanks Again.

Cheers


Trevor
 
Top