User forums > Using Code::Blocks

using Icon's with FLTK

(1/1)

Sepple19:
Hello,
i want to implement an application icon with CodeBlocks:Mingw and the fltk toolkit. I compile the following code:

icontest.c
----------
#include <FL/Fl.H>
#include <FL/x.H>
#include <FL/Fl_Window.H>
#include "icontest.h"

int main(int argc, char **argv) {

  Fl_Window mainWin(400, 300, "Icontest");
  mainWin.icon((char *)LoadIcon(fl_display, "test"));
  mainWin.show(argc, argv);
  return Fl::run();
}
icontest.h
---------
#define test 1

icontest.rc
----------
test   ICON    DISCARDABLE     "test.ico"

I can compile the project and the icon in the explorer seems to be okay. But there is no item im the title of the window.

If i compile it in the cmd.exe mit this makefile, everything is okay.

all: icontest.exe

.cpp.o:
   g++ -c -Wall -I/usr/local/include $<

icontest_res.o: icontest.rc
   windres -o $@ $<

icontest.exe: icontest.o icontest_res.o
   g++ -o $@ icontest.o icontest_res.o -L/usr/local/lib -lfltk \
     -mwindows -lgdi32 -lcomctl32 -luuid -lwsock32 -lole32

I think i have to change some setting in Codeblocks to include the resource file.

Perhaps anybody can help me...

thx

MortenMacFly:

--- Quote from: Sepple19 on June 09, 2009, 10:06:05 pm ---I think i have to change some setting in Codeblocks to include the resource file.

--- End quote ---
Just add the RC file to your project. Notice that you'll need a project as you have more than one source file.

Sepple19:
Thanks for your reply.
I have already build a project and include the header, source and resource file. After compilation, the explorer icon was changed but
the icon in the title bar was unchanged. I have no idea what's wrong.

I try to include the .o File which i create with windres but i don't know where i can include it.


Navigation

[0] Message Index

Go to full version