Probleme C++ Main

Résolu/Fermé
coutosuiss13 Messages postés 1 Date d'inscription lundi 8 février 2010 Statut Membre Dernière intervention 8 février 2010 - 8 févr. 2010 à 18:58
mamiemando Messages postés 33129 Date d'inscription jeudi 12 mai 2005 Statut Modérateur Dernière intervention 27 mai 2024 - 9 févr. 2010 à 14:17
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

3 réponses

DrCrow Messages postés 387 Date d'inscription lundi 9 novembre 2009 Statut Membre Dernière intervention 20 août 2014 19
8 févr. 2010 à 22:48
faut pas faire void main()
mais bien int main(), c'est pour sa
0
Nabla's Messages postés 18203 Date d'inscription mercredi 4 juin 2008 Statut Contributeur Dernière intervention 28 avril 2014 3 193
9 févr. 2010 à 10:56
et si t'es obligé de faire int main, tu mets return 0; à la fin de ton main
0
mamiemando Messages postés 33129 Date d'inscription jeudi 12 mai 2005 Statut Modérateur Dernière intervention 27 mai 2024 7 755
9 févr. 2010 à 14:17
Pour compléter ce qui a été dit, n'oublie pas de mettre int en type de retour pour la fonction main :

int main(){
  //...
  return 0;
}


Bonne chance
0