Problème classe winnt.h

Signaler
Messages postés
48
Date d'inscription
jeudi 26 avril 2007
Statut
Membre
Dernière intervention
10 décembre 2009
-
Messages postés
192
Date d'inscription
vendredi 19 mars 2004
Statut
Membre
Dernière intervention
30 janvier 2008
-
Bonjour,
J'ai un problème avec la classe winnt.h de windows:

J'essais d'ouvrir mon port série avec des fonction qui utilise DWORD.
Lorsque je compile:

d:\ni\code\testgps2\testgps2\testGPS.h(34) : error C2061: syntax error : identifier 'DWORD'

d:\ni\code\testgps2\testgps2\testGPS.h(36) : error C2061: syntax error : identifier 'DWORD'

Donc j'inclue dans mes fichier .h le fichier windef.h ou se trouve la definition de DWORD et lors de la compilation:

TestGPS.cpp

C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winnt.h(3857) : error C2146: syntax error : missing ';' before identifier 'ContextRecord'

C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winnt.h(3857) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winnt.h(3857) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winnt.h(8319) : error C2065: 'PCONTEXT' : undeclared identifier

C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winnt.h(8320) : error C2146: syntax error : missing ')' before identifier 'ContextRecord'

C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winnt.h(8320) : warning C4229: anachronism used : modifiers on data are ignored

C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winnt.h(8320) : error C2182: 'RtlCaptureContext' : illegal use of type 'void'

C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winnt.h(8320) : error C2491: 'RtlCaptureContext' : definition of dllimport data not allowed

C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winnt.h(8320) : error C2059: syntax error : ')'

C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winnt.h(9594) : error C3861: '__readfsdword': identifier not found

Des erreur dans le dossier winnt!!!!

Quelqu'un pourrait il m'aider à comprendre ce qui se passe.

voici les .h de mes deux fonctions:

CLASSE LSERIE:

#ifndef

LSERIE_H
#define

LSERIE_H
#include

<string>#include

<windef.h>using

namespace std; 

class

LSerie {

public

:

//------ CONSTRUCTOR ------LSerie();

virtual ~LSerie();

//------ OPEN AND CONFIGURE ------

bool open(
int numPort,
long speedInBaud);
//Open the serial port COM "numPort" at the speed "speedInBaud".

// bauds with and this adjustement : 8 bit / 1 stop bit / no parity).

// Return: true if success.

bool open(
int numPort,
long speedInBaud,
//Open the serial port COM "numPort" at the speed "speedInBaud".

int nbBit,
int parity,
float nbStopBit);
// bauds with and this adjustement : "nbBit" bit / "nbStopBit" stop bit / "parity").

// Return: true if success.

void closeCom();
//Close the serial port.

bool setTimeOut(DWORD ms);
//Set the time-out for receive data. Return: true if success.

bool setSpeed(DWORD baudrate);
//Set the speed in bauds. Return: true if success.

//------ SEND AND RECEIVE DATA ------

int sendData(DWORD lg, LPBYTE data);
//Send table "data" of "lg" bytes. Return: number of bytes really sent.

int sendData(string* data);
//Send string "data". Return: number of bytes really sent.

int receiveData(DWORD lg, LPBYTE data);
//Receive table "data" who is limit at "lg" bytes. Return: number of bytes received.

int receiveData(string* data);
//Receive string "data". Return: number of bytes received.

//------ READ AND WRITE THE STATE OF THE CONTROL LINE ------

bool setRts(
bool val);
// Set the state of RTS. Return: true if success.

bool setDtr(
bool val);
// Set the state of DTR. Return: true if success.

bool setTxd(
bool val);
// Set the state of TXD. Return: true if success.

bool getCts();
// Return: The state of CTS.

bool getDtr();
// Return: The state of DTR.

bool getRi();
// Return: The state of RI.

bool getCd();
// Return: The state of CD.

string getErrorMsg();

// Return: The error message generated by the last function.private

:HANDLE hcom;

//Fichier de sortie sur le port COM | The file stream use for acces to the serial port._COMMTIMEOUTS ct;

//={0,0,0,0,0}; //Config du Time Out | This variable contain the delay of the time-out. DCB dcb;

//Config du Port | This object is use in order to configure the serial port.

int bufferSize;};

#endif

CLASSE TESTGPS:
#ifndef

_TESTGPS_H
#define

_TESTGPS_H
#include

<time.h>#include

"LSerie.h"#include

<windef.h>struct

TestGPS_NmeaFrameStr
// GGA NMEA frame parameters (GPS){

double latDeg;
//!< Latitude WSG84 Coordinates in degrees - decimal

double lngDeg;
//!< Longitude WSG84 coordinates in degrees -decimal

char lngDir;
//!< Longitude direction (E or W)

char latDir;
//!< Lat. dir (N or S)

long utms;
//!< Time (UTC)

double alt;
//!< Altitude in meters

double Hd;
//!< Heading of direction change frame

double AngVar;
//!< Angular change

char DirVar;
//!< Direction change};

class

TestGPS{

protected

:TestGPS_NmeaFrameStr _lastFrame;

LSerie * _serialPort;

public



void TestGPS::open(
int numPort,
long speedInBaud,
int nbBit,
int parity,
float nbStopBit);

void TestGPS::closeCom();

void TestGPS::setTimeOut(DWORD ms);

void TestGPS::setSpeed(DWORD baudrate)

void TestGPS::sendData(DWORD lg, LPBYTE data);

void TestGPS::LSerie::receiveData(DWORD lg, LPBYTE data);

long getTime(
void);

double getLatDeg(
void);

char getLatDir(
void);

double getLngDeg(
void);

char getLngDir(
void);

double getAlt(
void);

double getHd(
void);

double getAngVar(
void);

char getDirVar(
void);

}

#endif

Je vous remercie.

1 réponse

Messages postés
192
Date d'inscription
vendredi 19 mars 2004
Statut
Membre
Dernière intervention
30 janvier 2008

Il te manque un point-virgule apres la derniere accolade (celle de la classe)