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

Lino Ramirez Lino Ramirez" <ramirez at ece . ualberta . ca
Thu, 6 Nov 2003 10:45:07 -0700


Hi Luis,

Thank you for the help. I still don’t get it to work thought. Making the
change you suggested I eliminated a couple of errors but I am still getting
the following errors:

--------------------Configuration: TestCalculator - Win32
Debug--------------------
Compiling...
main.cxx
Linking...
main.obj : error LNK2001: unresolved external symbol "public: __thiscall
CalculatorGUI::CalculatorGUI(void)" (??0CalculatorGUI@@QAE at XZ)
main.obj : error LNK2001: unresolved external symbol "public: virtual
__thiscall CalculatorGUI::~CalculatorGUI(void)" (??1CalculatorGUI@@UAE at XZ)
Debug/TestCalculator.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.

ALL_BUILD - 3 error(s), 0 warning(s)

Then, I noticed I forgot to include the file CalculatorGUI.cxx (one of the
files created by fluid) in my project. So, I modified my CMakeLists.txt to
look like
----------------------------------------------------------------------------
---------------------------
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})
----------------------------------------------------------------------------
------------------------

But, now I am getting 102 errors. Some of them are listed below.

Could you tell what I have to do to get this simple program running?

Thank you very much

Lino Ramirez

--------------------Configuration: TestCalculator - Win32
Debug--------------------
Compiling...
CalculatorGUI.cxx
C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.cxx(3) : error
C2653: 'CalculatorGUI' : is not a class or namespace name
C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.cxx(3) : error
C2065: 'Fl_Value_Input' : undeclared identifier
C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.cxx(3) : error
C2065: 'o' : undeclared identifier
C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.cxx(3) : error
C2062: type 'void' unexpected
C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.cxx(3) : error
C2143: syntax error : missing ';' before '{'
C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.cxx(3) : error
C2447: missing function header (old-style formal list?)
C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.cxx(6) : error
C2653: 'CalculatorGUI' : is not a class or namespace name
C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.cxx(6) : error
C2062: type 'void' unexpected
C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.cxx(6) : error
C2143: syntax error : missing ';' before '{'
C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.cxx(6) : error
C2447: missing function header (old-style formal list?)
C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.cxx(10) :
error C2653: 'CalculatorGUI' : is not a class or namespace name
C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.cxx(10) :
error C2062: type 'void' unexpected
C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.cxx(10) :
error C2143: syntax error : missing ';' before '{'
C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.cxx(10) :
error C2447: missing function header (old-style formal list?)
C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.cxx(13) :
error C2653: 'CalculatorGUI' : is not a class or namespace name
C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.cxx(13) :
error C2062: type 'void' unexpected
C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.cxx(13) :
error C2143: syntax error : missing ';' before '{'
C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.cxx(13) :
error C2447: missing function header (old-style formal list?)
C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.cxx(17) :
error C2653: 'CalculatorGUI' : is not a class or namespace name
C:\Lino\PhD\2003\SummerWork\fltk\testCalculator\CalculatorGUI.cxx(17) :
error C2065: 'Fl_Button' : undeclared identifier


----- 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: Wednesday, November 05, 2003 2:17 PM
Subject: Re: [Insight-users] Problems building the example from
"Introduction to FLTK" by Luis Ibanez


