News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

using Icon's with FLTK

Started by Sepple19, June 09, 2009, 10:06:05 PM

Previous topic - Next topic

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.
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: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

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.