eric wrote:
> I get a lot compile errors, which is really out of novice as me to figure out.
> chapter.12.3.cpp:(.text+0x7d): undefined reference to
> `Simple_window::Simple_window(Point, int, int, String const&)'
> chapter.12.3.cpp:(.text+0x1e7): undefined reference to
> `Simple_window::wait_for_button()'
The above errors seem to be complaining about code in Simple_window.h,
code that hasn't been posted here (you just posted the .cpp file, not
the .h file on which it depends, and the above errors are about)
> chapter.12.3.cpp:(.text+0x100): undefined reference to
> `Graph_lib::Polygon::add(Point)'
> chapter.12.3.cpp:(.text+0x144): undefined reference to
> `Graph_lib::Polygon::add(Point)'
> chapter.12.3.cpp:(.text+0x188): undefined reference to
> `Graph_lib::Polygon::add(Point)'
These appear to be errors about another library, "Graph_lib",
which I take it is something the example needs, and the book provides,
and is something you have to compile separately, and link in with
your application.
This is a more complex situation; you're trying to compile a program
that depends on more than just FLTK, but several other files as well.
So a simple: "fltk2-config --compile <yourcode.cpp>" is not enough;
other files need to be compiled first (Graph_lib, whatever that is, etc)
I noticed in the directory listing you provided of your examples,
there's a "Makefile" in there, eg:
----
r...@eric-laptop:/home/eric/BStrou/usingC++4/code/Chapter12# ls
build.bat chapter.12.7.2.cpp chapter.12.7.6-1.cpp
chapter.12.7.8-2.cpp GUI.cpp index.html.2 MatrixIO.h
std_lib_facilities.h
ch12try1.cpp chapter.12.7.3-1.cpp chapter.12.7.6-2.cpp
chapter.12.7.9-1.cpp GUI.h index.html.3 Point.h
std_lib_facilities.h.1
chapter.12.3.cpp chapter.12.7.3-2.cpp chapter.12.7.6.cpp
chapter.12.7.9-2.cpp image.jpg Makefile Simple_window.cpp Window.cpp
^^^^^^^^
----
Can you paste the contents of that Makefile here?
It will probably give us a good idea of what's involved here.
It's possible that just running 'make' is what you need.
However, it depends on the contents of the Makefile, which
may need some small changes to point to where you have fltk2
installed before 'make' will work correctly.
You could try just running 'make'.
Are you sure the book doesn't recommend how to build all the
examples? I can't imagine they'd recommend using g++ to build
these GUI examples.. only very simple non-GUI apps would build
with just 'g++'.
Is the book's example code and documentation online somewhere?
At very least, paste us the Makefile that is in your project
directory, as that file will likely have all the info in it
on how to build all the examples in that directory. (To use
a Makefile, you would run 'make')
> r...@eric-laptop:/home/eric/BStrou/usingC++4/code/Chapter12# g++
> -Wno-deprecated chapter.12.3.cpp Simple_window.cpp Graph.cpp GUI.cpp
> Window.cpp -lfltk -lfltk_images
Hmm, that's an interesting command line snippet; I'm guessing
the book shows something like that in its text?
From the above, it would appear the app you're trying to
compile depends on various other files.
I'm guessing the Makefile will be the most useful thing
you can paste us at this point.
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk