Probleme C++ Main
Résolu
Bonjour,
J'utilise DevC++ pour compiler mon programme C++. Seulement lorsque je lance je recoit un message d'erreur
#include <windows.h>
#include <stdio.h>
#include <conio.h>
#include <cbw.h>
/* Prototypes */
void ClearScreen (void);
void GetTextCursor (int *x, int *y);
void MoveCursor (int x, int y);
void main ()
{
/* Variable Declarations */
int Row, Col, I;
int BoardNum = 0; //THIS MUST BE THE SAME AS INSTACAL SETTING FOR BOARD INDEX
int ULStat = 0;
int LowChan = 0; // Specifies low channel number for scan
int HighChan = 0; // Specifies high channel number for scan
int Gain = BIP10VOLTS; //Input range
long Count = 992; //Number of samples to acquire **must be integer multiple of 31**
long Rate = 1000; // sample rate
WORD ADData[992]; //Declare the array of 992 samples
unsigned Options;
float MyData;
/* Initiate error handling
Parameters:
PRINTALL :all warnings and errors encountered will be printed
DONTSTOP :program will continue even if error occurs.
Note that STOPALL and STOPFATAL are only effective in
Windows applications, not Console applications.
*/
cbErrHandling (PRINTALL, DONTSTOP);
/* set up the display screen */
ClearScreen();
printf ("Demonstration of cbAInScan() in FOREGROUND mode\n\n");
printf ("A USB/PMD-1208FS MUST be assigned to Board 0 in InstaCal.\n");
/* Collect the values with cbAInScan()
Parameters:
BoardNum :the number used by CB.CFG to describe this board
LowChan :low channel of the scan
HighChan :high channel of the scan
Count :the total number of A/D samples to collect
Rate :sample rate in samples per second
Gain :the gain for the board
DataBuffer[]:the array for the collected data values
Options :data collection options */
Options = CONVERTDATA;
ULStat = cbAInScan (BoardNum, LowChan, HighChan, Count, &Rate,
Gain, ADData, Options);
ClearScreen();
printf ("Demonstration of cbAInScan() in FOREGROUND mode\n\n");
printf ("A USB/PMD-1208LS MUST be assigned to Board 1 in InstaCal.\n");
/* display the data */
/* loop through the channels */
printf ("\nThe first 100 data values on Channel 0 are:\n ");
GetTextCursor (&Col, &Row);
for (I = 0; I < 100; I++) /* loop through the values & print */
{
ULStat = cbToEngUnits(BoardNum,Gain, ADData[I], &MyData);
MoveCursor (5, Row + I);
printf ("Sample: %d, Counts: %4u, Volts: %f", I, ADData[I], MyData);
}
printf ("\n");
return 0;
}
Je dois en fait programmer un truc qui enregistre les valeurs d'un accelerometre dans un fichier. Le programme m'a été donné par la compagnie qui vends l'accelerometre.
Mon probleme :
MAIN must return INT... je ne sais pas comment resoudre cela.
Merci de votre aide
J'utilise DevC++ pour compiler mon programme C++. Seulement lorsque je lance je recoit un message d'erreur
#include <windows.h>
#include <stdio.h>
#include <conio.h>
#include <cbw.h>
/* Prototypes */
void ClearScreen (void);
void GetTextCursor (int *x, int *y);
void MoveCursor (int x, int y);
void main ()
{
/* Variable Declarations */
int Row, Col, I;
int BoardNum = 0; //THIS MUST BE THE SAME AS INSTACAL SETTING FOR BOARD INDEX
int ULStat = 0;
int LowChan = 0; // Specifies low channel number for scan
int HighChan = 0; // Specifies high channel number for scan
int Gain = BIP10VOLTS; //Input range
long Count = 992; //Number of samples to acquire **must be integer multiple of 31**
long Rate = 1000; // sample rate
WORD ADData[992]; //Declare the array of 992 samples
unsigned Options;
float MyData;
/* Initiate error handling
Parameters:
PRINTALL :all warnings and errors encountered will be printed
DONTSTOP :program will continue even if error occurs.
Note that STOPALL and STOPFATAL are only effective in
Windows applications, not Console applications.
*/
cbErrHandling (PRINTALL, DONTSTOP);
/* set up the display screen */
ClearScreen();
printf ("Demonstration of cbAInScan() in FOREGROUND mode\n\n");
printf ("A USB/PMD-1208FS MUST be assigned to Board 0 in InstaCal.\n");
/* Collect the values with cbAInScan()
Parameters:
BoardNum :the number used by CB.CFG to describe this board
LowChan :low channel of the scan
HighChan :high channel of the scan
Count :the total number of A/D samples to collect
Rate :sample rate in samples per second
Gain :the gain for the board
DataBuffer[]:the array for the collected data values
Options :data collection options */
Options = CONVERTDATA;
ULStat = cbAInScan (BoardNum, LowChan, HighChan, Count, &Rate,
Gain, ADData, Options);
ClearScreen();
printf ("Demonstration of cbAInScan() in FOREGROUND mode\n\n");
printf ("A USB/PMD-1208LS MUST be assigned to Board 1 in InstaCal.\n");
/* display the data */
/* loop through the channels */
printf ("\nThe first 100 data values on Channel 0 are:\n ");
GetTextCursor (&Col, &Row);
for (I = 0; I < 100; I++) /* loop through the values & print */
{
ULStat = cbToEngUnits(BoardNum,Gain, ADData[I], &MyData);
MoveCursor (5, Row + I);
printf ("Sample: %d, Counts: %4u, Volts: %f", I, ADData[I], MyData);
}
printf ("\n");
return 0;
}
Je dois en fait programmer un truc qui enregistre les valeurs d'un accelerometre dans un fichier. Le programme m'a été donné par la compagnie qui vends l'accelerometre.
Mon probleme :
MAIN must return INT... je ne sais pas comment resoudre cela.
Merci de votre aide
A voir également:
- Probleme C++ Main
- La main de la titi popo - Forum Musique / Radio / Clip
- Scan ligne de la main gratuit - Télécharger - Photo & Graphisme
- Main menu xiaomi - Forum Xiaomi
- Désactiver remise en main propre leboncoin - Forum Consommation & Internet
- Prise en main a distance windows - Guide