IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

 C Discussion :

compilateur m'affiche des erreurs


Sujet :

C

Mode arborescent

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre actif
    Profil pro
    Inscrit en
    Février 2010
    Messages
    87
    Détails du profil
    Informations personnelles :
    Localisation : Algérie

    Informations forums :
    Inscription : Février 2010
    Messages : 87
    Par défaut compilateur m'affiche des erreurs
    bonjour

    voici le code

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
     
    #include <stdio.h>
    #include "portio32.h"
     
    #define BASE 384
     
    int main()
    {
    	int result; //holds the error or success codes from calls to functions from PortIO32
    	int value;  //holds the value read from Port B (Port 2)
    	int count=0; //holds how many times the pushbutton has been pressed
    	char choice;
     
    	//First, we will output a notice and ask for user confirmation
    	//this would not normally be done in an actual application.
    	printf("Note: This program configures Port 1 as an output port.  Please be sure that you do not have interfering hardware connected to port 1 of your card.\n");
    	printf("Also note that this program assumes your card's base address is %d. If that is incorrect, please edit the definition of BASE in the source code.\nContinue (Y/N)?", BASE);
    	choice = getchar();
    	if( (choice != 'y') && (choice != 'Y') )
    		return(0);
     
    	// Note that in this application, the error codes are checked on most function calls.
    	// In a normal application, it would not be necessary to
    	// check for errors on all of the functions, but it is done here
    	// to show that it is possible.
     
    	//configure the card. Port A (1) should be an output and Port B (2) and C (3) will be inputs
    	result=OutByte(BASE + 3, 139); //139 is the proper control byte for this situation
    	if(result == -1)//error occurred
    	{
    		printf("An error occurred while writing a value to a port.\n");
    		return(-1);
    	}
     
     
    	printf("Waiting for button to be pressed.  To exit, press Ctrl-C\n");
    	fflush(stdout);//fflush would not normally be used, but it is in this case because of the continuous loop
     
    	while(1)//loop to monitor the state of the pushbutton
    	{		//Note that this loop has no delays, so it uses up
    			//all of the CPU time that it can.  This is done to
    			//keep the sample code simple. In a real program,
    			//it is recommended that you implement some kind
    			//of sleep or timer mechanism.
    		result = InByte(BASE + 1, &value);//read a value from Port B
    		if(result == -1)
    		{
    			printf("An error occurred while reading a value from a port.\n");
    			return(-1);
    		}
     
    		//in this sample, we will assume that when the button is pressed,
    		//it results in Bit 0 being low (0)
    		if( !(value & 1) )//test whether bit 0 (which has a binary weight of 1) is off
    		{//the code below will execute if bit 0 was off (button pressed)
    			count++;//increment counter
    			printf("Count: %d\n", count);
    			fflush(stdout);
     
    			//output the new count to the LEDs on port A
    			result=OutByte(BASE, count);
    			if(result == -1)//function failed
    			{
    				printf("An error occurred while writing a value.\n");
    				return(-1);
    			}
    			//Now we will wait until bit 0 goes back to being on (wait til the pushbutton is released)
    			//so, we will loop while bit 0 is off
    			while( !(value & 1) )
    			{
    				InByte(BASE + 1, &value); //note that this could be (note the R) value=InByteR(BASE + 1);
    			}//end of inner while loop
    		}//end of if (test for button pressed)
    	}//end of while loop
    	return(0);
    }//end of main function
    le compilateur m'affiche des errerurs sur les lignes de la fonction inbyte et outbyte

    undefined reference to '_outbyte@8'
    undefined reference to '_inbyte@8'
    undefined reference to '_outbyte@8'
    undefined reference to '_inbyte@8'
    merci d'avance
    Fichiers attachés Fichiers attachés

Discussions similaires

  1. Réponses: 1
    Dernier message: 01/04/2008, 15h59
  2. Afficher des erreurs HTTP simplifiées
    Par Manatane dans le forum IIS
    Réponses: 5
    Dernier message: 06/09/2007, 17h52
  3. Réponses: 9
    Dernier message: 07/02/2006, 15h11
  4. [ImageMagick] Image ne pouvant être affichée car elle contient des erreurs
    Par hutchuck dans le forum Bibliothèques et frameworks
    Réponses: 5
    Dernier message: 09/12/2005, 13h59
  5. Afficher le détail des erreurs syntaxiques
    Par Laurent Birckel dans le forum PostgreSQL
    Réponses: 7
    Dernier message: 22/03/2005, 17h44

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo