Page 1 of 5
FLTK with CodeLite
Posted: Mon Jan 04, 2010 1:57 pm
by Bozzck
Hi, i'm very new with c++ , i'm using codelite on windows system, i wanna use FLTK library which come as source zip file with codelite. Can somebody help me generating fltk with codelite, all the lib dll? probably a step by step instruction would be nice, since i'm very new with c++, thank you
Re: FLTK with CodeLite
Posted: Mon Jan 04, 2010 2:11 pm
by eranif
I would have helped, but I got no knowledge in FLTK, I suggtest that you might try and build it first from sources using the command line (There surely some instructions on how to do it on the FLTK site)
Once, you got this problem solved, we can help you here to setup codelite to create a FLTK project
Eran
Re: FLTK with CodeLite
Posted: Tue Jan 05, 2010 6:50 am
by Bozzck
Thanks Eran, i will try building FLTK from command line first
Re: FLTK with CodeLite
Posted: Tue Jan 05, 2010 9:36 am
by Bozzck
Hi eran,
i got fltk compile under msys, now what do i do?
Re: FLTK with CodeLite
Posted: Tue Jan 05, 2010 4:58 pm
by eranif
Hi,
First create a console project.
From the menu bar:
'Workspace -> Create New Project'
(Select the g++ compiler)
Next, you should have a workspace with a single project inside it.
Open the project settings by right clicking on the project, and select 'Settings...'
In the dialog that opens, select the 'Compiler' tab, and type the following in the 'Compiler Options' field:
Next, select the 'Linker' tab,. and type the following the 'Options' field:
Close the dialog (Click OK)
Paste the following code into your main.cpp file:
Code: Select all
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Button.H>
//--------------------------------------------
void but_cb( Fl_Widget* o, void* )
{
Fl_Button* b=(Fl_Button*)o;
b->label("Good job"); //redraw not necessary
b->resize(10,150,140,30); //redraw needed
b->redraw();
}
//--------------------------------------------
int main()
{
Fl_Window win( 300,200,"Testing" );
win.begin();
Fl_Button but( 10, 150, 70, 30, "Click me" );
win.end();
but.callback( but_cb );
win.show();
return Fl::run();
}
Hit F7 (to compile the file)
And you are done.
I tested it on Linux and it seems to work perfectly in my first try, however, I used Linux for this.
CodeCompletion for FLTK:
- By default, (on Linux) the include files are located under '/usr/include/Fl', so by adding the following paths to the code completion parser (from 'Settings -> Tags Settings -> Include Files'):
you are good to go.
I strongly suggest that you read some online tutorials, like this one:
http://www3.telus.net/public/robark/
Eran
Re: FLTK with CodeLite
Posted: Wed Jan 06, 2010 8:39 am
by Bozzck
hi eran,
sorry to bother again,
using shell fltk-config --cxxflags, in the compiler part and --ldflags on the linker part, basically it try to createprocess and it failed,
do you have any other suggestion about tweaking codelite? i try to compile and run under msys, the test program work great using fltk-config --compile testFLTK.cpp (msys command line)
thank before hand, i'm running codelite on windows
Re: FLTK with CodeLite
Posted: Wed Jan 06, 2010 9:20 am
by eranif
Bozzck wrote:using shell fltk-config --cxxflags, in the compiler part and --ldflags on the linker part, basically it try to createprocess and it failed,
so make sure that fltk-config is in your path (so codelite can find it)
To test the path settings:
open cmd.exe and try to run fltk-config from it,
NOT from msys shell
If it still fails, add the include path, library path and the library name to the project settings.
For example, assuming that your fltk include files are located under C:\fltk\include and the lib is under C:\fltk\lib
So, in your project settings, open the 'Linker tab' and in the 'Library Path' add:
, if you have more paths to add, add them with semicolon in between
In the 'Libraries' add:
Switch to the 'Compiler' tab in the 'Additional Search Path' add
(semicolon between paths)
Define any preprocessors (aka defines/macros) to the 'Preprocessor' field
To get the list of preprocessors type from the MSYS shell:
fltk-config --cxxflags
Eran
Eran
Re: FLTK with CodeLite
Posted: Wed Jan 06, 2010 10:55 am
by Bozzck
u know what eran, i might be new to using c++ but i know what a bourne shell is.... fltk-config is a script for a shell.... cmd.exe can't provide that....
it's impossible to run fltk-config inside cmd.exe, i can assure u that i set the environment variable in codelite to find fltk-config, so i dont think it's the case here.
thanks for your help anyway....
Re: FLTK with CodeLite
Posted: Wed Jan 06, 2010 10:59 am
by eranif
Bozzck wrote:fltk-config is a script for a shell
I did not meant to insult you. I was using my knowledge from wxWidgets (on Windows wx-config is an executable) - like I said in my first post, I never ran it from Windows, only from Linux.
So simply enter the output of the fltk-config to the project settings, so you wont need to run it
Eran
Re: FLTK with CodeLite
Posted: Thu Jan 07, 2010 11:48 am
by Bozzck
hey eranif,
i got it to work with codelite....
damn , i even have to learn how to read makefiles and all he heh eheh... but i got it to work...
at least u lead me to the right direction, thanks alot...
CK