Ellipse() and Rectangle() functions linker error undefiend reference to Rectangle@20

Apr 23, 2011 at 6:11pm
Hi guys Im having a problem with Painting a rectangle on a window.
the following gives me 2 linker errors from the Rectangle and Ellipse functions.


1
2
3
4
5
6
7
8
9

case WM_PAINT:
               hdc = BeginPaint(hwnd, &ps);
               Rectangle(hdc, 0, 0, 200, 100);
               //Line(hdc, 0, 0, 200, 100);
               Ellipse(hdc, 0, 0, 200, 100);
               EndPaint(hwnd, &ps);
               return 0;


[linker error] undefined reference to 'Rectangle@20'
[Linker error] undefined reference to 'Ellipse@20'

in Dev-c++
Please help
Apr 23, 2011 at 6:41pm
Are you linking with the correct libraries - in particular Gdi32.lib ?
Apr 23, 2011 at 7:02pm
i dont know the files at the top are

1
2
3
4
5
6
7
8
9
//#define _WIN32_WINNT 0x0500
#include <windows.h>
#include <iostream>
#include <cstdlib>
#include <math.h>
//#include <cmath.h>
//#include <math>
#include <cmath>
using namespace std;


whats Gdi32.lib and how do i link it?
Thank you for responding
Apr 23, 2011 at 9:56pm
What IDE are you using??
Apr 24, 2011 at 8:25am
He is using dev-c++, according to first post.

Add gdi32.a as linker input.
Apr 24, 2011 at 8:29am
I need specs :-)
Topic archived. No new replies allowed.