Archive

Posts Tagged ‘mingw’

Use CImg on MinGw

April 6th, 2009 No comments

Use CImg on MinGw

Needs MinGW
Downlaod CImg
This example code is taken from: Fatchoco Blog

test.cpp:

#include "CImg.h"
 
using namespace cimg_library;
 
int main(int argc, char *argv[]) {
    CImg<unsigned char> img(640,400,1,3);            // Define a 640x400 color image with 8 bits per color component.
    img.fill(0);                                       // Set pixel values to 0 (color : black)
    unsigned char purple[] = { 255,0,255 };         // Define a purple color
    img.draw_text(100,100,"Hello World",purple,0,1,35); // Draw a purple "Hello world" at coordinates (100,100).
    img.display("My first CImg code");               // Display the image in a display window.
    return 0;
}

Put CImg.h in the same dir as test.cpp and compile:

g++  test.cpp  -c  -o  test.o
g++  test.o  -lgdi32  -o  test.exe

Categories: develop, windows Tags: , ,

Switch to our mobile site