• 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.

Error compiling my Gauge

Messages
12
Country
brazil
I'm trying to compile my C files to get my .gau but I got a lot of errors... What am I doing wrong?

I'm using CodeBlocks and bellow there are my Bip.c (main class, there is another .c), the errors I got and my MakeFile.

Code:
// Bip.c
// Copyright (c) 2008 Thomas Couto.  All rights reserved.
//
#define _WIN32_WINNT 0x0500

#include "parser/iniparser.h"
#include "gauges.h"
#include "Bip.h"
#include "Defines.h"

#include <windows.h>
#include <stdlib.h>
#include <string.h>
#include <process.h>

/////////////////////////////////////////////////////////////////////////////
// BIP Engine
/////////////////////////////////////////////////////////////////////////////
#define		GAUGE_NAME			"Engine\0"
#define		GAUGEHDR_VAR_NAME	gaugehdr_engine
#define		GAUGE_W				 10

#include "main.c"

/////////////////////////////////////////////////////////////////////////////
// Gauge table
/////////////////////////////////////////////////////////////////////////////
GAUGE_TABLE_BEGIN()
	GAUGE_TABLE_ENTRY(&gaugehdr_engine)
GAUGE_TABLE_END()



Code:
C:\beep\beep>mingw32-make
Compiling: C:\beep\beep\bip.c
In file included from C:\beep\beep\bip.c:7:
C:\beep\beep\gauges.h:4632: warning: type defaults to `int' in declaration of `G
AUGE_KEY_EVENT_HANDLER'
C:\beep\beep\gauges.h:5114: error: redefinition of typedef 'PELEMENT_STATIC_IMAG
E'
C:\beep\beep\gauges.h:5076: error: previous declaration of 'PELEMENT_STATIC_IMAG
E' was here
C:\beep\beep\gauges.h:5114: error: redefinition of typedef 'PPELEMENT_STATIC_IMA
GE'
C:\beep\beep\gauges.h:5076: error: previous declaration of 'PPELEMENT_STATIC_IMA
GE' was here
C:\beep\beep\gauges.h:5167: error: redefinition of typedef 'PELEMENT_NEEDLE'
C:\beep\beep\gauges.h:5077: error: previous declaration of 'PELEMENT_NEEDLE' was
 here
C:\beep\beep\gauges.h:5167: error: redefinition of typedef 'PPELEMENT_NEEDLE'
C:\beep\beep\gauges.h:5077: error: previous declaration of 'PPELEMENT_NEEDLE' wa
s here
C:\beep\beep\gauges.h:5270: error: redefinition of typedef 'PELEMENT_STRING'
C:\beep\beep\gauges.h:5078: error: previous declaration of 'PELEMENT_STRING' was
 here
C:\beep\beep\gauges.h:5270: error: redefinition of typedef 'PPELEMENT_STRING'
C:\beep\beep\gauges.h:5078: error: previous declaration of 'PPELEMENT_STRING' wa
s here
C:\beep\beep\gauges.h:5363: error: redefinition of typedef 'PELEMENT_SLIDER'
C:\beep\beep\gauges.h:5079: error: previous declaration of 'PELEMENT_SLIDER' was
 here
C:\beep\beep\gauges.h:5363: error: redefinition of typedef 'PPELEMENT_SLIDER'
C:\beep\beep\gauges.h:5079: error: previous declaration of 'PPELEMENT_SLIDER' wa
s here
C:\beep\beep\gauges.h:5430: error: redefinition of typedef 'PELEMENT_ICON'
C:\beep\beep\gauges.h:5080: error: previous declaration of 'PELEMENT_ICON' was h
ere
C:\beep\beep\gauges.h:5430: error: redefinition of typedef 'PPELEMENT_ICON'
C:\beep\beep\gauges.h:5080: error: previous declaration of 'PPELEMENT_ICON' was
here
C:\beep\beep\gauges.h:5503: error: redefinition of typedef 'PELEMENT_MOVING_IMAG
E'
C:\beep\beep\gauges.h:5081: error: previous declaration of 'PELEMENT_MOVING_IMAG
E' was here
C:\beep\beep\gauges.h:5503: error: redefinition of typedef 'PPELEMENT_MOVING_IMA
GE'
C:\beep\beep\gauges.h:5081: error: previous declaration of 'PPELEMENT_MOVING_IMA
GE' was here
C:\beep\beep\gauges.h:5588: error: redefinition of typedef 'PELEMENT_SPRITE'
C:\beep\beep\gauges.h:5082: error: previous declaration of 'PELEMENT_SPRITE' was
 here
