Not able to run Capter 12 Drill

177 views
Skip to first unread message

cipri_arad_77

unread,
Oct 19, 2010, 2:15:07 PM10/19/10
to PPP-public
Hello,

I succesfully installed FLTK libraries (version 1.3) into my Visual C+
+ 2010 Express Edition.
I know this because I compiled without problems the test program from
page 1160. It showed a little window with Hello World. And the test
was made on the project that I am using now for the Drill from Chapter
12.

But now I suspect that I have problems with the interface libraries.

I tried to compile and run the Drill.
I included in the project the files Graph.cpp and Window.cpp
(downloaded from PPP suporting site), and after consulting the erata
for PPP I used in my .cpp file (called Drill1.cpp) #include
"Graph.h", #include "Window.h", and #include "Simple_window.h".
It compiles Ok, it does not find any errors, only some warnings, but
it does not link corectly to run the program.
I searched the entire forum of PPP before posting this thread, and
found that somebody had a similar problem and Dr Stroustrup responded
that it can be from not including the necessary .cpp files in the
project. Whell, I included the necessary .cpp files, and also the
neccesary headers (also "Simple_window.h", as specified in erata) and
still not working.

I post here also the output for my project, if someone has the
patience and time to understand what is the problem :

1>------ Build started: Project: Cap 12_Drill_FLTK, Configuration:
Debug Win32 ------
1> Drill 1.cpp
1>c:\users\admin\documents\visual studio 2010\projects\de peste tot
\cap 12_drill_fltk\cap 12_drill_fltk\graph.h(44): warning C4305:
'initializing' : truncation from 'Graph_lib::Color::Transparency' to
'char'
1>c:\users\admin\documents\visual studio 2010\projects\de peste tot
\cap 12_drill_fltk\cap 12_drill_fltk\graph.h(44): warning C4309:
'initializing' : truncation of constant value
1>c:\users\admin\documents\visual studio 2010\projects\de peste tot
\cap 12_drill_fltk\cap 12_drill_fltk\graph.h(46): warning C4305:
'initializing' : truncation from 'Graph_lib::Color::Transparency' to
'char'
1>c:\users\admin\documents\visual studio 2010\projects\de peste tot
\cap 12_drill_fltk\cap 12_drill_fltk\graph.h(46): warning C4309:
'initializing' : truncation of constant value
1>c:\users\admin\documents\visual studio 2010\projects\de peste tot
\cap 12_drill_fltk\cap 12_drill_fltk\gui.h(106): warning C4018: '<' :
signed/unsigned mismatch
1>c:\users\admin\documents\visual studio 2010\projects\de peste tot
\cap 12_drill_fltk\cap 12_drill_fltk\gui.h(111): warning C4018: '<' :
signed/unsigned mismatch
1>c:\users\admin\documents\visual studio 2010\projects\de peste tot
\cap 12_drill_fltk\cap 12_drill_fltk\gui.h(116): warning C4018: '<' :
signed/unsigned mismatch
1>c:\users\admin\documents\visual studio 2010\projects\de peste tot
\cap 12_drill_fltk\cap 12_drill_fltk\graph.h(129): warning C4018:
'<' : signed/unsigned mismatch
1> c:\users\admin\documents\visual studio 2010\projects\de
peste tot\cap 12_drill_fltk\cap 12_drill_fltk\graph.h(129) : while
compiling class template member function
'Graph_lib::Vector_ref<T>::~Vector_ref(void)'
1> with
1> [
1> T=Graph_lib::Button
1> ]
1> c:\users\admin\documents\visual studio 2010\projects\de
peste tot\cap 12_drill_fltk\cap 12_drill_fltk\gui.h(98) : see
reference to class template instantiation 'Graph_lib::Vector_ref<T>'
being compiled
1> with
1> [
1> T=Graph_lib::Button
1> ]
1>Drill 1.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>Drill 1.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>C:\Users\Admin\Documents\Visual Studio 2010\Projects\De peste tot
\Cap 12_Drill_FLTK\Debug\Cap 12_Drill_FLTK.exe : fatal error LNK1120:
2 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped
==========

Adrian Mowrey

unread,
Oct 19, 2010, 4:48:18 PM10/19/10
to ppp-p...@googlegroups.com
Okay. Where do you have those files? You might want to add them to your include folder too, if you haven't done so already.


