[Insight-users] Problems building the example from "Introduction to FLTK" by Luis Ibanez

Luis Ibanez luis . ibanez at kitware . com
Thu, 06 Nov 2003 16:10:08 -0500


Hi Lino,

This is basic C++,

You have a mismatch between the types used in the
definition of the SetOperandA() method and its
invocation.

 >: 'SetOperandA' : cannot convert parameter 1
 >   from 'int (double)' to 'float'

The definition of the types in your base class
do not match the ones in CalculatorGUI.

---

The other errors are due to missing include FLTK
headers.

--

Please send me the full set of files that
you are putting together for this basic demo.
It will be faster than solving error by error
in the users list.


Thanks


   Luis


------------------------
Lino Ramirez wrote:
> Hi Luis,
> 
> 
> 
> Thank you again. However, I still don't get it to work :-(
> 
> Now, I am getting 23 errors (see below). I am including the CMakeLists.txt
> and the CalculatorGUI.fld. Please, keep helping me to make it work.
> 
> 
> 
> Thank you so much for your help.
> 
> 
> 
> Lino
> 
> 
> 
> --------------------Configuration: TestCalculator - Win32
> Debug--------------------
> Compiling...
> CalculatorGUI.cxx
> C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.cxx(6) : error
> C2664: 'SetOperandA' : cannot convert parameter 1 from 'int (double)' to
> 'float'
>         Context does not allow for disambiguation of overloaded function
> C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.cxx(9) : error
> C2027: use of undefined type 'Fl_Group'
>         C:\FLTK\FL/Fl_Widget.H(33) : see declaration of 'Fl_Group'
> C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.cxx(9) : error
> C2227: left of '->user_data' must point to class/struct/union
> C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.cxx(9) : error
> C2227: left of '->cb_OperandAInputValue_i' must point to class/struct/union
> C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.cxx(13) :
> error C2664: 'SetOperandB' : cannot convert parameter 1 from 'int (double)'
> to 'float'
>         Context does not allow for disambiguation of overloaded function
> C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.cxx(16) :
> error C2027: use of undefined type 'Fl_Group'
>         C:\FLTK\FL/Fl_Widget.H(33) : see declaration of 'Fl_Group'
> C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.cxx(16) :
> error C2227: left of '->user_data' must point to class/struct/union
> C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.cxx(16) :
> error C2227: left of '->cb_OperandBInputValue_i' must point to
> class/struct/union
> C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.cxx(23) :
> error C2027: use of undefined type 'Fl_Group'
>         C:\FLTK\FL/Fl_Widget.H(33) : see declaration of 'Fl_Group'
> C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.cxx(23) :
> error C2227: left of '->user_data' must point to class/struct/union
> C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.cxx(23) :
> error C2227: left of '->cb__i' must point to class/struct/union
> C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.cxx(28) :
> error C2661: 'CalculatorGUI::CalculatorGUI' : no overloaded function takes 4
> parameters
> C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.cxx(30) :
> error C2039: 'box' : is not a member of 'CalculatorGUI'
>         C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.h(11)
> : see declaration of 'CalculatorGUI'
> C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.cxx(31) :
> error C2039: 'color' : is not a member of 'CalculatorGUI'
>         C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.h(11)
> : see declaration of 'CalculatorGUI'
> C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.cxx(32) :
> error C2039: 'selection_color' : is not a member of 'CalculatorGUI'
>         C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.h(11)
> : see declaration of 'CalculatorGUI'
> C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.cxx(33) :
> error C2039: 'labeltype' : is not a member of 'CalculatorGUI'
>         C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.h(11)
> : see declaration of 'CalculatorGUI'
> C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.cxx(34) :
> error C2039: 'labelfont' : is not a member of 'CalculatorGUI'
>         C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.h(11)
> : see declaration of 'CalculatorGUI'
> C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.cxx(35) :
> error C2039: 'labelsize' : is not a member of 'CalculatorGUI'
>         C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.h(11)
> : see declaration of 'CalculatorGUI'
> C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.cxx(36) :
> error C2039: 'labelcolor' : is not a member of 'CalculatorGUI'
>         C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.h(11)
> : see declaration of 'CalculatorGUI'
> C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.cxx(37) :
> error C2039: 'user_data' : is not a member of 'CalculatorGUI'
>         C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.h(11)
> : see declaration of 'CalculatorGUI'
> C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.cxx(38) :
> error C2039: 'align' : is not a member of 'CalculatorGUI'
>         C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.h(11)
> : see declaration of 'CalculatorGUI'
> C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.cxx(39) :
> error C2039: 'when' : is not a member of 'CalculatorGUI'
>         C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.h(11)
> : see declaration of 'CalculatorGUI'
> C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.cxx(50) :
> error C2039: 'end' : is not a member of 'CalculatorGUI'
>         C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.h(11)
> : see declaration of 'CalculatorGUI'
> main.cxx
> Generating Code...
> Error executing cl.exe.
> 
> ALL_BUILD - 23 error(s), 0 warning(s)
> 
> 
> 
> ----------------------------------------------------------------------------
> -----
> 
> CMakeLists.txt
> 
> 
> 
> PROJECT( TestCalculator )
> 
> INCLUDE (${CMAKE_ROOT}/Modules/FindFLTK.cmake)
> 
> INCLUDE_DIRECTORIES(
>   ${FLTK_INCLUDE_PATH}
> 
> )
> 
> SET( TestCalculator_SRCS
>   CalculatorGUI.cxx
>   main.cxx
> 
> )
> 
> 
> ADD_EXECUTABLE( TestCalculator TestCalculator_SRCS )
> 
> 
> TARGET_LINK_LIBRARIES( TestCalculator ${FLTK_LIBRARIES})
> 
> 
> ----------------------------------------------------------------------------
> ---
> 
> CalculatorGUI.fld
> 
> # data file for the Fltk User Interface Designer (fluid)
> 
> version 1.0104
> 
> header_name {.h}
> 
> code_name {.cxx}
> 
> class CalculatorGUI {open : {public BaseCalculator}
> 
> } {
> 
> Function {CalculatorGUI()} {open
> 
> } {
> 
> Fl_Window CalculatorPanel {open
> 
> xywh {509 160 282 221}
> 
> code0 {\#include "BaseCalculator.h"}
> 
> class CalculatorGUI visible
> 
> } {
> 
> Fl_Value_Input OperandAInputValue {
> 
> label {A:}
> 
> callback {SetOperandA( o->value );}
> 
> xywh {25 25 25 25}
> 
> }
> 
> Fl_Value_Input OperandBInputValue {
> 
> label {B:}
> 
> callback {SetOperandB( o->value );}
> 
> xywh {105 25 25 25}
> 
> }
> 
> Fl_Button {} {
> 
> label {+}
> 
> callback {Add();}
> 
> xywh {60 25 25 25}
> 
> }
> 
> Fl_Value_Output ResultOutputValue {
> 
> label {=} selected
> 
> xywh {145 25 25 25}
> 
> }
> 
> }
> 
> }
> 
> Function {~CalculatorGUI()} {open return_type virtual
> 
> } {}
> 
> Function {show()} {open return_type virtual
> 
> } {}
> 
> Function {hide()} {open return_type virtual
> 
> } {}
> 
> }
> 
> 
> 
> 
> 
> 
> 
> ----- Original Message ----- 
> From: "Luis Ibanez" <luis . ibanez at kitware . com>
> To: "Lino Ramirez" <ramirez at ece . ualberta . ca>
> Cc: <insight-users at itk . org>
> Sent: Thursday, November 06, 2003 1:10 PM
> Subject: Re: [Insight-users] Problems building the example from
> "Introduction to FLTK" by Luis Ibanez
> 
> 
> 
>>Hi Lino,
>>
>>The compilation errors that you get show
>>that you are not including the header file
>>CalculatorGUI.h from CalculatorGUI.cxx.
>>
>>That's why the compiler cannot find the
>>definition of the CalculatorGUI class and
>>complains with:
>>
>>
>> > Compiling...
>> > CalculatorGUI.cxx
>> > C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.cxx(3)
>> > : error
>> > C2653: 'CalculatorGUI' : is not a class or namespace name
>>
>>
>>When you created the FLUID file CalculatorGUI.fld
>>you clicked in the option :
>>
>>     "Include header from Code"
>>
>>This is shown at the top of your fluid file
>>
>> >>># data file for the Fltk User Interface Designer (fluid)
>> >>>
>> >>>version 1.0104
>> >>>
>> >>>do_not_include_H_from_C    <<<==========={{{ HERE
>> >>>
>> >>>header_name {.h}
>> >>>
>> >>>code_name {.cxx}
>>
>>
>>
>>So, the solution is:
>>
>>
>>        *Don't do that !*
>>
>>
>>Open the .fld file again with FLUID,
>>Go to the "Edit" menu, then select
>>"Project setting" and make sure that
>>you enable the button
>>
>>     "Include header from Code"
>>
>>
>>Then, save the fluid file and regenerate
>>the .cxx and .h files.
>>
>>Finally, reload the project in VisualStudio
>>and rebuild it.
>>
>>
>>Regards,
>>
>>
>>
>>   Luis
>>
>>
> 
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk . org
> http://www . itk . org/mailman/listinfo/insight-users
>