Click here to Skip to main content
15,890,825 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: point reference VS value Pin
sharion19-Apr-09 5:25
sharion19-Apr-09 5:25 
GeneralRe: point reference VS value Pin
Stuart Dootson19-Apr-09 7:15
professionalStuart Dootson19-Apr-09 7:15 
GeneralRe: point reference VS value Pin
sharion20-Apr-09 18:30
sharion20-Apr-09 18:30 
GeneralRe: point reference VS value Pin
Stuart Dootson20-Apr-09 19:40
professionalStuart Dootson20-Apr-09 19:40 
GeneralRe: point reference VS value Pin
sharion21-Apr-09 18:05
sharion21-Apr-09 18:05 
GeneralRe: point reference VS value Pin
Stuart Dootson21-Apr-09 21:39
professionalStuart Dootson21-Apr-09 21:39 
GeneralRe: point reference VS value Pin
sharion22-Apr-09 16:00
sharion22-Apr-09 16:00 
QuestionProblem with headers in VS 2008 [modified] Pin
mass8518-Apr-09 10:07
mass8518-Apr-09 10:07 
I get compilation errors while using multiple header inclusion in Win32 console application. At the moment I use Visual Studio 2008.


EDCA.cpp:
#pragma once
#include "stdafx.h"
#include "mac.h"
#include "globals.h"



void main()
{
	StaT as;
	Mac asdf;
	asdf.accesspoint = 0;
}

mac.h:
#pragma once
#ifndef mac_h
#define mac_h

#include "globals.h"
#define AC 4

enum StaT{
	AP,
	STA,
	REP
};


class Mac{
public:
	StaT	type;				//type of STA (AP, STA, REP)
	//....
	Mac () {}

};
#endif

globals.h:

#pragma once
#ifndef globals_h
#define globals_h

#include "mac.h"


extern const double SIFS;	//SIFS duration
extern const double SLOT;	//Slot duration

#define AC 4		//number of access categories

extern int staNr;			//total number of stations
extern Mac *sta;			//array of STAs

StaT fg;
#endif

It doesn't matter whether I use #pragma once, #ifndef #define or both of them. It always results in such errors:
1>d:\studia\mgr\program\edca\edca\globals.h(14) : error C2143: syntax error : missing ';' before '*'
1>d:\studia\mgr\program\edca\edca\globals.h(14) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\studia\mgr\program\edca\edca\globals.h(14) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\studia\mgr\program\edca\edca\globals.h(16) : error C2146: syntax error : missing ';' before identifier 'fg'
1>d:\studia\mgr\program\edca\edca\globals.h(16) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\studia\mgr\program\edca\edca\globals.h(16) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\studia\mgr\program\edca\edca\mac.h(17) : error C2146: syntax error : missing ';' before identifier 'type'
1>d:\studia\mgr\program\edca\edca\mac.h(17) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\studia\mgr\program\edca\edca\mac.h(17) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\studia\mgr\program\edca\edca\edca.cpp(12) : error C2146: syntax error : missing ';' before identifier 'as'
1>d:\studia\mgr\program\edca\edca\edca.cpp(12) : error C2065: 'as' : undeclared identifier
1>d:\studia\mgr\program\edca\edca\edca.cpp(13) : error C2146: syntax error : missing ';' before identifier 'asdf'
1>d:\studia\mgr\program\edca\edca\edca.cpp(13) : error C2065: 'asdf' : undeclared identifier
1>d:\studia\mgr\program\edca\edca\edca.cpp(14) : error C2065: 'asdf' : undeclared identifier
1>d:\studia\mgr\program\edca\edca\edca.cpp(14) : error C2228: left of '.accesspoint' must have class/struct/union
1>        type is ''unknown-type''

I always used #ifndef #define directives when I wrote a code in VS 2005 on Windows XP and it worked well. When I try to open some past projects in VS 2005 on my new computer with Windows Vista, I get similar errors. Can anyone explain it to me?

modified on Saturday, April 18, 2009 4:30 PM

AnswerRe: Problem with headers in VS 2008 Pin
Luc Pattyn18-Apr-09 10:33
sitebuilderLuc Pattyn18-Apr-09 10:33 
GeneralRe: Problem with headers in VS 2008 Pin
mass8518-Apr-09 11:08
mass8518-Apr-09 11:08 
GeneralRe: Problem with headers in VS 2008 Pin
Stuart Dootson18-Apr-09 11:36
professionalStuart Dootson18-Apr-09 11:36 
GeneralRe: Problem with headers in VS 2008 Pin
mass8518-Apr-09 11:45
mass8518-Apr-09 11:45 
GeneralRe: Problem with headers in VS 2008 Pin
Stuart Dootson18-Apr-09 11:49
professionalStuart Dootson18-Apr-09 11:49 
GeneralRe: Problem with headers in VS 2008 Pin
Luc Pattyn18-Apr-09 11:57
sitebuilderLuc Pattyn18-Apr-09 11:57 
GeneralRe: Problem with headers in VS 2008 Pin
mass8518-Apr-09 12:00
mass8518-Apr-09 12:00 
Question[Message Deleted] Pin
marcusab18-Apr-09 9:16
marcusab18-Apr-09 9:16 
AnswerRe: How to copy/convert System::Object^(unsigned char) to local variable Pin
CPallini18-Apr-09 9:54
mveCPallini18-Apr-09 9:54 
Question880129 - class of matrix of complex numbers Pin
ilostmyid218-Apr-09 9:15
professionalilostmyid218-Apr-09 9:15 
AnswerRe: 880129 - class of matrix of complex numbers Pin
CPallini18-Apr-09 9:52
mveCPallini18-Apr-09 9:52 
GeneralRe: 880129 - class of matrix of complex numbers Pin
ilostmyid218-Apr-09 16:22
professionalilostmyid218-Apr-09 16:22 
GeneralRe: 880129 - class of matrix of complex numbers Pin
CPallini19-Apr-09 8:44
mveCPallini19-Apr-09 8:44 
GeneralRe: 880129 - class of matrix of complex numbers Pin
ilostmyid219-Apr-09 18:54
professionalilostmyid219-Apr-09 18:54 
GeneralRe: 880129 - class of matrix of complex numbers Pin
CPallini19-Apr-09 21:25
mveCPallini19-Apr-09 21:25 
GeneralRe: 880129 - class of matrix of complex numbers Pin
ilostmyid220-Apr-09 0:07
professionalilostmyid220-Apr-09 0:07 
GeneralRe: 880129 - class of matrix of complex numbers Pin
CPallini20-Apr-09 0:15
mveCPallini20-Apr-09 0:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.