I need help concerning <curses.h> and <conio.h> libraries issues. There's a conflit between both libraries when I compile my software in Dev-C++ (XP OS).

1. In <curses.h> there's this code line:

2. In <conio.h> there's this code line:
typedef enum

3. When I compile my software there are the following errors messages:

curses.h --> 'int COLORS' redeclared as diferent kind of symbol
conio.h --> previous declaration of 'typedef enum COLORS COLORS'
curses.h --> declaration of 'int COLORS'
conio.h --> conflicts with previous declaration 'typedef enum COLORS COLORS'

Please, how can I solve this conflit? Any good idea?

Thankx in advance.


If you're using conio.h, you have no need for curses, and vice-versa.

Decide which library you like (conio.h) <cough, cough>, and forget the other. ;)

Thankx Adak.

It didn't solve completly my problem. Now, there's a problem in a 3rd library (<dos.h>) when I compile my software (I've try to remove the <curses.h> and the <conio.h> one at a time).

Here's the code:

// example program for the PSC232

#include <dos.h>
#include <stdio.h>
#include <conio.h>
//#include <curses.h>
#include <string.h>
#include <stdlib.h>
#define  DTARDY  0x01 
#define FALSE      0//0r
#define CR         0x0d
#define LF         0x0a
#define TRUE       !FALSE
#define RS232      0x14
#define COM1       0x3f8
#define LSR        5
#define THR        0
#define THRRDY     0X20

int stop=0,c;

int xmit(int)
   char ch;

   register int cnt;
   cnt = 0;
   while(!(inportb(COM1+LSR) & THRRDY) && cnt < 10000) cnt++;
   if (cnt>=10000)

// ********************** init *********************************
void setup()
    union REGS regs;
    regs.h.ah = 0;              // ah = init
    regs.x.dx = 0;              // dx = comport#1=0 #2=1 #3=2 #4=3
    regs.h.al = 0xe7;           // 9600bd, 8bit, no par, 1 stop (c3=4800)
    int86(RS232, &regs, &regs); // call bios int14

// ******************** transmit ************************************
void send(char *source)        // scan ascii line
   char dest[]=" ";
   int len,i;
   for (i=0; i<len; i++)
   {  strncpy(dest, source, 1);
     xmit(*dest);              //

// ********************* character to screen ********************************
int put_ch(int)
    int c;
    union REGS regs;
    regs.h.ah = 2;              // 2 = char out
    regs.h.dl = c;

int putscrn(int)
   char c; 
    char d=c;
    if(c>=' '|| c==CR || c==LF ) put_ch(c);
// ********************** receive *************************************
int chrdy()
    return(inportb(COM1+LSR) & DTARDY);
int rch()
    return(inportb(COM1) & 0x7f);

void receive()
{char d;
    putscrn (d);}
while (d!=4);    // the last character = EOT

// ************************* main *******************************************
int main()
{ int c;
  char d;
  printf(" Example program for PSC232 \n");


goto loop;

Those are the errors messages when I compile the software (XP OS and Dev-C++):

[Linker error]undefined reference to 'inportb'
[Linker error]undefined reference to 'outportb'
[Linker error]undefined reference to 'int86'
[Linker error]undefined reference to 'intdos'
[Linker error]undefined reference to 'inportb'
[Linker error]undefined reference to 'inportb'
Id returned 1 exit status

Is there a solution for this? Many thankx in advance.


Edited 3 Years Ago by mike_2000_17: Fixed formatting

32-bit compilers such as Dev-C++ do not support any of the functions in dos.h. Those functions won't work on MS-Windows operating system since Win98 (10-20 years ago).

Edited 6 Years Ago by Ancient Dragon: n/a

dos.h functions work fine in WindowsXP and Windows2000 (both 32 bit), but the compiler has to support those functions. It appears that Dev-C++ does not do that.

Turbo C supports all the dos.h functions that I've tried, over the years. (I have Turbo C/C++, ver. 1.01). It's a free download at the legacy Borland download site - you may want to use it, instead of Dev-C++, to get those functions working. It has conio.h included, so you don't need to worry about using curses at all.

>>but the dos.h functions WORK in WindowsXP
Actually not. They work in a DOS emulation window, which emulates MS-DOS 6.X, not MS-Windows. You can not make dos.h work with any 32-bit compiler because they use priviledged instructions which the 32-or 64-bit operating systems will not allow.

conio.h is spported by many 32-bit compilers because there are no functions in it that directly attempt to call privileged instructions. I stepped into kbhit() function and it eventually calls win32 api console functions. I suspect the other functions do the same thing.

Edited 6 Years Ago by Ancient Dragon: n/a

This article has been dead for over six months. Start a new discussion instead.