Author Topic: using Icon's with FLTK  (Read 4553 times)

Sepple19

  • Guest
using Icon's with FLTK
« on: June 09, 2009, 10:06:05 pm »
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

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: using Icon's with FLTK
« Reply #1 on: June 10, 2009, 06:55:01 am »
I think i have to change some setting in Codeblocks to include the resource file.
Just add the RC file to your project. Notice that you'll need a project as you have more than one source file.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Sepple19

  • Guest
Re: using Icon's with FLTK
« Reply #2 on: June 10, 2009, 10:10:25 am »
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.