Results 1 to 10 of 10

Thread: fsxgauges.h and compilation

  1. #1
    Join Date
    May 2006
    Location
    Monaco
    Posts
    40

    Question fsxgauges.h and compilation

    I have a compilation problem using gauges.h (renamed fsxgauges.h) from the FSX Acceleration Expansion Pack.
    I get 82 compilation errors per single gauges compiled when I replace fs9gauges.h by fsxgauges.h, the first beeing:

    c:\inc\fsxgauges.h(5150) : error C2061: syntax error : identifier 'IGaugeCDrawableCreateParameters'
    c:\inc\fsxgauges.h(5150) : error C2059: syntax error : ';'
    c:\inc\fsxgauges.h(5151) : error C2449: found '{' at file scope (missing function header?)
    c:\inc\fsxgauges.h(5166) : error C2059: syntax error : '}'

    It seems that some identifiers are not recognised.

    If I replace fsxgauges.h by f9gauges.h, I have no compilation errors and 'IGaugeCDrawableCreateParameters' is recognized.
    So I compared the gauges.h source and in fsxgauges.h I find :

    #define UNITS_UNKNOWN (-1)
    #define UNITS_STRING (-2)

    class IGaugeCDrawableCreateParameters
    {
    public:
    ..............

    But in fs9gauges.h I have :

    #define UNITS_UNKNOWN (-1)
    #define UNITS_STRING (-2)

    #ifdef __cplusplus // <<=========== not in fsxgauges.h

    class IGaugeCDrawableCreateParameters
    {
    public:
    ............

    You can notice that in fs9gauges.h there is a line : #ifdef __cplusplus

    If add this line in fsxgauges.h and I compile my gauge, I only get one error.

    c:\inc\fsxgauges.h(6640) : fatal error C1070: mismatched #if/#endif pair in file 'c:\inc\fsxgauges.h'

    Unfortunately I am not good enough to put the missing #endif at the right place.

    Is the missing '#ifdef __cplusplus' and '#endif' the reason of the ompilation errors ?

    I also have the same errors if I use fsxgauges_sp2 made by Dai Griffith and Arne Bartels.
    Can you help me ?


    Regards
    Jean-Pierre

  2. #2
    Join Date
    Mar 2005
    Location
    Hammond, IN USA
    Posts
    4,796

    Default

    You've already identified the missing #ifdef entry point:
    Code:
     
    #define UNITS_UNKNOWN (-1)
    #define UNITS_STRING (-2)
     
     
    #ifdef __cplusplus
    Look for this #define statement, then add the #else section and #endif as shown below:

    Code:
     
    #define INIT_PANEL_CALLBACK_REFCOUNT(CLASSNAME) \
            m_RefCount = 1;
     
    #else
    typedef struct {void* pVtbl;} IGaugeCCallback;
    typedef struct {void* pVtbl;} IAircraftCCallback;
    typedef struct {void* pVtbl;} IPanelCCallback;
     
    #endif
    Bill Leaming
    Gauge Programming - 3d Modeling Military Visualizations
    Flightsim.com Panels & Gauges Forum Moderator
    Flightsim Rig: Intel Core i7-2600K - 8GB DDR3 1333 - EVGA GTX770 4GB - Win7 64bit Home Premium
    Development Rig1: Intel Core i7-3770k - 16GB DDR3 - Dual Radeon HD7770 SLI 1GB - Win7 64bit Professional
    Development Rig2: Intel Core i7-860 - 8GB DDR3 Corsair - GeForce GTS240 1GB - Win7 64bit Home Premium
    NOTE: Unless explicitly stated in the post, everything written by my hand is MY opinion. I do NOT speak for any company, real or imagined...

  3. #3
    Join Date
    May 2006
    Location
    Monaco
    Posts
    40

    Red face fsxgauges.h and compilation

    Thanks Bill,

    I applied the correction, so the former part is the same as fs9gauges.h and it deletes some errors, but now I still have the following remaining errors :

    c:\inc\fsxgauges.h(5397) : error C2061: syntax error : identifier 'DESERIALIZE_CALLBACK'
    ...........
    c:\inc\fsxgauges.h(5404) : error C2061: syntax error : identifier 'PROCESS_EVENT_CALLBACK'
    ..............
    c:\inc\fsxgauges.h(5443) : error C2061: syntax error : identifier 'PDESERIALIZE_CALLBACK'
    .................
    c:\inc\fsxgauges.h(6308) : error C2061: syntax error : identifier 'bool'
    .............
    c:\inc\fsxgauges.h(6372) : error C2061: syntax error : identifier 'PPANELS'
    .................
    c:\inc\fsxgauges.h(6382) : error C2061: syntax error : identifier 'ImportTable'
    ...............
    c:\inc\fsxgauges.h(6437) : error C2037: left of 'elements_list' specifies undefined struct/union 'GAUGEHDR'

    So I now have new errors due to the 'GAUGEHDR' error :
    c:\gauges_compil\multimoteurs\paris_fsx\simicons\map_icon.h(16) : error C2061: syntax error : identifier 'gaugehdr_Map_Icon'
    .........

    I cannot compare these items to the FS9 as they were not defined in fs9gauges.h

    Is there a modification in fsxgauges.h to correct these errors ?

    Thanks for the help
    Jean-Pierre

  4. #4

    Default

    The 'IGaugeCDrawableCreateParameters' error is being triggered by a syntax error in one of your own C-gauge files; IME it is usually a missing closing ) bracket somewhere or an invisible ascii character of greater than ASC 256. I should know - I've had quite enough of seeing that compile error from both sources! The only way to track this one down is to remove each c/cpp file from the compile tree until the error stops; check the offending file and if there is absolutely no syntax errors in it, assume that you have the ascii character problem and start it again from scratch.

  5. #5
    Join Date
    May 2006
    Location
    Monaco
    Posts
    40

    Question fsxgauges.h and compilation

    Hi Dai,

    Thanks for the answer, but I suppose there is another problem as my .c files come from my FS9 gauge and compile good with fs9gauges.h.
    I started from scratch a new project in the same Workspace than the FS9 gauge project and copied only the former multigauge files (.c, and .rc) as well as resource.h, and added for the beginning just one gauge (.c and .h)
    The only change is that I replaced the call to fs9gauges.h by a call to fsxgauges.h (or fsxgauges_sp2.h) in any occurence.

    Regards

    Jean-Pierre

  6. #6
    Join Date
    May 2006
    Location
    Monaco
    Posts
    40

    Default

    Hello,
    Arne Bartels found the reason why I had compilation errors with FSX version of gauges.h using .c files.
    It is because the FSX gauges.h is made for .cpp files and not .c files like the one I used formerly with FS9 and tried to use also with FSX.

  7. #7
    Join Date
    Mar 2005
    Location
    Hammond, IN USA
    Posts
    4,796

    Default

    In that case, simply rename your main gauge file to have a .cpp extension!
    Bill Leaming
    Gauge Programming - 3d Modeling Military Visualizations
    Flightsim.com Panels & Gauges Forum Moderator
    Flightsim Rig: Intel Core i7-2600K - 8GB DDR3 1333 - EVGA GTX770 4GB - Win7 64bit Home Premium
    Development Rig1: Intel Core i7-3770k - 16GB DDR3 - Dual Radeon HD7770 SLI 1GB - Win7 64bit Professional
    Development Rig2: Intel Core i7-860 - 8GB DDR3 Corsair - GeForce GTS240 1GB - Win7 64bit Home Premium
    NOTE: Unless explicitly stated in the post, everything written by my hand is MY opinion. I do NOT speak for any company, real or imagined...

  8. #8
    Join Date
    Feb 2008
    Location
    Near EGNC,Cumbria, England
    Posts
    2,289
    Blog Entries
    10

    Default

    That works ... Just out of interest, Bill, do you think using C++ is better (for FSX) than straight C?
    I fly through the valley of death, but I fear no evil,for I am at 80,000 feet and climbing. Let's powerdive and scare that poor soul in that Ultralight there.

  9. #9
    Join Date
    Mar 2005
    Location
    Hammond, IN USA
    Posts
    4,796

    Default

    Quote Originally Posted by Flying Officer Jevans View Post
    That works ... Just out of interest, Bill, do you think using C++ is better (for FSX) than straight C?
    The primary stylistic difference is that C is procedurally-oriented whereas C++ is object-oriented.

    I recommend using C++ simply because you can then use either C or C++ methods in the same gauge project!

    For example, in my CJ1_MultiGauge project, most gauges are bitmap (pure C code), but all the "glass" use C++/GDI+...

    In any case, simply because you set up your gauge project to allow C++ methods doesn't mean you have to use any of 'em in the compiled project...

    The C++ language contains some language extentions over C, that make object oriented programming and generic programming more convenient. C++ does not force object oriented design anywhere - it merely allows for it if the programmer deems OO feasible. C allows for object oriented programming as well, C++ only makes it simpler and less error prone.

    For an interesting discussion/illustration of C versus C++, see:

    http://www.cs.utk.edu/~huangj/CS302S...ersus_c++.html

    -also-

    http://unthought.net/c++/c_vs_c++.html
    Last edited by n4gix; 12-17-2009 at 01:14 PM.
    Bill Leaming
    Gauge Programming - 3d Modeling Military Visualizations
    Flightsim.com Panels & Gauges Forum Moderator
    Flightsim Rig: Intel Core i7-2600K - 8GB DDR3 1333 - EVGA GTX770 4GB - Win7 64bit Home Premium
    Development Rig1: Intel Core i7-3770k - 16GB DDR3 - Dual Radeon HD7770 SLI 1GB - Win7 64bit Professional
    Development Rig2: Intel Core i7-860 - 8GB DDR3 Corsair - GeForce GTS240 1GB - Win7 64bit Home Premium
    NOTE: Unless explicitly stated in the post, everything written by my hand is MY opinion. I do NOT speak for any company, real or imagined...

  10. #10
    Join Date
    Feb 2008
    Location
    Near EGNC,Cumbria, England
    Posts
    2,289
    Blog Entries
    10

    Default

    I always used to be a procedural programmer( after all, I learnt using QBasic...) but recently I've gone more over to OOP and Visual Basic.NET. It can be a bit confusing to get your head round declarative programming, though. I only wish XML gauges in FSX had a proper update object so we could run some procedural code, the one we've got seems a bit feeble to me.

    Anyway...
    I fly through the valley of death, but I fear no evil,for I am at 80,000 feet and climbing. Let's powerdive and scare that poor soul in that Ultralight there.

Similar Threads

  1. Aircraft Near Miss And Unusual Event Compilation
    By enuffsaid in forum Real Aviation Photos & Videos
    Replies: 0
    Last Post: 08-04-2013, 05:10 AM
  2. 3rd and last Transavia compilation, enjoy!
    By Tommypilot in forum MSFS Screen Shot Forum
    Replies: 4
    Last Post: 04-25-2005, 09:38 AM
  3. Second compilation of my flights for Transavia VA, enjoy guys and girls!
    By Tommypilot in forum MSFS Screen Shot Forum
    Replies: 8
    Last Post: 04-21-2005, 05:34 AM
  4. Replies: 14
    Last Post: 04-17-2005, 12:35 PM
  5. fs sites? favourites compilation?
    By aspong in forum FS2002
    Replies: 2
    Last Post: 03-03-2002, 06:49 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •