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

Dev-C++ Discussion :

[Débutant] Problème avec Dev-Cpp 4.9.9.0


Sujet :

Dev-C++

  1. #1
    Candidat au Club
    Inscrit en
    Novembre 2004
    Messages
    4
    Détails du profil
    Informations forums :
    Inscription : Novembre 2004
    Messages : 4
    Points : 2
    Points
    2
    Par défaut [Débutant] Problème avec Dev-Cpp 4.9.9.0
    Bonjour,

    Je débute en C. J'ai voulu tester ce petit prog mais il ne fonctionne pas.
    Voila le petit prog :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    #include <conio.h>
     
     
    main()
    {
        gotoxy(5,5);
        printf("bonjour");
        getch();
    }
    Voila ce qu'il me met comme erreur :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
      [Linker error] undefined reference to `gotoxy'
    Quelqu'un aurait-il une solution ? Que faire ?
    Merci pour votre aide.

  2. #2
    Rédacteur

    Avatar de khayyam90
    Homme Profil pro
    Architecte de système d’information
    Inscrit en
    Janvier 2004
    Messages
    10 369
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 39
    Localisation : France, Bas Rhin (Alsace)

    Informations professionnelles :
    Activité : Architecte de système d’information

    Informations forums :
    Inscription : Janvier 2004
    Messages : 10 369
    Points : 40 164
    Points
    40 164
    Par défaut
    bien le bonsoir

    il faut ajouter conio.c à ton projet

  3. #3
    Candidat au Club
    Inscrit en
    Novembre 2004
    Messages
    4
    Détails du profil
    Informations forums :
    Inscription : Novembre 2004
    Messages : 4
    Points : 2
    Points
    2
    Par défaut
    Je n'ai pas de conio.c, j'ai seulement un conio.h

    J'ai entendu parler d'un conio.o aussi mais je ne l'ai pas non plus.

  4. #4
    Rédacteur

    Avatar de khayyam90
    Homme Profil pro
    Architecte de système d’information
    Inscrit en
    Janvier 2004
    Messages
    10 369
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 39
    Localisation : France, Bas Rhin (Alsace)

    Informations professionnelles :
    Activité : Architecte de système d’information

    Informations forums :
    Inscription : Janvier 2004
    Messages : 10 369
    Points : 40 164
    Points
    40 164
    Par défaut
    Citation Envoyé par HRS
    jusqu'à la dernière version, dans \include, Bloodshed livrait en plus
    de conio.h (standard MinGW), un conio.c contenant des fonctions Borland
    telles clrscr(), textcolor().

    conio.c a disparu de cette version
    et c'est là qu'est l'os, hélas.

    voici le contenu du fameux conio.c venant des versions précédentes de devcpp.

    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
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
     
    /* A conio implementation for Mingw/Dev-C++.
     *
     * Written by:
     * Hongli Lai <hongli@telekabel.nl>
     * tkorrovi <tkorrovi@altavista.net> on 2002/02/26. 
     * Andrew Westcott <ajwestco@users.sourceforge.net>
     *
     * Offered for use in the public domain without any warranty.
     */
     
    #ifndef _CONIO_C_
    #define _CONIO_C_
     
    #include <stdio.h>
    #include <stdlib.h>
    #include <unistd.h>
    #include <windows.h>
    #include <string.h>
    #include "conio.h"
     
    #ifdef __cplusplus
    extern "C" {
    #endif
     
    static int __BACKGROUND = BLACK;
    static int __FOREGROUND = LIGHTGRAY;
     
     
    void
    clrscr ()
    {
        DWORD written;
     
        FillConsoleOutputAttribute (GetStdHandle (STD_OUTPUT_HANDLE),
          __FOREGROUND + (__BACKGROUND << 4), 2000, (COORD) {0, 0},
          &written);
          FillConsoleOutputCharacter (GetStdHandle
          (STD_OUTPUT_HANDLE), ' ',
          2000, (COORD) {0, 0}, &written);
        gotoxy (1, 1);
    }
     
     
    void
    clreol ()
    {
        COORD coord;
        DWORD written;
        CONSOLE_SCREEN_BUFFER_INFO info;
     
        GetConsoleScreenBufferInfo (GetStdHandle (STD_OUTPUT_HANDLE),
          &info);
        coord.X = info.dwCursorPosition.X;
        coord.Y = info.dwCursorPosition.Y;
     
        FillConsoleOutputCharacter (GetStdHandle (STD_OUTPUT_HANDLE),
          ' ', info.dwSize.X - info.dwCursorPosition.X, coord, &written);
        gotoxy (coord.X, coord.Y);
    }
     
     
    void
    delline()
    {
        COORD coord;
        DWORD written;
        CONSOLE_SCREEN_BUFFER_INFO info;
     
        GetConsoleScreenBufferInfo (GetStdHandle (STD_OUTPUT_HANDLE),
          &info);
        coord.X = info.dwCursorPosition.X;
        coord.Y = info.dwCursorPosition.Y;
     
        FillConsoleOutputCharacter (GetStdHandle (STD_OUTPUT_HANDLE),
          ' ', info.dwSize.X * info.dwCursorPosition.Y, coord, &written);
        gotoxy (info.dwCursorPosition.X + 1,
        info.dwCursorPosition.Y + 1);
    }
     
     
    int
    _conio_gettext (int left, int top, int right, int bottom,
      char *str)
    {
        int i, j, n;
        SMALL_RECT r;
        CHAR_INFO buffer[25][80];
     
        r = (SMALL_RECT) {left - 1, top - 1, right - 1, bottom - 1};
        ReadConsoleOutput (GetStdHandle (STD_OUTPUT_HANDLE),
          (PCHAR_INFO) buffer, (COORD) {80, 25}, (COORD) {0, 0}, &r);
     
        lstrcpy (str, "");
        for (i = n = 0; i <= bottom - top; i++)
        for (j = 0; j <= right - left; j++)
        {
            str[n] = buffer[i][j].Char.AsciiChar;
            n++;
        }
        str[n] = 0;
        return 1;
    }
     
     
    void
    gotoxy(int x, int y)
    {
      COORD c;
     
      c.X = x - 1;
      c.Y = y - 1;
      SetConsoleCursorPosition (GetStdHandle(STD_OUTPUT_HANDLE), c);
    }
     
     
    void
    puttext (int left, int top, int right, int bottom, char *str)
    { 
        int i, j, n;
        SMALL_RECT r;
        CHAR_INFO buffer[25][80];
     
        memset (buffer, 0, sizeof (buffer));
        r = (SMALL_RECT) {left - 1, top - 1, right - 1, bottom - 1};
     
        for (i = n = 0; i <= bottom - top; i++)
        for (j = 0; j <= right - left && str[n] != 0; j++)
        {
            buffer[i][j].Char.AsciiChar = str[n];
            buffer[i][j].Attributes = FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED;
            n++;
        }
     
        WriteConsoleOutput (GetStdHandle (STD_OUTPUT_HANDLE),
          (CHAR_INFO *) buffer, (COORD) {80, 25},
          (COORD) {0, 0}, &r);
    }
     
     
    void
    _setcursortype (int type)
    {
        CONSOLE_CURSOR_INFO Info;
     
        Info.dwSize = type;
        SetConsoleCursorInfo (GetStdHandle (STD_OUTPUT_HANDLE),
          &Info);
    }
     
     
    void
    textattr (int _attr)
    {
        SetConsoleTextAttribute (GetStdHandle(STD_OUTPUT_HANDLE), _attr);
    }
     
     
    void
    textbackground (int color)
    {
        __BACKGROUND = color;
        SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE),
          __FOREGROUND + (color << 4));
    }
     
     
    void
    textcolor (int color)
    {
        __FOREGROUND = color;
        SetConsoleTextAttribute (GetStdHandle (STD_OUTPUT_HANDLE),
          color + (__BACKGROUND << 4));
    }
     
     
    int
    wherex ()
    {
        CONSOLE_SCREEN_BUFFER_INFO info;
     
        GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &info);
        return info.dwCursorPosition.X + 1;
    }
     
     
    int
    wherey ()
    {
        CONSOLE_SCREEN_BUFFER_INFO info;
     
        GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &info);
        return info.dwCursorPosition.Y + 1;
    }
     
     
    #ifdef __cplusplus
    }
    #endif
     
    #endif /* _CONIO_C_ */

  5. #5
    Candidat au Club
    Inscrit en
    Novembre 2004
    Messages
    4
    Détails du profil
    Informations forums :
    Inscription : Novembre 2004
    Messages : 4
    Points : 2
    Points
    2
    Par défaut
    J'ai créer le fichier conio.c à l'aide de votre code, mais cela ne fonctionne toujours pas.

    Voila les erreurs qu'il me met :

    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
    Compilateur: Default compiler
    Building Makefile: "D:\LangageC\Makefile.win"
    Exécution de  make...
    make.exe -f "D:\LangageC\Makefile.win" all
    gcc.exe -c main.c -o main.o -I"C:/Dev-Cpp/include"  -I"C:/Dev-Cpp/include"   
     
    In file included from main.c:3:
    C:/Dev-Cpp/include/conio.c:25: error: `BLACK' undeclared here (not in a function)
    C:/Dev-Cpp/include/conio.c:26: error: `LIGHTGRAY' undeclared here (not in a function)
     
    C:/Dev-Cpp/include/conio.c:107: warning: type mismatch with previous implicit declaration
    C:/Dev-Cpp/include/conio.c:76: warning: previous implicit declaration of `gotoxy'
    C:/Dev-Cpp/include/conio.c:107: warning: `gotoxy' was previously implicitly declared to return `int'
     
    In file included from main.c:3:
    C:/Dev-Cpp/include/conio.c:200:23: warning: no newline at end of file
     
    make.exe: *** [main.o] Error 1
     
    Exécution terminée
    et

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
     
    3 D:\LangageC\main.c In file included from main.c 
    25 C:\Dev-Cpp\include\conio.c `BLACK' undeclared here (not in a function) 
    26 C:\Dev-Cpp\include\conio.c `LIGHTGRAY' undeclared here (not in a function) 
    107 C:\Dev-Cpp\include\conio.c [Warning] type mismatch with previous implicit declaration 
    76 C:\Dev-Cpp\include\conio.c [Warning] previous implicit declaration of `gotoxy' 
    107 C:\Dev-Cpp\include\conio.c [Warning] `gotoxy' was previously implicitly declared to return `int' 
    3 D:\LangageC\main.c In file included from main.c 
    23 C:\Dev-Cpp\include\conio.c:200 [Warning] no newline at end of file 
     D:\LangageC\Makefile.win [Build Error]  [main.o] Error 1
    Merci encore pour votre aide.

  6. #6
    Candidat au Club
    Inscrit en
    Novembre 2004
    Messages
    4
    Détails du profil
    Informations forums :
    Inscription : Novembre 2004
    Messages : 4
    Points : 2
    Points
    2
    Par défaut
    Ca y est j'ai enfin réussi a le faire fonctionner

    J'ai ajouter des guillemets a BLACK et LIGHTGRAY dans le conio.c

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
     
    #ifdef __cplusplus 
    extern "C" { 
    #endif 
     
    static int __BACKGROUND = 'BLACK'; 
    static int __FOREGROUND = 'LIGHTGRAY';
    Et maintenant ca fonctionne

    Merci a ceux qui m'ont aider a trouver la solution.

  7. #7
    Expert éminent sénior
    Avatar de Emmanuel Delahaye
    Profil pro
    Retraité
    Inscrit en
    Décembre 2003
    Messages
    14 512
    Détails du profil
    Informations personnelles :
    Âge : 67
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Retraité

    Informations forums :
    Inscription : Décembre 2003
    Messages : 14 512
    Points : 20 985
    Points
    20 985
    Par défaut
    Citation Envoyé par P4Pi
    Ca y est j'ai enfin réussi a le faire fonctionner
    J'ai ajouter des guillemets a BLACK et LIGHTGRAY dans le conio.c
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
     
    #ifdef __cplusplus 
    extern "C" { 
    #endif 
     
    static int __BACKGROUND = 'BLACK'; 
    static int __FOREGROUND = 'LIGHTGRAY';
    Et maintenant ca fonctionne

    Merci a ceux qui m'ont aider a trouver la solution.
    Cette solution est très bizarre et pas du tout standard...

    Le package conio est disponible en téléchargement par Dev-C++.

    aide / A propos / Nouvelles versions ...
    Pas de Wi-Fi à la maison : CPL

  8. #8
    Futur Membre du Club
    Femme Profil pro
    Étudiant
    Inscrit en
    Janvier 2010
    Messages
    2
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : Algérie

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Janvier 2010
    Messages : 2
    Points : 6
    Points
    6
    Par défaut gotoxy
    bonsoir tout le monde
    moi aussi j'ai le meme probleme j'arrive pas à utilise cette fonction sur le dev c++ j'ai ma procedure en pascal mais j'arrive pas à la traduire en c++ il me faut la librairie pour cette fonction ??

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Problème de compilation avec Dev-Cpp
    Par Psyricien dans le forum C
    Réponses: 2
    Dernier message: 23/10/2008, 15h36
  2. problèmes de compilation avec DEV-CPP
    Par Ben777 dans le forum OpenGL
    Réponses: 8
    Dernier message: 06/04/2007, 13h49
  3. [débutant] problème avec l'affichage des lettres sou dev-C++
    Par Antigonos Ier Gonatas dans le forum Dev-C++
    Réponses: 9
    Dernier message: 02/04/2006, 22h22
  4. [débutant] problème avec un "if"
    Par pingoui dans le forum Langage
    Réponses: 10
    Dernier message: 11/08/2004, 09h46
  5. [débutant] Problèmes avec CRegKey
    Par Pedro dans le forum MFC
    Réponses: 4
    Dernier message: 10/11/2003, 15h28

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