FLTK with CodeLite

General questions regarding the usage of CodeLite
Hacker John
CodeLite Enthusiast
Posts: 19
Joined: Tue Aug 16, 2011 11:31 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: FLTK with CodeLite

Post by Hacker John »

Hi eranif, I'm a new user. I installed Codelite when my little Quincy IDE would not work in W7 any longer. I've heard many good things about Codelite so I thought I'd give it a whizz.

I'm trying to get an FLTK project going so I've followed this thread. When I build, I get a message that your sample project has built successfully but no GUI appears when I run it. There is no executable in the project folder either. I must be missing something out so I just want to check it.

I've run the fltk-config command for both the compiler and linker options getting

Code: Select all

-I. -I./png -I./zlib -I./jpeg -mwindows -DWIN32 -DUSE_OPENGL32 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
and

Code: Select all

-L./lib -mwindows -lfltk -lole32 -luuid -lcomctl32
respectively.

Do i need to separate the items with semicolons or is pasting these just as they are in the relevent boxes OK? The code completion works fine so Codelite is definitely finding the FLTK libraries.
User avatar
eranif
CodeLite Plugin
Posts: 6372
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: FLTK with CodeLite

Post by eranif »

There are 2 ways of configuring it:
1) the hard way
2) the easy way

1) Tell codelite to use the fltk-config
To set the compile flags:
project settings | compiler | options:

Code: Select all

$(shell fltk-config --cflags)
To set the link flags:
project settings | linker | options:

Code: Select all

$(shell fltk-config --libs)
2) The hard way, you break the output of fltk-config and set it manually in the various boxes
To set include paths, open the project settings | Compiler:
add each include path separated by semi-colons

so this:

Code: Select all

-I. -I./png -I./zlib -I./jpeg
becomes this:

Code: Select all

.;./png;./zlib;./jpeg
Note that there is no need to prepend the '-I'

add each macro the same way (no need for the -D):
so this:

Code: Select all

 -DWIN32 -DUSE_OPENGL32 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
becomes this:

Code: Select all

 WIN32;USE_OPENGL32;_LARGEFILE_SOURCE;_LARGEFILE64_SOURCE
add each library search path from: project settings | linker | library paths:
so this:

Code: Select all

-L./lib
becomes

Code: Select all

./lib
add each library to: project settings | linker | Libraries:
so this:

Code: Select all

-lfltk -lole32 -luuid -lcomctl32
becomes

Code: Select all

fltk;ole32;uuid;comctl32
Special linker options (line -mwindows) goes to:
project settings | linker | options:
each option is set it in its full form, so just copy it:

Code: Select all

-mwindows
Eran
Make sure you have read the HOW TO POST thread
Hacker John
CodeLite Enthusiast
Posts: 19
Joined: Tue Aug 16, 2011 11:31 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: FLTK with CodeLite

Post by Hacker John »

Hi eran. Many thanks for a very detailed reply. I followed your suggestions but I still don't get a build. I also tried it with these fully pathed

C++ Compiler Options

Code: Select all

c:/fltk-1.3.0;c:/fltk-1.3.0/png;c:/fltk-1.3.0/zlib;c:/fltk-1.3.0/jpeg
and in the Compiler include paths field:
c:/fltk-1.3.0
Linker Library Paths:

Code: Select all

c:/fltk-1.3.0/lib
If I simply compile the main.cpp file, I get this in the build pane:

Code: Select all