>
>
> Hi Lino,
>
>
> "Unresolved external" almost always means that you are
> missing to link with a library. The list of unresolved
> symbols usually indicates what libraries are missing.
>
> In your case, the missing symbols are fundamental
> FLTK ones, like Fl::run(). This means that you are
> missing the basic FLTK libraries.
>
> Simply add the following CMake command to your
> CMakeList.txt file.
>
>
> TARGET_LINK_LIBRARIES( TestCalculator ${FLTK_LIBRARIES})
>
>
> Then Rerun CMake, and rebuild your project.
>
>
> BTW,
> September 2001 was long time ago,   :-)
>
> You will find more convenient to use the more recent material
> we prepared for the ITK tutorials:
>
>        http://www . itk . org/HTML/Tutorials . htm
>
>
> Regards,
>
>
>
>    Luis
>
>
> -------------------
> Lino Ramirez wrote:
> > Hello,
> >
> >
> >
> > I am trying to build the Example from “Introduction to FLTK” by Luis
> > Ibanez (Sept 11, 2001) using Visual C++ 6.0.
> >
> >
> >
> > Here are the errors I am getting
> >
> >
> >
> > --------------------Configuration: TestCalculator - Win32
> > Debug--------------------
> >
> > Compiling...
> >
> > main.cxx
> >
> > Linking...
> >
> > main.obj : error LNK2001: unresolved external symbol "public: static int
> > __cdecl Fl::run(void)" (?run at Fl@@SAHXZ)
> >
> > main.obj : error LNK2001: unresolved external symbol "public: __thiscall
> > CalculatorGUI::CalculatorGUI(void)" (??0CalculatorGUI@@QAE at XZ)
> >
> > main.obj : error LNK2001: unresolved external symbol "public: int
> > __thiscall Fl_Valuator::value(double)" (?value at Fl_Valuator@@QAEHN at Z)
> >
> > main.obj : error LNK2001: unresolved external symbol "public: virtual
> > __thiscall CalculatorGUI::~CalculatorGUI(void)"
(??1CalculatorGUI@@UAE at XZ)
> >
> > Debug/TestCalculator.exe : fatal error LNK1120: 4 unresolved externals
> >
> > Error executing link.exe.
> >
> >
> >
> > ALL_BUILD - 5 error(s), 0 warning(s)
> >
> >
> >
>
> --------------------------------------------------------------------------
-----------------------
> >
> >
> >
> > This is the CMakeLists.txt I am using
> >
>
> --------------------------------------------------------------------------
-----------------------
> >
> > PROJECT( TestCalculator )
> >
> >
> >
> > INCLUDE (${CMAKE_ROOT}/Modules/FindFLTK.cmake)
> >
> >
> >
> > INCLUDE_DIRECTORIES(
> >
> >   ${FLTK_INCLUDE_PATH}
> >
> >
> >
> > )
> >
> >
> >
> > ADD_EXECUTABLE( TestCalculator main.cxx )
> >
>
> --------------------------------------------------------------------------
-----------------------
> >
> >
> >
> > Could anyone tell me where the problem is?
> >
> >
> >
> > Thank you,
> >
> >
> >
> > Lino Ramirez
> >
> >
> >
> > P.S. Below is the CalculatorGUI.fld file.
> >
>
> --------------------------------------------------------------------------
-----------------------
> >
> > # data file for the Fltk User Interface Designer (fluid)
> >
> > version 1.0104
> >
> > do_not_include_H_from_C
> >
> > 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 {SetOperandB( o->value );}
> >
> >         xywh {25 25 25 25} align 132 maximum 10
> >
> >       }
> >
> >       Fl_Value_Input OperandBInputValue {
> >
> >         label {B:}
> >
> >         callback {SetOperandB( o->value );}
> >
> >         xywh {105 25 25 25} align 68
> >
> >       }
> >
> >       Fl_Button {} {
> >
> >         label {+}
> >
> >         callback {Add();}
> >
> >         xywh {60 25 25 25}
> >
> >       }
> >
> >       Fl_Value_Output ResultOutputValue {
> >
> >         label {=}
> >
> >         xywh {145 25 25 25}
> >
> >       }
> >
> >     }
> >
> >   }
> >
> >   Function {~CalculatorGUI()} {open return_type virtual
> >
> >   } {}
> >
> >   Function {show()} {open return_type virtual
> >
> >   } {}
> >
> >   Function {hide()} {open selected return_type virtual
> >
> >   } {}
> >
> > }
> >
>
> --------------------------------------------------------------------------
-----------------------
> >
> >
> >
> >
> >
>
>
>