FLTK & Stroustrup library problem

I am not sure if I should do this, but the max length of the post is 8192, but my post is 12000 characters long. I have a problem with the FLTK library and the library files included in the book I am reading, "Programming: Principles and Practice using C++" by Stroustrup. I need your help, otherwise I won't be able to continue advancing. Here's the link to my original post:

http://cpptutorials.freeforums.org/fltk-stroustrup-library-problem-t1692.html

Thanks in advance!
Last edited on
Any problem can be described in less than 30 lines of text.:)
Your first error is (truncated):

Source.obj : error LNK2019: unresolved external symbol "public: void __thiscall Fl_Widget::show(void)")


This is a function defined in the FLTK library. The linker was unable to find the implementation of that function, which suggests you've not specified the appropriate library files to your linker.

That suggests you didn't do step 3 of the installation instructions correctly:

3. In the Properties dialog box, in the left menu, click the Linker folder.
This expands a sub-menu. In this sub-menu, click Input. In the Additional Dependencies text field on the right, enter the following text:
fltkd.1ib ws0ck32.lib comctl32.lib fltkjpegd.lib fltkimagesd.lib
[The following step may be unecessary because il is now the default.]
In the Ignore Specific Library text field, enter the following text:
libcd.lib


[edit: That step should be done for every new project you make that you wish to use this library on. The others shouldn't need to be repeated.]
Last edited on
Thanks, but it still doesn't want to compile. I got it from 18 down to 10 errors now. Here are the errors:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
1
1>  Source.cpp
1>d:\programs\microsoft visual studio\vc\include\graph.h(45): warning C4305: 'initializing' : truncation from 'Graph_lib::Color::Transparency' to 'char'
1>d:\programs\microsoft visual studio\vc\include\graph.h(45): warning C4309: 'initializing' : truncation of constant value
1>d:\programs\microsoft visual studio\vc\include\graph.h(47): warning C4305: 'initializing' : truncation from 'Graph_lib::Color::Transparency' to 'char'
1>d:\programs\microsoft visual studio\vc\include\graph.h(47): warning C4309: 'initializing' : truncation of constant value
1>d:\programs\microsoft visual studio\vc\include\gui.h(107): warning C4018: '<' : signed/unsigned mismatch
1>d:\programs\microsoft visual studio\vc\include\gui.h(112): warning C4018: '<' : signed/unsigned mismatch
1>d:\programs\microsoft visual studio\vc\include\gui.h(117): warning C4018: '<' : signed/unsigned mismatch
1>d:\programs\microsoft visual studio\vc\include\graph.h(130): warning C4018: '<' : signed/unsigned mismatch
1>          d:\programs\microsoft visual studio\vc\include\graph.h(130) : while compiling class template member function 'Graph_lib::Vector_ref<T>::~Vector_ref(void)'
1>          with
1>          [
1>              T=Graph_lib::Button
1>          ]
1>          d:\programs\microsoft visual studio\vc\include\gui.h(97) : see reference to function template instantiation 'Graph_lib::Vector_ref<T>::~Vector_ref(void)' being compiled
1>          with
1>          [
1>              T=Graph_lib::Button
1>          ]
1>          d:\programs\microsoft visual studio\vc\include\gui.h(99) : see reference to class template instantiation 'Graph_lib::Vector_ref<T>' being compiled
1>          with
1>          [
1>              T=Graph_lib::Button
1>          ]
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall Graph_lib::Window::draw(void)" (?draw@Window@Graph_lib@@MAEXXZ)
1>Source.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Graph_lib::Shape::move(int,int)" (?move@Shape@Graph_lib@@UAEXHH@Z)
1>Source.obj : error LNK2019: unresolved external symbol "protected: __thiscall Graph_lib::Shape::Shape(void)" (??0Shape@Graph_lib@@IAE@XZ) referenced in function "public: __thiscall Graph_lib::Open_polyline::Open_polyline(void)" (??0Open_polyline@Graph_lib@@QAE@XZ)
1>Source.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall Graph_lib::Shape::draw_lines(void)const " (?draw_lines@Shape@Graph_lib@@MBEXXZ)
1>Source.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Graph_lib::Open_polyline::draw_lines(void)const " (?draw_lines@Open_polyline@Graph_lib@@UBEXXZ)
1>Source.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Graph_lib::Closed_polyline::draw_lines(void)const " (?draw_lines@Closed_polyline@Graph_lib@@UBEXXZ)
1>Source.obj : error LNK2019: unresolved external symbol "public: void __thiscall Graph_lib::Polygon::add(struct Point)" (?add@Polygon@Graph_lib@@QAEXUPoint@@@Z) referenced in function _main
1>Source.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall Graph_lib::Polygon::draw_lines(void)const " (?draw_lines@Polygon@Graph_lib@@UBEXXZ)
1>Source.obj : error LNK2019: unresolved external symbol "public: __thiscall Simple_window::Simple_window(struct Point,int,int,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0Simple_window@@QAE@UPoint@@HHABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol "public: bool __thiscall Simple_window::wait_for_button(void)" (?wait_for_button@Simple_window@@QAE_NXZ) referenced in function _main
1>C:\Users\Ben\Desktop\C++\Projects\Display Model\Debug\Display Model.exe : fatal error LNK1120: 10 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


Is it possibly that there is something wrong with Stroustup's library files? Because I don't see any errors referring to the FTLK library anymore.
Add the appropriate cpp files to your project.
@cire

Thank you so much! It all works now! I added all of the .cpp files in Stroustup's library instead of the header files in the example. I thought there was a problem with the library files, and if it was so then I wouldn't be able to fix it. Thanks again!
Topic archived. No new replies allowed.