Compiler Error, How to debug
Hello yesterday I was working on my project which is a pretty big one with
about a hundred classes(I've worked on it for several months) and then I
added some functions and messages and message handlers and when I compiled
it gave me hundreds of errors. In the past day I almost completely focused
to find what is going on with no success. I give you some clues maybe you
can tell me what I can do:
1) I have a global constant data "param.h" that is included in most classes.
in this header because I have used vector in struct definitions I've added
"using namespace std;"
2) in almost all of my header files I've included
#ifndef HEADER_NAME_H_
#define HEADER_NAME_H_
....body of header file
#endif
3)When I include one of my classes header file"CommFTDI.h" in my CDocument
derived class that the class itself has included header file of a USB chip
driver
FTDI.h and uses a FTDI.lib I get 206 errors all relates to this FTDI header
file and compiler thinks that I have defined functions in header file but I
did not. I have used this header file in numerous projects without any
change. I have not touched this file for weeks and as I said it worked
perfectly well yesterday before all this happens
these are first errors
--There is no error 1-23
Error 24 error C2146: syntax error : missing ';' before identifier
'FT_HANDLE' d:\comm\ftd2xx.h 58
Error 25 error C2040: 'PVOID' : 'CDevView' differs in levels of indirection
from 'void *' d:\comm\ftd2xx.h 58
Error 26 error C4430: missing type specifier - int assumed. Note: C++ does
not support default- int d:\comm\ftd2xx.h 58
Error 27 error C2061: syntax error : identifier 'FT_HANDLE' d:\comm\ftd2xx.h
209
Error 28 error C2061: syntax error : identifier 'FT_HANDLE' d:\comm\ftd2xx.h
216
Error 29 error C2146: syntax error : missing ')' before identifier
'ftHandle' d:\comm\ftd2xx.h 229
Error 31 error C2491: 'FT_Close' : definition of dllimport data not allowed
d:\comm\ftd2xx.h 229
Error 32 error C2059: syntax error : ')' d:\comm\ftd2xx.h 229
Error 33 error C2146: syntax error : missing ')' before identifier
'ftHandle' d:\comm\ftd2xx.h 233
Error 35 error C2491: 'FT_Read' : definition of dllimport data not allowed
d:\comm\ftd2xx.h 233
Error 36 error C2059: syntax error : ')' d:\comm\ftd2xx.h 237
Error 37 error C2146: syntax error : missing ')' before identifier
'ftHandle' d:\comm\ftd2xx.h 241
Error 39 error C2491: 'FT_Write' : definition of dllimport data not allowed
d:\comm\ftd2xx.h 241
Error 40 error C2059: syntax error : ')' d:\comm\ftd2xx.h 245
Error 41 error C2146: syntax error : missing ')' before identifier
'ftHandle' d:\ftd2xx.h 249
Error 43 error C2491: 'FT_IoCtl' : definition of dllimport data not allowed
d:\comm\ftd2xx.h 249
Error 44 error C2059: syntax error : ')' d:\comm\ftd2xx.h 257
Error 45 error C2146: syntax error : missing ')' before identifier
'ftHandle' d:\comm\ftd2xx.h 261
Error 47 error C2491: 'FT_SetBaudRate' : definition of dllimport data not
allowed d:\comm\ftd2xx.h 261
Error 48 error C2059: syntax error : ')' d:\comm\ftd2xx.h 263
Error 49 error C2146: syntax error : missing ')' before identifier
'ftHandle' d:\comm\ftd2xx.h 267
Error 51 error C2491: 'FT_SetDivisor' : definition of dllimport data not
allowed d:\comm\ftd2xx.h 267
......
Error 304 error C2146: syntax error : missing ')' before identifier
'ftHandle' d:\comm\ftd2xx.h 525
Error 305 fatal error C1003: error count exceeds 100; stopping compilation
d:\comm\ftd2xx.h 525
this is part of this ftd2xx.h but I insist it has nothing to do with it I
put the code here just for sake of completeness
#ifdef FTD2XX_EXPORTS
#define FTD2XX_API __declspec(dllexport)
#else
#define FTD2XX_API __declspec(dllimport)
#endif
Error #24 >> typedef PVOID FT_HANDLE;
typedef ULONG FT_STATUS;
.....
Error#31>> FTD2XX_API
FT_STATUS WINAPI FT_Close(
FT_HANDLE ftHandle
);
.....
4)when I remove #include "CommFTDI.h" from my CDocument derived class I just
get 2 errors
Error 1 error C2143: syntax error : missing ';' before 'namespace'
c:\program files\microsoft visual studio 9.0\vc\include\algorithm 14
Error 2 error C2143: syntax error : missing ';' before 'namespace'
c:\program files\microsoft visual studio 9.0\vc\include\algorithm 14
well, I have not included algorithm in my project directly
but when I click on error it goes to line 14 of algorithm
this is beginning of algorithm file
#pragma once
#ifndef _ALGORITHM_
#define _ALGORITHM_
#ifndef RC_INVOKED
#include <memory>
#ifdef _MSC_VER
#pragma pack(push,_CRT_PACKING)
#pragma warning(push,3)
#pragma warning(disable: 4244)
#endif /* _MSC_VER */
Line #14>> _STD_BEGIN
// COMMON SORT PARAMETERS
const int _ISORT_MAX = 32; // maximum size for insertion
sort
and mfc has defined these statements
#define _STD_BEGIN namespace std {
#define _STD_END }
5) it dose not give any error about codes that I have written, that's why I
don't know how to debug it. as I said yesterday all things were Ok and I
have worked for several months on this project and I had not such problem
until yesterday.all these codes including FTDI codes were present I have
only added some functions and message and message handlers. unfortunately I
can't remember exactly what I've added between last successful compile and
these errors but as far as I remembered I tried to comment them out but
still problem persists. All I can say for sure what ever I added had nothing
to do with FTDI or algorithm.
any help or suggestion of how to debug greatly appreciated.