-2

I am getting an error in Dev C++ with the function readimagefile. It says 'undefined reference to readimagefile' whenever I try to use the function included in the header file 'graphics.h'. Here is my code to show an image:

int main()
{
    initwindow(600,600,"Trial");
    readimagefile("alpha.jpg",0,0,500,500);
    getch();
    return 0;
}

It would be really helpful if someone could provide me with its correction or a substitute code to show an image. Also if I input this image, would I be able to use this as a background? If not then what is the best way to import an image as a background in C++.

I have seen many people asking for help about this and fair enough, these errors doesn't show up on other compilers like code blocks or visual studio but I have to use Dev C++ so please make sure that your code is applicable in Dev C++.

genpfault
  • 51,148
  • 11
  • 85
  • 139
Sanket Mathur
  • 44
  • 2
  • 7

1 Answers1

0

I try to use the function included in the header file 'graphics.h'

Assuming you posted whole file - you need to add #include "graphics.h" at the top of your cpp file if you want to use functions from it.

Also, it seems that you are trying to use WinBGIm - don't forget checking if you did every step from their installation guide - especially the part about needed linker commands:

-lbgi
-lgdi32
-lcomdlg32
-luuid
-loleaut32
-lole32
Marqin
  • 1,096
  • 8
  • 17
  • Well I haven't posted the whole program, I have included graphics.h and linked it properly. The initwindow() is working properly but not the readimagefile(). By the way, the only thing I have left is header-files. – Sanket Mathur Mar 11 '18 at 12:20