[Insight-users] Problems building the example from "Introduction
to FLTK" by Luis Ibanez
Luis Ibanez
luis . ibanez at kitware . com
Wed, 05 Nov 2003 16:17:05 -0500
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
>
> } {}
>
> }
>
> -------------------------------------------------------------------------------------------------
>
>
>
>
>