C:\beep\beep\gauges.h:5588: error: redefinition of typedef 'PPELEMENT_SPRITE'
C:\beep\beep\gauges.h:5082: error: previous declaration of 'PPELEMENT_SPRITE' wa
s here
C:\beep\beep\gauges.h:5863: warning: useless keyword or type name in empty decla
ration
C:\beep\beep\gauges.h:5960: warning: useless keyword or type name in empty decla
ration
In file included from C:\beep\beep\bip.c:26:
C:\beep\beep\main.c: In function `lineSwitcher':
C:\beep\beep\main.c:80: warning: unused variable `bOneItemOnly'
mingw32-make: *** [obj\Release\bip.o] Error 1

Code:
# Project Variables start
CPP=mingw32-g++.exe
CC=mingw32-gcc.exe
LD=mingw32-g++.exe
LIB=ar.exe
WINDRES=windres.exe
# Project Variables end

# Target: Release

OBJS_RELEASE=obj\Release\bip.o obj\Release\main.o obj\Release\parser\dictionary.o obj\Release\parser\iniparser.o obj\Release\Bip.res

Release: bin/Release/beep.gau

bin/Release/beep.gau: $(OBJS_RELEASE)
	@echo Building dynamic library bin\Release\beep.gau
	@mingw32-g++.exe -shared   -Wl,--dll -LC:\CodeBlocks\share\CodeBlocks\plugins\lib  $(OBJS_RELEASE)  -o bin\Release\beep.exe  lib\libuser32.a lib\libiniparser.a lib\libwinmm.a 

obj\Release\bip.o: C:/beep/beep/bip.c
	@echo Compiling: C:\beep\beep\bip.c
	@mingw32-gcc.exe -Wall     -IC:\CodeBlocks\share\CodeBlocks\plugins\include  -c C:\beep\beep\bip.c -o obj\Release\bip.o

obj\Release\main.o: C:/beep/beep/main.c
	@echo Compiling: C:\beep\beep\main.c
	@mingw32-gcc.exe -Wall     -IC:\CodeBlocks\share\CodeBlocks\plugins\include  -c C:\beep\beep\main.c -o obj\Release\main.o

obj\Release\parser\dictionary.o: C:/beep/beep/parser/dictionary.c
	@echo Compiling: C:\beep\beep\parser\dictionary.c
	@mingw32-gcc.exe -Wall     -IC:\CodeBlocks\share\CodeBlocks\plugins\include  -c C:\beep\beep\parser\dictionary.c -o obj\Release\parser\dictionary.o

obj\Release\parser\iniparser.o: C:/beep/beep/parser/iniparser.c
	@echo Compiling: C:\beep\beep\parser\iniparser.c
	@mingw32-gcc.exe -Wall     -IC:\CodeBlocks\share\CodeBlocks\plugins\include  -c C:\beep\beep\parser\iniparser.c -o obj\Release\parser\iniparser.o

obj\Release\Bip.res: C:/beep/beep/Bip.rc
	@echo Compiling: C:\beep\beep\Bip.rc
	@windres.exe -i C:\beep\beep\Bip.rc -J rc -o obj\Release\Bip.res -O coff 

C:\beep\beep\main.c: Bip.h Defines.h

.PHONY: clean_Release

clean_Release: 
	@echo Delete $(OBJS_RELEASE) bin\Release\beep.gau
	-@del /f $(OBJS_RELEASE) bin\Release\beep.gau
 
Tom,

Looks like you have guages.h in one of you other files and it's trying to redefine the variables.

Does main.c have guages.h? Yes, I know this should not be the problem as it has a ifndef GUAGES_H_. But I googled and saw some Pre-compiled header issues posted for mingw. Just a thought.
 
Last edited:
One thing to try, rearrange the #include statements at the top of the C files such that the angle bracketed includes come before the quoted includes like this:

Code:
#include <windows.h>
#include <stdlib.h>
#include <string.h>
#include <process.h>

#include "gauges.h"

#include "parser/iniparser.h"
#include "Bip.h"
#include "Defines.h"

In general, if you are building a windows binary, it's best to include the windows.h file first thing as most of the other headers are going to rely on definitions from it.
 
Back
Top