expected identifer before 'unem'

Jun 19, 2012 at 6:56pm
Hello,

i get an error when trying to compile C++ source file where some headers are included. The error as written is expected identifier before 'enum'. The message in status bar says the problem is in a header file where the bellowed code is placed. Any solution?

1
2
3
4
enum BIRD_ERROR_CODES   // the message points this line 
{
	BIRD_ERROR_MAXIMUM_VALUE				
};


tnx
Last edited on Jun 19, 2012 at 6:56pm
Jun 19, 2012 at 7:00pm
This can sometimes mean that there is something wrong with the code preceding this point in the file. Your "enum" looks fine, I would check the line of code right above it for any mistakes.
Jun 19, 2012 at 7:35pm
that's the beginning of the header.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
//*****************************************************************************//
//*****************************************************************************//
//
//	Source: api\atm3dgm
//
//	Author: crobertson
//
//	Revision for ATC3DGm 7,0,0,0
//
//
//	Date: 2002/02/19 13:27:58
//
//	COPYRIGHT:		COPYRIGHT ASCENSION TECHNOLOGY CORPORATION - 2000, 2001
//
//*****************************************************************************//
//*****************************************************************************//


#ifndef ATC3DGm_H   // JPB bumper to prevent multiple-inclusion
#define ATC3DGm_H
using namespace ATC3DGm_H

#define CPLUSPLUS

#ifdef LINUX
#define ATC3DGm_API
#else
#ifdef DEF_FILE
	#ifdef ATC3DGm_EXPORTS
	#define ATC3DGm_API
	#else
	#define ATC3DGm_API
	#endif
#else
	#ifdef CPLUSPLUS
		#ifdef ATC3DGm_EXPORTS
		#define ATC3DGm_API __declspec(dllexport)
		#else
		#define ATC3DGm_API __declspec(dllimport)
		#endif
	#else
		#ifdef ATC3DGm_EXPORTS
		#define ATC3DGm_API extern "C" __declspec(dllexport)
		#else
		#define ATC3DGm_API extern "C" __declspec(dllimport)
		#endif
	#endif
#endif
#endif




/*****************************************************************************
							ENUMERATED CONSTANTS
 *****************************************************************************/

//*****************************************************************************
//
//	ERROR MESSAGE format is as follows:
//	===================================
//
//	All commands return a 32-bit integer with the following bit definitions:
//
//   3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0
//   1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
//  +-+-+-+-+-+-+-----------+-------+-------------------------------+
//  |E|W|X|R|B|M|  Reserved |Address|             Code              |
//  +-+-+-+-+-+-+-----------+-------+-------------------------------+
//
//  where
//
//		E - indicates an ERROR
//			(Operation either cannot or will not proceed as intended
//				e.g. EEPROM error of some kind. Requires hardware reset
//				of system and/or replacement of hardware)
//		W - indicates a WARNING
//			(Operation may proceed but remedial action needs to be taken
//				e.g. Sensor has been removed. Fix by replacing Sensor)
//      X - indicates Transmitter related message
//      R - indicates Sensor related message
//			(If neither X nor R is set then the message is a SYSTEM message)
//		B - indicates message originated in the BIRD hardware
//		M - indicates there are more messages pending (no longer used)
//
//		Address gives the index number of the device generating the message
//			(Driver and system messages always have address 0)
//
//      Code - is the status code as enumerated in BIRD_ERROR_CODES
//
//*****************************************************************************

enum BIRD_ERROR_CODES   // the message points this line 
{
	BIRD_ERROR_MAXIMUM_VALUE				
};

Jun 19, 2012 at 7:50pm
closed account (zb0S216C)
You're missing the semi-colon on line 21.

Wazzak
Jun 20, 2012 at 9:03am
now i get this error

using namespace ATC3DGm_H; // error: expected identifier before ';' token
Last edited on Jun 20, 2012 at 9:14am
Jun 20, 2012 at 9:25am
It is because the name of the namespace coinsides with the manifest constant

#ifndef ATC3DGm_H // JPB bumper to prevent multiple-inclusion
#define ATC3DGm_H
using namespace ATC3DGm_H;

The preprocessor substitutes it for blank and you get using namespace;
Last edited on Jun 20, 2012 at 10:45am
Jun 21, 2012 at 8:48am
tnx, what about this?

Compiling...
Sample.cpp
Linking...
Sample.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) int __cdecl ...
Debug/Sample.exe : fatal error LNK1120: 7 unresolved externals
Error executing link.exe.

Sample.exe - 8 error(s), 0 warning(s

Is there maybe a problem with linking libraries?
Jun 21, 2012 at 11:44am
It means that the compiler can not fiind the definitions ot these names. Either not all modules or not all libraries were included in the project.
Jun 21, 2012 at 12:33pm
I didn't use the right compiler - had to change from GNU GCC Compiler to Microsoft Visual C++ Toolkit 2003. I followed these instruction: http://wiki.codeblocks.org/index.php?title=Integrating_Microsoft_Visual_Toolkit_2003_with_Code::Blocks_IDE

tnx for help

Last edited on Jun 21, 2012 at 12:33pm
Topic archived. No new replies allowed.