--
You received this message because you are subscribed to the Google Groups "PPP-public" group.
To post to this group, send email to ppp-p...@googlegroups.com.
To unsubscribe from this group, send email to ppp-public+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ppp-public?hl=en.




--
Sincerely/Cu sinceritate,

Adrian Mowrey

cipri_arad_77

unread,
Oct 19, 2010, 10:38:40 PM10/19/10
to PPP-public
The .cpp files from the interface library must be added to the include
folder ?

I added to the include folder only the FL folder from FLTK (the folder
wich has the .h files from FLTK).
They are added by the compiler like this : #include <FL/Fl_Window.h>
The header files from the interface library are in the folder with the
project because and they are added by the compiler
like this : #include "Graph.h".

On 19 oct., 23:48, Adrian Mowrey <adrian.mow...@gmail.com> wrote:
> Okay. Where do you have those files? You might want to add them to your
> include folder too, if you haven't done so already.
>
> > ppp-public+...@googlegroups.com<ppp-public%2Bunsubscribe@googlegrou­ps.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/ppp-public?hl=en.
>
> --
> *Sincerely/Cu sinceritate,
>
> Adrian Mowrey*- Ascundeţi textul citat -
>
> - Afişare text în citat -

Adrian Mowrey

unread,
Oct 20, 2010, 5:04:27 AM10/20/10
to ppp-p...@googlegroups.com

Yes. Try adding them to the include folder of your compiler.

> To unsubscribe from this group, send email to ppp-public+...@googlegroups.com.

Art Werschulz

unread,
Oct 20, 2010, 6:01:11 AM10/20/10
to ppp-p...@googlegroups.com
Hi.

On Oct 20, 2010, at 5:04 AM, Adrian Mowrey wrote:

> On Oct 19, 2010 10:38 PM, "cipri_arad_77" <23cip...@gmail.com> wrote:
>> The .cpp files from the interface library must be added to the include
>> folder ?
> Yes. Try adding them to the include folder of your compiler.

I don't know how this is done in the Windows environment, but in the Unix environment it would be more natural to compile all the .cpp files (getting .o files), and then turn them into a library. (ISTR there being a Makefile for same; if not, I can provide one.) Having done so, one then uses a Makefile that tells the link-loading phase where to find said library.

One advantage of doing this is that it further separates interface from implementation.

Art Werschulz
207 Stoughton Avenue, Cranford NJ 07016-2838
(908) 272-1146

cipri_arad_77

unread,
Oct 20, 2010, 11:21:00 AM10/20/10
to PPP-public
Is doing exactly the same thing.
I added the cpp and header files from interface library to include
folder of my compiler and nothing changed.

On 20 oct., 12:04, Adrian Mowrey <adrian.mow...@gmail.com> wrote:
> Yes. Try adding them to the include folder of your compiler.
> - Afişare text în citat -- Ascundeţi textul citat -
>
> - Afişare text în citat -- Ascundeţi textul citat -

Adrian Mowrey

unread,
Oct 21, 2010, 6:02:13 AM10/21/10
to ppp-p...@googlegroups.com
Okay. I remember doing it before, so as soon as Francisco is going to send the file he and I wrote a while ago to solve that problem, I'll post it here. I kind of would like him to post it here for everybody; which I thought he already did...but...I'm not seeing it.
 
It's tricky, that's why I would suggest learning QT instead. Just like Dr. Bjarne said in one of his conferences, C++ has many GUI's. A lot of people were concerned I guess that it is not like Java's Swing, or something like that. Like the .NET has everything within its environment. You just have to choose which one you'll be using for the long term...and I believe QT is a great choice. It's powerful, cross-platform, etc. It has everything you'll need to develop everything you may need to develop while using a language like C or C++..., and I saw that they also support a couple of other languages too not just C or C++.
 
Good luck, and I'm sorry you're going through the same problems I have or others have gone through. I really hope Francisco will find and send that file either to me or here to the group.
 
Have a wonderful day, and I'll talk to you later.

2010/10/20 cipri_arad_77 <23cip...@gmail.com>
To unsubscribe from this group, send email to ppp-public+...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/ppp-public?hl=en.




--
Sincerely/Cu sinceritate,

Adrian Mowrey

Adrian Mowrey

