0

I'm trying to build and run this code

#include<stdio.h>
#include<conio.h>

main()
{
textcolor(RED); 
cprintf("Hello, World!");

getch();
return 0;
}

I use code blocks - gcc compiler.As GCC doesn't support conio.h , i'm getting a lot of errors.I want to add a library which is needed for running this kind of programs. Being instructed by a blog I downloaded conio21 from this link: https://sourceforge.net/projects/conio/ but I can't find the libconio.a there.Can you please explain how to add the library?

Ramisa Anjum Aditi
  • 734
  • 1
  • 6
  • 11

2 Answers2

0

Functions like textcolor used to work in old compilers, you can't use them in new compilers like GNU GCC used by Code::Blocks.

To see how to change textcolor, this link might be able to help you:

How to change text color and console color in code::blocks?

Community
  • 1
  • 1
0

Download and extract conio library that you link in your question. Inside of it take conio.c and conio2.h to your project folder. Then include conio2.h to your source code:

#include<stdio.h>
#include"conio2.h"

main()
{
    textcolor(RED); 
    cprintf("Hello, World!");

    getch();
    return 0;
}

I tested, it works.