0

I have a problems with the 'readimagefile' function in DEV C ++.

It replies undefined reference to readimagefile in compiling. I use graphics.h library and TDM-GCC 4.9.2 32-bit Realise, all compiler parameters and linkers are fine, also the initwindow function works but the compiler error persists.

This is my code, which is just a try to test some instructions:

#include<iostream>
#include<cstdlib>
#include<graphics.h>

using namespace std;    

int main(){
    DWORD screenWidth=GetSystemMetrics(SM_CXSCREEN);
    DWORD screenHeight=GetSystemMetrics(SM_CYSCREEN);   
        
    initwindow(screenWidth, screenHeight);  
    setbkcolor(1);                                          
    cleardevice();                                              
    setcolor(14);                     

    ellipse(400,150,0,180,190,100); 

    readimagefile("Ponte.jpg",0,0,800,600);

    while(!kbhit());
    getch();
    closegraph();
return 0;
}   
genpfault
  • 51,148
  • 11
  • 85
  • 139
  • 2
    A couple of important things to note: First is that Dev-C++ is old and outdated and unmaintained and comes with an almost ancient compiler. GCC is about to release version 12 soon, and C++ have changed quite a lot since version 4.9.2 was released. Second is that the `graphics.h` header and its library is an old leftover from the DOS days of the 1980's and 1990's, it's totally unsuitable to learn anything useful for modern environments. – Some programmer dude May 05 '22 at 10:10
  • 1
    And what you get is a *linker* error, not a compiler error. Building C++ applications is done in several steps: 1) Edit source file; 2) Compile source file into object file; 3) Link object files and libraries into the executable program file. The problem you have is in step 3. As for the actual error, you get that because as mentioned the library you try to use is old, outdated, unmaintained and seems to be incomplete since it's missing a feature that wasn't in the original library. – Some programmer dude May 05 '22 at 10:14
  • @user19041281, It seems that you are trying to use WinBGIm, have you gone through every step of [the installation guide](https://home.cs.colorado.edu/~main/bgi/dev-c++/), especially the part about required linker commands. – Jeaninez - MSFT May 06 '22 at 02:38

0 Answers0