undefined reference to gotoxy in C

The problem you’re facing isn’t related to Code::Blocks, it’s related to the compiler it’s using (MinGW by default), and it’s because that function isn’t standard and wasn’t implemented in that compiler. I’m not sure if Borland still provides conio.h, but you could try this one for MinGW.

Have a look at this http://projectsofashok.blogspot.in/2010/05/gotoxy-in-codeblocks.html

You can also try the below snippet, this will work in GCC

#include<stdio.h>
//gotoxy function
void gotoxy(int x,int y)
{
printf("%c[%d;%df",0x1B,y,x);
}
main ()
{
gotoxy(25,50); //reposition cursor
printf("hello world"); //display text
}

You can also have a look at NCURSES.

Leave a Comment

tech