----------Build Started--------
C:\Windows\system32\cmd.exe /c ""mingw32-make.exe"  -j 2 -f "Hello.mk"  ./Debug/main.o"
----------Building project:[ Hello - Debug ] (Single File Build)----------
mingw32-make.exe: `Debug/main.o' is up to date.
----------Build Ended----------
0 errors, 0 warnings
If I build, I get

Code: Select all

----------Build Started--------
C:\Windows\system32\cmd.exe /c ""mingw32-make.exe"  -j 2 -f "Hello_wsp.mk""
zsh: bad pattern: project:[
mingw32-make.exe: *** [All] Error 1
----------Build Ended----------
0 errors, 0 warnings
And no exe file. There is a Debug subfolder in my project folder containing main.o and main.o.d. Perhaps the problem is in the linker settings?
User avatar
eranif
CodeLite Plugin
Posts: 6372
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: FLTK with CodeLite

Post by eranif »

----------Build Started--------
C:\Windows\system32\cmd.exe /c ""mingw32-make.exe" -j 2 -f "Hello.mk" ./Debug/main.o"
----------Building project:[ Hello - Debug ] (Single File Build)----------
mingw32-make.exe: `Debug/main.o' is up to date.
----------Build Ended----------
0 errors, 0 warnings
I am not sure how you build you project, but I see from the log that you are only compiling the source file main.cpp.
You also need to link, so just hit F7 it will build (compile + link) your project - this should generate an executable or at least take you the link stage
Hacker John wrote:----------Build Started--------
C:\Windows\system32\cmd.exe /c ""mingw32-make.exe"  -j 2 -f "Hello_wsp.mk""
zsh: bad pattern: project:[
mingw32-make.exe: *** [All] Error 1
----------Build Ended----------
0 errors, 0 warnings
Why does zsh is trying to parse this? My guess is that the mingw32-make that is being invoked is the one that comes with MSYS or Cygwin - try remove it from your PATH (I always recommend to use the MinGW that comes with codelite)

Eran
Make sure you have read the HOW TO POST thread
Hacker John
CodeLite Enthusiast
Posts: 19
Joined: Tue Aug 16, 2011 11:31 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: FLTK with CodeLite

Post by Hacker John »

Why does zsh is trying to parse this? My guess is that the mingw32-make that is being invoked is the one that comes with MSYS or Cygwin - try remove it from your PATH (I always recommend to use the MinGW that comes with codelite)
I've removed cygwin and taken it out of PATH, which leaves MSYS. There is a "sh.exe" in MSYS so it is probably going to that. I've taken MSYS out of the PATH but the build result is the same. This could well be down to some setting that I have to do between MSYS and Mingw.

Edit: It's doing the same with a wxWidgets project. Looks like I have a problem with sh.

Edit 2: This gets funnier - I think the offending sh.exe is in the Hugin folder - the icon is the same one as was popping up. I've taken Hugin\bin out of the PATH but still no good. I've got open source software all over this computer so stamping this out is going to be fun. :D
Hacker John
CodeLite Enthusiast
Posts: 19
Joined: Tue Aug 16, 2011 11:31 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: FLTK with CodeLite

Post by Hacker John »

Taking Hugin out of the PATH seems to have worked to a degree. I still don't get a build but the message no longer includes the sh error.

Code: Select all

----------Build Started--------
C:\Windows\system32\cmd.exe /c ""C:/MinGW-4.4.1/bin/mingw32-make.exe"  -j 2 -f "Hello_wsp.mk""
mingw32-make.exe: *** [All] Error 1
----------Build Ended----------
0 errors, 0 warnings
I found the following in the Trace pane. I don't know if the errors mentioned have any bearing on this problem:

08:23:25: Loaded debugger: GNU gdb debugger, Version: v2.0
08:23:25: Loaded plugin: Abbreviation plugin
08:23:25: Loaded plugin: Source Code Formatter (AStyle)
08:23:25: Loaded plugin: Continuous build plugin which compiles files on save and report errors
08:23:25: Loaded plugin: Copyright Plugin - a small plugin that allows you to place copyright block on top of your source files
08:23:25: Loaded plugin: CppCheck integration for CodeLite IDE
08:23:25: Loaded plugin: CScope Integration for CodeLite
08:23:25: Loaded plugin: A plugin that allows user to launch external tools from within CodeLite
08:23:25: Loaded plugin: GIT plugin
08:23:25: Loaded plugin: Wizards Plugin - a collection of useful utils for C++
08:23:25: Loaded plugin: Qt's QMake integration with CodeLite
08:23:25: Loaded plugin: Snippet wizard
08:23:25: Error: Execution of command 'svn --config-dir "C:\Users\john\AppData\Roaming\CodeLite\subversion" --help ' failed (error 2: the system cannot find the file specified.)
08:23:25: Error: can't open file 'C:\Users\john\AppData\Roaming\CodeLite\subversion\config' (error 3: the system cannot find the path specified.)
08:23:25: Loaded plugin: Subversion plugin for codelite2.0 based on the svn command line tool
08:23:25: Loaded plugin: A Unit test plugin based on the UnitTest++ framework
08:23:25: Loaded plugin: wxFormBuilder integration with CodeLite
08:23:26: Install path: C:\CodeLite
08:23:26: Startup Path: C:\CodeLite
08:23:28: Loading accelerators from 'C:\CodeLite\config\accelerators.conf.default'
08:23:28: Loading accelerators from 'C:\CodeLite\plugins\resources\abbreviation.accelerators'
08:23:28: Loading accelerators from 'C:\CodeLite\plugins\resources\cscope.accelerators'
08:23:28: Loading accelerators from 'C:\CodeLite\plugins\resources\external_tools.accelerators'
08:23:28: Loading accelerators from 'C:\CodeLite/config/accelerators.conf.default'
08:23:28: Loading accelerators from 'C:\CodeLite\plugins\resources\abbreviation.accelerators'
08:23:28: Loading accelerators from 'C:\CodeLite\plugins\resources\cscope.accelerators'
08:23:28: Loading accelerators from 'C:\CodeLite\plugins\resources\external_tools.accelerators'
08:23:28: Info: CodeLite is up-to-date (or newer), version used: 4778, version on site:4778
08:23:28: Symbols file loaded into OS file system cache (0 seconds)
08:23:37: Error: Can not wait for thread termination (error 6: the handle is invalid.)
08:23:37: Error: Couldn't terminate thread (error 6: the handle is invalid.)
User avatar
eranif
CodeLite Plugin
Posts: 6372
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: FLTK with CodeLite

Post by eranif »

Hacker John wrote:08:23:37: Error: Couldn't terminate thread (error 6: the handle is invalid.)
This error is not relevant, you can ignore it
Hacker John wrote:C:\Windows\system32\cmd.exe /c ""C:/MinGW-4.4.1/bin/mingw32-make.exe"  -j 2 -f "Hello_wsp.mk""
mingw32-make.exe: *** [All] Error 1
I am not sure that settings mingw32-make with full path will fix the problem (you still need to the rest of the toolchain)

Instead of removing everything from your path do this:
from 'settings | environment variables'

And add this:
PATH=C:\MinGW-4.4.1\bin;$(PATH)

This will make sure that MinGW 4.4.1 is placed first in the search path (but only for the codelite's session)

Eran
Make sure you have read the HOW TO POST thread
Hacker John
CodeLite Enthusiast
Posts: 19
Joined: Tue Aug 16, 2011 11:31 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: FLTK with CodeLite

Post by Hacker John »

Thanks eran. I set the path to C:/MinGW-4.4.1/bin/mingw32-make.exe in the build tool field of Settings->Build Settings->Build Systems. Should I reset this to the default value (just "mingw32-make.exe" if I remember correctly)?
User avatar
eranif
CodeLite Plugin
Posts: 6372
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: FLTK with CodeLite

Post by eranif »

Hacker John wrote:I set the path to C:/MinGW-4.4.1/bin/mingw32-make.exe in the build tool field of Settings->Build Settings->Build Systems. Should I reset this to the default value (just "mingw32-make.exe" if I remember correctly)?
I figured that from reading the build log.
The important thing is to set the PATH variable as I asked you too in the previous post.

If you set the PATH as mentioned above, it does not matter if you change it back to mingw32-make or leave it as is.

Eran
Make sure you have read the HOW TO POST thread
Hacker John
CodeLite Enthusiast
Posts: 19
Joined: Tue Aug 16, 2011 11:31 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: FLTK with CodeLite

Post by Hacker John »

I decided that I have messed about with the settings too much so I uninstalled Codelite then re-installed to set all values back to their default. I followed the tutorial video to create a simple "Hello world" project and I still can't get a build. I've tried adding the path as you described above and I still get:

Code: Select all

----------Build Started--------
C:\Windows\system32\cmd.exe /c ""mingw32-make.exe"  -j 2 -f "CLtest_wsp.mk""
mingw32-make.exe: *** [All] Error 1
----------Build Ended----------
0 errors, 0 warnings
Post Reply