Author Topic: Template for FLTK application  (Read 9955 times)

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Template for FLTK application
« on: October 28, 2005, 08:58:33 am »
Dear community,

I've submitted a patch to sourceforge that includes templates for a FLTK (GUI) application. I've used "-mwindows" as compiler option in the template which might be not correct (I read that -mwindows is deprecated). However: On several tutorials in the internet the "-mwindows" is common. So I actually don't know whether it's right or wrong, but it works, certainly.

Morten.
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

Offline Urxae

  • Regular
  • ***
  • Posts: 376
Re: Template for FLTK application
« Reply #1 on: October 28, 2005, 09:16:37 am »
Remove -mwindows from every target you've added it to and then go to Project -> Properties -> Targets and set the top dropdown box to "GUI application" for those targets (It should only have been set for executables, right?).
This should pass the correct flags (if any) to any supported compiler/platform combination, not just MinGW on Windows.
« Last Edit: October 28, 2005, 09:18:49 am by Urxae »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Template for FLTK application
« Reply #2 on: October 28, 2005, 10:48:14 am »
Remove -mwindows from every target
So this flag should be removed from the template before using.

go to Project -> Properties -> Targets and set the top dropdown box to "GUI application"
This is already done by the template.

...I am going to update the template files on SourceForge.net accordingly in a minute or two...

Morten.
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

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Template for FLTK application
« Reply #3 on: October 28, 2005, 11:01:13 am »
I read that -mwindows is deprecated
I have read that too, a day or two ago, and honestly, I would like to know how this  statement justifies.
(Let's put aside the fact that you really should just set the combobox to GUI application)

MinGW accepts the parameter without giving a warning, neither does gcc 4.0 complain. Both the MinGW and the cygwin web sites explicitely state that either -mwindows or -Wl,--subsystem,windows can be used, the gcc 3.4.4 manual says nothing.

The only other reference actually saying that -mwindows is really deprecated is  some guy's post on some Allegro-associated forum "I believe that is deprecated".
How is that authorative?
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Template for FLTK application
« Reply #4 on: October 28, 2005, 12:49:06 pm »
The only other reference actually saying that -mwindows is really deprecated is  some guy's post on some Allegro-associated forum "I believe that is deprecated".
How is that authorative?
That's actually what I wanted to be clarified. I really don't know what's right - an application compiles with and without this parameter. But I thought switching to a "GUI" project takes care of the options in the right ways and that's why "-mwindows" can be removed. I would really like to be sure on this.

I tried a simple "Hello world" application with MinGW: The compiled applications are the same whether with or without "-mwindows". A thought that came into my mind was: Is it maybe a Cygwin specific parameter to get rid of cygwin.dll depenencies and create a Windows "native" application? But what's "-mno-cygwin" than? The same?

Anyone out there that really KNOWS it?

Morten.
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

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Template for FLTK application
« Reply #5 on: October 28, 2005, 02:01:22 pm »
If you switch to "GUI application", the IDE will use whatever compiler option is correct for the compiler you have chosen, and this will be updated for future releases, too. So this is the correct way to do it. It will work with every compiler that is supported. Always. (Well, unless there's a bug.)

About the "-mwindows is deprecated" story, let's suppose I post "I think the -O2 and -O3 switches are deprecated" on this forum. Will people  stop using it them because of this? :lol:

I mean seriously, there is no statement regarding that deprecation on either the gcc, the MinGW, or the cygwin site (at least neither Google nor a hand search found it). I would say that if anyone is an authority on that matter, it is those three, and certainly they would make such information public? The only quote I could find that really said -mwindows was deprecated was some random person on an Allegro forum, and he was not even certain about it!
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Template for FLTK application
« Reply #6 on: October 28, 2005, 02:28:29 pm »
About the "-mwindows is deprecated" story, let's suppose I post "I think the -O2 and -O3 switches are deprecated" on this forum. Will people  stop using it them because of this? :lol:
Knowing that you are a "Code::Blocks - guru"... yes. :lol: :lol: :lol:

But honestly: Thanks for clarification. A question is left: You said that using "GUI" takes care of the settings: Does that mean that removing the "-mwindows" switch from the (any) template is right?

With regards,

Morten.
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

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Template for FLTK application
« Reply #7 on: October 28, 2005, 02:54:52 pm »
Yes :)
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Angelo

  • Guest
Re: Template for FLTK application
« Reply #8 on: October 29, 2005, 02:53:39 pm »
I don't know it's my fault, but i have thoose errors:

http://img461.imageshack.us/img461/2017/err1nx.jpg

(C::B RC2, WinXPSP2, fltk source folder c:\fltk-1.1.6)

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Template for FLTK application
« Reply #9 on: October 29, 2005, 03:45:28 pm »
I don't know it's my fault, but i have thoose errors: [...]

To get the FLTK application compiling and running you need to have installed the FLTK libraries and header files. You might want to use the DevPack plugin of Code::Blocks to download and install the FLTK (1.1.6) DevPack - there use the "community server" and look in the GUI category.

Once this is installed you need to setup the custom project variable (FLTK_DIR) to point to that directory. Sub-folders of this directory should be "include" and "lib". Then the compiler/linker directories point to the files required and compiling will work.

Morten.
« Last Edit: October 29, 2005, 03:48:12 pm by MortenMacFly »
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

Angelo

  • Guest
Re: Template for FLTK application
« Reply #10 on: October 29, 2005, 06:45:10 pm »
EDIT: Thank's, now everything's fine.
« Last Edit: October 29, 2005, 11:10:35 pm by Angelo »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Template for FLTK application
« Reply #11 on: October 29, 2005, 07:08:42 pm »
So i should download this file:
http://fltk.org/software.php?VERSION=1.1.x-r4608&FILE=fltk/1.1.6/fltk-1.1.6-source.tar.bz2
This is the source code of FLTK which has to be compiled first to a library to use for developing FLTK applications. This requires additional knowledge and is not necessarily required. Please see my previous post on how to obtain an already compiled version compatible with Code::Blocks.

Morten.
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