unread,
Oct 21, 2010, 10:55:38 PM10/21/10
to ppp-p...@googlegroups.com
Okay, here is the file that Francisco and I wrote a while back. It seems like every one of us encountered some kind of problem with this FLTK. :-) That's why I hope someday C++ will have a GUI standard, just like Java has the Swing, etc. I know I'm thinking low..., Dr. Bjarne says...and that I have no clue, but I think C++ will have better success that way. If I ever win Mega Millions of Power Ball through my neighbors (because I don't play)...I'll sponsor the C++ community! ;-)

Take care, and enjoy...just like Francisco said. :-)

2010/10/21 Adrian Mowrey <adrian...@gmail.com>
FLTKexpressFall07.doc

cipri_arad_77

unread,
Oct 22, 2010, 11:27:20 AM10/22/10
to PPP-public
Ok thank's Adrian.
I will try to do it accordingly to the file you put it here, but I
have Visual Studio Professional 2010.
I will see if it works like it says in there whith Visual Studio 2008
Express Edition, also for VS 2010 Professional.

On 22 oct., 05:55, Adrian Mowrey <adrian.mow...@gmail.com> wrote:
> Okay, here is the file that Francisco and I wrote a while back. It seems
> like every one of us encountered some kind of problem with this FLTK. :-)
> That's why I hope someday C++ will have a GUI standard, just like Java has
> the Swing, etc. I know I'm thinking low..., Dr. Bjarne says...and that I
> have no clue, but I think C++ will have better success that way. If I ever
> win Mega Millions of Power Ball through my neighbors (because I don't
> play)...I'll sponsor the C++ community! ;-)
>
> Take care, and enjoy...just like Francisco said. :-)
>
> 2010/10/21 Adrian Mowrey <adrian.mow...@gmail.com>
>
>
>
> > Okay. I remember doing it before, so as soon as Francisco is going to send
> > the file he and I wrote a while ago to solve that problem, I'll post it
> > here. I kind of would like him to post it here for everybody; which I
> > thought he already did...but...I'm not seeing it.
>
> > It's tricky, that's why I would suggest learning QT instead. Just like Dr.
> > Bjarne said in one of his conferences, C++ has many GUI's. A lot of people
> > were concerned I guess that it is not like Java's Swing, or something like
> > that. Like the .NET has everything within its environment. You just have to
> > choose which one you'll be using for the long term...and I believe QT is a
> > great choice. It's powerful, cross-platform, etc. It has everything you'll
> > need to develop everything you may need to develop while using a language
> > like C or C++..., and I saw that they also support a couple of other
> > languages too not just C or C++.
>
> > Good luck, and I'm sorry you're going through the same problems I have or
> > others have gone through. I really hope Francisco will find and send that
> > file either to me or here to the group.
>
> > Have a wonderful day, and I'll talk to you later.
>
> > 2010/10/20 cipri_arad_77 <23cipri4...@gmail.com>
> >> > >> > ppp-public+...@googlegroups.com<ppp-public%2Bunsu...@googlegrou-ps.com>
> >> <ppp-public%2Bunsu...@googlegrou-ps.com>
>
> >> > <ppp-public%2Bunsu...@googlegrou-ps.com>
>
> >> > >> > .
> >> > >> > For more options, visit this group at
> >> > >> >http://groups.google.com/group/ppp-public?hl=en.
>
> >> > >> --
> >> > >> *Sincerely/Cu sinceritate,
>
> >> > >> Adrian Mowrey*- Ascundeţi textul citat -
>
> >> > >> - Afişare text în citat -
>
> >> > > --
> >> > > You received this message because you are subscribed to the Google
> >> Groups
> >> > "PPP-public" group.
> >> > > To post to this group, send email to ppp-p...@googlegroups.com.
> >> > > To unsubscribe from this group, send email to
>
> >> > ppp-public+...@googlegroups.com<ppp-public%2Bunsu...@googlegrou-ps.com>
> >> <ppp-public%2Bunsu...@googlegrou-ps.com>
> >> > .> For more options, visit this group at
>
> >> >http://groups.google.com/group/ppp-public?hl=en.
>
> >> > - Ascundeţi textul citat -
>
> >> > - Afişare text în citat -- Ascundeţi textul citat -
>
> >> > - Afişare text în citat -- Ascundeţi textul citat -
>
> >> > - Afişare text în citat -
>
> >> --
> >> You received this message because you are subscribed to the Google Groups
> >> "PPP-public" group.
> >> To post to this group, send email to ppp-p...@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> ppp-public+...@googlegroups.com<ppp-public%2Bunsu...@googlegrou-ps.com>
> >> .
> >> For more options, visit this group at
> >>http://groups.google.com/group/ppp-public?hl=en.
>
> > --
> > *Sincerely/Cu sinceritate,
>
> ...
>
> citiţi mai multe >>
>
> FLTKexpressFall07.doc
> 51KVizualizaţiDescărcaţi- Ascundeţi textul citat -

cipri_arad_77

unread,
Oct 24, 2010, 7:07:27 AM10/24/10
to PPP-public
Hello,

PROBLEM SOLVED !!!
YUPIIIII IEEEEEEEEE !!!!!!!!!!

And it was so easy. Like the granny who is looking for her glasses and
then when she gets in front of the window
sees that they are on her nose :)

What I will explain bellow is what worked for me. with Visual Studio
2010 Express Edition, and fltk-1.3.x-r7725 .

So I copied in the project directory the headers : Simple_window.h,
Window.h, Graph.h, GUI.h, Point.h, and std_lib_facilities.h (the one
for chapters 12-16).
Also in the project I included the following C++ source files:
Simple_window.cpp, Window.cpp, Graph.cpp and GUI.cpp.
After that I included in my main C++ source file the first 4 headers,
except Point.h (I think that this is not necessary because is included
by the other headers). The main file is bellow :

#include "Graph.h"
#include "Simple_window.h"
#include "Window.h"
#include "GUI.h"

using namespace Graph_lib;

int main()
{
Point tl(100, 100);
Simple_window win(tl, 600, 400, "Canvas");
win.wait_for_button();
}

With all of this works and so now I am glad that I can return to
chapters 12-16 after diving some days in chapter 17 (interesting stuff
also there, especially implementing a double linked list).

Best regards,

Zaharie Ciprian
> > >> > >> > ppp-public+...@googlegroups.com<ppp-public%2Bunsubscr...@googlegrou-ps.com>
> > >> <ppp-public%2Bunsubscr...@googlegrou-ps.com>
>
> > >> > <ppp-public%2Bunsubscr...@googlegrou-ps.com>
>
> > >> > >> > .
> > >> > >> > For more options, visit this group at
> > >> > >> >http://groups.google.com/group/ppp-public?hl=en.
>
> > >> > >> --
> > >> > >> *Sincerely/Cu sinceritate,
>
> > >> > >> Adrian Mowrey*- Ascundeþi textul citat -
>
> > >> > >> - Afiºare text în citat -
>
> > >> > > --
> > >> > > You received this message because you are subscribed to the Google
> > >> Groups
> > >> > "PPP-public" group.
> > >> > > To post to this group, send email to ppp-p...@googlegroups.com.
> > >> > > To unsubscribe from this group, send email to
>
> > >> > ppp-public+...@googlegroups.com<ppp-public%2Bunsubscr...@googlegrou-ps.com>
>
> ...
>
> citiţi mai multe »- Ascundeţi textul citat -

Adrian Mowrey

unread,
Oct 24, 2010, 8:23:15 AM10/24/10
to ppp-p...@googlegroups.com
Okay, that's great. Good luck with everything else you'd want to accomplish.

To unsubscribe from this group, send email to ppp-public+...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/ppp-public?hl=en.




--
Sincerely/Cu sinceritate,

Adrian Mowrey

cipri_arad_77

unread,
Oct 24, 2010, 2:36:24 PM10/24/10
to PPP-public
Thank's Adrian.
I've downloaded and printed also your file regarding FLTK that you
have wrote with Francisco.
Good to have it around for FLTK library issues.


On 24 oct., 15:23, Adrian Mowrey <adrian.mow...@gmail.com> wrote:
> Okay, that's great. Good luck with everything else you'd want to accomplish.
>

Adrian Mowrey

unread,
Oct 24, 2010, 2:42:32 PM10/24/10
to ppp-p...@googlegroups.com
You're welcome. I'm glad it worked for you, finally. We got together back then to solve this problem, and it worked for us back then too. Good luck, and have a great day.

2010/10/24 cipri_arad_77 <23cip...@gmail.com>
--
You received this message because you are subscribed to the Google Groups "PPP-public" group.
To post to this group, send email to ppp-p...@googlegroups.com.
To unsubscribe from this group, send email to ppp-public+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ppp-public?hl=en.

Reply all
Reply to author
Forward
0 new messages