Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » stroustrup's examples compilation

This thread is locked; no one can reply to it. rss feed Print
stroustrup's examples compilation
William Labbett
Member #4,486
March 2004
avatar

Hi, I doing some exercises from Brian Sroustrup's book and I'm trying to compile a simple program but I get this :-

Quote:

C:\Users\0_0\Desktop\stroustrup exercises\a first example>g++ -o a_first_example
.exe a_first_example.cpp
In file included from GUI.h:10:0,
from Simple_window.h:10,
from a_first_example.cpp:4:
Window.h:12:19: fatal error: FL/Fl.H: No such file or directory
compilation terminated.

C:\Users\0_0\Desktop\stroustrup exercises\a first example>PAUSE
Press any key to continue . . .

I do have FL in the directory :

Quote:

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Users\0_0>cd C:\Users\0_0\Desktop\stroustrup exercises\a first example

C:\Users\0_0\Desktop\stroustrup exercises\a first example>dir
Volume in drive C has no label.
Volume Serial Number is C858-25BA

Directory of C:\Users\0_0\Desktop\stroustrup exercises\a first example

09/16/2011 03:32 PM <DIR> .
09/16/2011 03:32 PM <DIR> ..
09/16/2011 03:14 PM 415 a_first_example.cpp
09/16/2011 03:35 PM <DIR> FL
09/16/2011 01:58 PM 10,796 Graph.h
09/16/2011 01:58 PM 3,938 GUI.h
09/16/2011 01:58 PM 943 Simple_window.h
09/16/2011 01:58 PM 1,831 Window.h
09/16/2011 03:23 PM 54 wingbat.bat
6 File(s) 17,977 bytes
3 Dir(s) 264,983,412,736 bytes free

C:\Users\0_0\Desktop\stroustrup exercises\a first example>

Anyone know what I'm doing wrong ??

gnolam
Member #2,030
March 2002
avatar

Well, do you have Fl.H in said directory?

--
Move to the Democratic People's Republic of Vivendi Universal (formerly known as Sweden) - officially democracy- and privacy-free since 2008-06-18!

William Labbett
Member #4,486
March 2004
avatar

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Users\0_0>cd C:\Users\0_0\Desktop\stroustrup exercises\a first example

C:\Users\0_0\Desktop\stroustrup exercises\a first example>dir
Volume in drive C has no label.
Volume Serial Number is C858-25BA

Directory of C:\Users\0_0\Desktop\stroustrup exercises\a first example

09/16/2011 03:32 PM <DIR> .
09/16/2011 03:32 PM <DIR> ..
09/16/2011 03:14 PM 415 a_first_example.cpp
09/16/2011 03:35 PM <DIR> FL
09/16/2011 01:58 PM 10,796 Graph.h
09/16/2011 01:58 PM 3,938 GUI.h
09/16/2011 01:58 PM 943 Simple_window.h
09/16/2011 01:58 PM 1,831 Window.h
09/16/2011 03:23 PM 54 wingbat.bat
6 File(s) 17,977 bytes
3 Dir(s) 264,983,412,736 bytes free

C:\Users\0_0\Desktop\stroustrup exercises\a first example>cd FL

C:\Users\0_0\Desktop\stroustrup exercises\a first example\FL>dir
Volume in drive C has no label.
Volume Serial Number is C858-25BA

Directory of C:\Users\0_0\Desktop\stroustrup exercises\a first example\FL

09/16/2011 03:35 PM <DIR> .
09/16/2011 03:35 PM <DIR> ..
09/16/2011 01:57 PM 1,155 dirent.h
09/16/2011 01:57 PM 14,461 Enumerations.H
09/16/2011 01:57 PM 5,221 filename.H
09/16/2011 01:57 PM 10,019 Fl.H
09/16/2011 01:57 PM 1,538 Fl_Adjuster.H
09/16/2011 01:57 PM 2,942 fl_ask.H
09/16/2011 01:57 PM 2,107 Fl_Bitmap.H
09/16/2011 01:57 PM 1,286 Fl_BMP_Image.H
09/16/2011 01:57 PM 1,467 Fl_Box.H
09/16/2011 01:57 PM 3,982 Fl_Browser.H
09/16/2011 01:57 PM 5,500 Fl_Browser_.H
09/16/2011 01:57 PM 2,236 Fl_Button.H
09/16/2011 01:57 PM 2,769 Fl_Chart.H
09/16/2011 01:57 PM 3,025 Fl_Check_Browser.H
09/16/2011 01:57 PM 1,333 Fl_Check_Button.H
09/16/2011 01:57 PM 1,415 Fl_Choice.H
09/16/2011 01:57 PM 2,259 Fl_Clock.H
09/16/2011 01:57 PM 3,195 Fl_Color_Chooser.H
09/16/2011 01:57 PM 2,134 Fl_Counter.H
09/16/2011 01:57 PM 1,782 Fl_Dial.H
09/16/2011 01:57 PM 1,879 Fl_Double_Window.H
09/16/2011 01:57 PM 8,152 fl_draw.H
09/16/2011 01:57 PM 1,560 Fl_Export.H
09/16/2011 01:57 PM 2,283 Fl_File_Browser.H
09/16/2011 01:57 PM 6,258 Fl_File_Chooser.H
09/16/2011 01:57 PM 3,494 Fl_File_Icon.H
09/16/2011 01:57 PM 1,952 Fl_File_Input.H
09/16/2011 01:57 PM 1,334 Fl_Fill_Dial.H
09/16/2011 01:57 PM 1,358 Fl_Fill_Slider.H
09/16/2011 01:57 PM 1,359 Fl_Float_Input.H
09/16/2011 01:57 PM 1,498 Fl_FormsBitmap.H
09/16/2011 01:57 PM 1,495 Fl_FormsPixmap.H
09/16/2011 01:57 PM 1,870 Fl_Free.H
09/16/2011 01:57 PM 1,284 Fl_GIF_Image.H
09/16/2011 01:57 PM 2,841 Fl_Gl_Window.H
09/16/2011 01:57 PM 3,223 Fl_Group.H
09/16/2011 01:57 PM 2,669 Fl_Help_Dialog.H
09/16/2011 01:57 PM 6,818 Fl_Help_View.H
09/16/2011 01:57 PM 1,362 Fl_Hold_Browser.H
09/16/2011 01:57 PM 1,389 Fl_Hor_Fill_Slider.H
09/16/2011 01:57 PM 1,410 Fl_Hor_Nice_Slider.H
09/16/2011 01:57 PM 1,350 Fl_Hor_Slider.H
09/16/2011 01:57 PM 1,410 Fl_Hor_Value_Slider.H
09/16/2011 01:57 PM 3,584 Fl_Image.H
09/16/2011 01:57 PM 1,384 Fl_Input.H
09/16/2011 01:57 PM 4,742 Fl_Input_.H
09/16/2011 01:57 PM 5,706 Fl_Input_Choice.H
09/16/2011 01:57 PM 1,338 Fl_Int_Input.H
09/16/2011 01:57 PM 1,293 Fl_JPEG_Image.H
09/16/2011 01:57 PM 1,390 Fl_Light_Button.H
09/16/2011 01:57 PM 1,332 Fl_Line_Dial.H
09/16/2011 01:57 PM 1,168 Fl_Menu.H
09/16/2011 01:57 PM 3,305 Fl_Menu_.H
09/16/2011 01:57 PM 1,373 Fl_Menu_Bar.H
09/16/2011 01:57 PM 1,474 Fl_Menu_Button.H
09/16/2011 01:57 PM 5,788 Fl_Menu_Item.H
09/16/2011 01:57 PM 1,725 Fl_Menu_Window.H
09/16/2011 01:57 PM 1,124 fl_message.H
09/16/2011 01:57 PM 1,382 Fl_Multiline_Input.H
09/16/2011 01:57 PM 1,394 Fl_Multiline_Output.H
09/16/2011 01:57 PM 1,370 Fl_Multi_Browser.H
09/16/2011 01:57 PM 1,371 Fl_Multi_Label.H
09/16/2011 01:57 PM 1,375 Fl_Nice_Slider.H
09/16/2011 01:57 PM 1,251 Fl_Object.H
09/16/2011 01:57 PM 1,324 Fl_Output.H
09/16/2011 01:57 PM 1,868 Fl_Overlay_Window.H
09/16/2011 01:57 PM 1,496 Fl_Pack.H
09/16/2011 01:57 PM 2,817 Fl_Pixmap.H
09/16/2011 01:57 PM 1,286 Fl_PNG_Image.H
09/16/2011 01:57 PM 1,286 Fl_PNM_Image.H
09/16/2011 01:57 PM 2,251 Fl_Positioner.H
09/16/2011 01:57 PM 5,125 Fl_Preferences.H
09/16/2011 01:57 PM 1,727 Fl_Progress.H
09/16/2011 01:57 PM 1,359 Fl_Radio_Button.H
09/16/2011 01:57 PM 1,418 Fl_Radio_Light_Button.H
09/16/2011 01:57 PM 1,419 Fl_Radio_Round_Button.H
09/16/2011 01:57 PM 1,529 Fl_Repeat_Button.H
09/16/2011 01:57 PM 1,402 Fl_Return_Button.H
09/16/2011 01:57 PM 1,103 Fl_RGB_Image.H
09/16/2011 01:57 PM 1,355 Fl_Roller.H
09/16/2011 01:57 PM 1,333 Fl_Round_Button.H
09/16/2011 01:57 PM 1,367 Fl_Round_Clock.H
09/16/2011 01:57 PM 2,028 Fl_Scroll.H
09/16/2011 01:57 PM 1,684 Fl_Scrollbar.H
09/16/2011 01:57 PM 1,358 Fl_Secret_Input.H
09/16/2011 01:57 PM 1,378 Fl_Select_Browser.H
09/16/2011 01:57 PM 3,313 Fl_Shared_Image.H
09/16/2011 01:58 PM 1,232 fl_show_colormap.H
09/16/2011 01:58 PM 1,135 fl_show_input.H
09/16/2011 01:58 PM 1,381 Fl_Simple_Counter.H
09/16/2011 01:58 PM 1,550 Fl_Single_Window.H
09/16/2011 01:58 PM 2,172 Fl_Slider.H
09/16/2011 01:58 PM 6,215 Fl_Spinner.H
09/16/2011 01:58 PM 1,560 Fl_Sys_Menu_Bar.H
09/16/2011 01:58 PM 1,648 Fl_Tabs.H
09/16/2011 01:58 PM 11,572 Fl_Text_Buffer.H
09/16/2011 01:58 PM 11,999 Fl_Text_Display.H
09/16/2011 01:58 PM 4,150 Fl_Text_Editor.H
09/16/2011 01:58 PM 1,375 Fl_Tile.H
09/16/2011 01:58 PM 1,830 Fl_Tiled_Image.H
09/16/2011 01:58 PM 1,813 Fl_Timer.H
09/16/2011 01:58 PM 1,367 Fl_Toggle_Button.H
09/16/2011 01:58 PM 1,286 Fl_Toggle_Light_Button.H
09/16/2011 01:58 PM 1,286 Fl_Toggle_Round_Button.H
09/16/2011 01:58 PM 2,538 Fl_Tooltip.H
09/16/2011 01:58 PM 2,676 Fl_Valuator.H
09/16/2011 01:58 PM 2,066 Fl_Value_Input.H
09/16/2011 01:58 PM 1,811 Fl_Value_Output.H
09/16/2011 01:58 PM 1,723 Fl_Value_Slider.H
09/16/2011 01:58 PM 7,649 Fl_Widget.H
09/16/2011 01:58 PM 4,092 Fl_Window.H
09/16/2011 01:58 PM 1,473 Fl_Wizard.H
09/16/2011 01:58 PM 1,303 Fl_XBM_Image.H
09/16/2011 01:58 PM 1,301 Fl_XPM_Image.H
09/16/2011 01:58 PM 33,723 forms.H
09/16/2011 01:58 PM 2,796 gl.h
09/16/2011 01:58 PM 1,313 gl2opengl.h
09/16/2011 01:58 PM 1,682 glu.h
09/16/2011 01:58 PM 16,859 glut.H
09/16/2011 01:58 PM 1,159 gl_draw.H
09/16/2011 01:58 PM 4,703 mac.H
09/16/2011 01:58 PM 369 mac.r
09/16/2011 01:58 PM 2,015 Makefile.in
09/16/2011 01:58 PM 2,320 math.h
09/16/2011 01:58 PM 1,896 names.h
09/16/2011 01:58 PM 5,770 win32.H
09/16/2011 01:58 PM 5,084 x.H
127 File(s) 374,061 bytes
2 Dir(s) 264,979,820,544 bytes free

C:\Users\0_0\Desktop\stroustrup exercises\a first example\FL>

EDIT : it's looking for FL/.. in the compiler include dir :-/ Sorry about that.

torhu
Member #2,727
September 2002
avatar

You can use quotes when including, instead of < and >. Then you can keep it in a subdir of your project dir. There's also the -I switch.

#include "FL/fl.h"

or whatever.

William Labbett
Member #4,486
March 2004
avatar

Cheers.

Does anyone recognise the library I need to link to to get these functions ? :

C:\Users\0_0\Desktop\stroustrup exercises\a first example>g++ -o a_first_example
.exe a_first_example.cpp -lbookgui -lfltk -lfltk_forms -lfltk_gl -lfltk_images -
lfltk_zlib -lgdi32
In file included from c:\mingw\bin\../lib/gcc/mingw32/4.5.0/include/c++/ext/hash
_map:60:0,
from std_lib_facilities.h:34,
from Graph.h:13,
from GUI.h:11,
from Simple_window.h:10,
from a_first_example.cpp:4:
c:\mingw\bin\../lib/gcc/mingw32/4.5.0/include/c++/backward/backward_warning.h:28
:2: warning: #warning This file includes at least one deprecated or antiquated h
eader which may be removed without further notice at a future date. Please use a
non-deprecated interface with equivalent functionality instead. For a listing o
f replacement headers and interfaces, consult the file backward_warning.h. To di
sable this warning use -Wno-deprecated.
Info: resolving vtable for __cxxabiv1::__si_class_type_info by linking to _imp
__ZTVN10__cxxabiv120__si_class_type_infoE (auto-import)
Info: resolving vtable for __cxxabiv1::__class_type_info by linking to __imp___Z
TVN10__cxxabiv117__class_type_infoE (auto-import)
c:/mingw/bin/../lib/gcc/mingw32/4.5.0/../../../../mingw32/bin/ld.exe: warning: a
uto-importing has been activated without --enable-auto-import specified on the c
ommand line.
This should work unless it involves constant data structures referencing symbols
from auto-imported DLLs.
C:\Users\0_0\AppData\Local\Temp\ccvmpedB.o:a_first_example.cpp:(.text+0x81): und
efined reference to `Simple_window::Simple_window(Point, int, int, String const&
)'
C:\Users\0_0\AppData\Local\Temp\ccvmpedB.o:a_first_example.cpp:(.text+0xe3): und
efined reference to `Graph_lib::Polygon::add(Point)'
C:\Users\0_0\AppData\Local\Temp\ccvmpedB.o:a_first_example.cpp:(.text+0x127): un
defined reference to `Graph_lib::Polygon::add(Point)'
C:\Users\0_0\AppData\Local\Temp\ccvmpedB.o:a_first_example.cpp:(.text+0x16b): un
defined reference to `Graph_lib::Polygon::add(Point)'
C:\Users\0_0\AppData\Local\Temp\ccvmpedB.o:a_first_example.cpp:(.text+0x1ca): un
defined reference to `Simple_window::wait_for_button()'
C:\Users\0_0\AppData\Local\Temp\ccvmpedB.o:a_first_example.cpp:(.text$_ZN9Graph_
lib6WindowD2Ev[Graph_lib::Window::~Window()]+0xc): undefined reference to `vtabl
e for Graph_lib::Window'
C:\Users\0_0\AppData\Local\Temp\ccvmpedB.o:a_first_example.cpp:(.text$_ZN9Graph_
lib5ShapeD2Ev[Graph_lib::Shape::~Shape()]+0xb): undefined reference to `vtable f
or Graph_lib::Shape'
C:\Users\0_0\AppData\Local\Temp\ccvmpedB.o:a_first_example.cpp:(.text$_ZN9Graph_
lib13Open_polylineC2Ev[Graph_lib::Open_polyline::Open_polyline()]+0xd): undefine
d reference to `Graph_lib::Shape::Shape()'
C:\Users\0_0\AppData\Local\Temp\ccvmpedB.o:a_first_example.cpp:(.text$_ZN9Graph_
lib13Open_polylineC2Ev[Graph_lib::Open_polyline::Open_polyline()]+0x16): undefin
ed reference to `vtable for Graph_lib::Open_polyline'
C:\Users\0_0\AppData\Local\Temp\ccvmpedB.o:a_first_example.cpp:(.text$_ZN9Graph_
lib13Open_polylineD2Ev[Graph_lib::Open_polyline::~Open_polyline()]+0xb): undefin
ed reference to `vtable for Graph_lib::Open_polyline'
C:\Users\0_0\AppData\Local\Temp\ccvmpedB.o:a_first_example.cpp:(.text$_ZN9Graph_
lib6ButtonD1Ev[Graph_lib::Button::~Button()]+0xb): undefined reference to `vtabl
e for Graph_lib::Button'
C:\Users\0_0\AppData\Local\Temp\ccvmpedB.o:a_first_example.cpp:(.text$_ZN9Graph_
lib15Closed_polylineC2Ev[Graph_lib::Closed_polyline::Closed_polyline()]+0x16): u
ndefined reference to `vtable for Graph_lib::Closed_polyline'
C:\Users\0_0\AppData\Local\Temp\ccvmpedB.o:a_first_example.cpp:(.text$_ZN9Graph_
lib15Closed_polylineD2Ev[Graph_lib::Closed_polyline::~Closed_polyline()]+0xb): u
ndefined reference to `vtable for Graph_lib::Closed_polyline'
C:\Users\0_0\AppData\Local\Temp\ccvmpedB.o:a_first_example.cpp:(.text$_ZN9Graph_
lib7PolygonC1Ev[Graph_lib::Polygon::Polygon()]+0x16): undefined reference to `vt
able for Graph_lib::Polygon'
C:\Users\0_0\AppData\Local\Temp\ccvmpedB.o:a_first_example.cpp:(.text$_ZN9Graph_
lib7PolygonD1Ev[Graph_lib::Polygon::~Polygon()]+0xb): undefined reference to `vt
able for Graph_lib::Polygon'
C:\Users\0_0\AppData\Local\Temp\ccvmpedB.o:a_first_example.cpp:(.rdata$_ZTV13Sim
ple_window[vtable for Simple_window]+0x10): undefined reference to `Graph_lib::W
indow::draw()'
c:/mingw/bin/../lib/gcc/mingw32/4.5.0/../../../libfltk.a(Fl.obj):Fl.cxx:(.text+0
x24fe): undefined reference to `select@20'
c:/mingw/bin/../lib/gcc/mingw32/4.5.0/../../../libfltk.a(Fl.obj):Fl.cxx:(.text+0
x2547): undefined reference to `__WSAFDIsSet@8'
c:/mingw/bin/../lib/gcc/mingw32/4.5.0/../../../libfltk.a(Fl.obj):Fl.cxx:(.text+0
x2573): undefined reference to `__WSAFDIsSet@8'
c:/mingw/bin/../lib/gcc/mingw32/4.5.0/../../../libfltk.a(Fl.obj):Fl.cxx:(.text+0
x259f): undefined reference to `__WSAFDIsSet@8'
c:/mingw/bin/../lib/gcc/mingw32/4.5.0/../../../libfltk.a(Fl.obj):Fl.cxx:(.text+0
x2961): undefined reference to `select@20'
c:/mingw/bin/../lib/gcc/mingw32/4.5.0/../../../libfltk.a(Fl.obj):Fl.cxx:(.text+0
x5126): undefined reference to `OleInitialize@4'
c:/mingw/bin/../lib/gcc/mingw32/4.5.0/../../../libfltk.a(Fl.obj):Fl.cxx:(.text+0
x5147): undefined reference to `RegisterDragDrop@8'
c:/mingw/bin/../lib/gcc/mingw32/4.5.0/../../../libfltk.a(Fl.obj):Fl.cxx:(.text$_
ZN16Fl_Win32_At_ExitD1Ev[Fl_Win32_At_Exit::~Fl_Win32_At_Exit()]+0x11): undefined
reference to `OleUninitialize@0'
c:/mingw/bin/../lib/gcc/mingw32/4.5.0/../../../libfltk.a(fl_dnd.obj):fl_dnd.cxx:
(.text+0x89): undefined reference to `DoDragDrop@16'
c:/mingw/bin/../lib/gcc/mingw32/4.5.0/../../../libfltk.a(fl_dnd.obj):fl_dnd.cxx:
(.text$_ZN12FLDropTarget14QueryInterfaceERK5_GUIDPPv+0x10): undefined reference
to `IID_IUnknown'
c:/mingw/bin/../lib/gcc/mingw32/4.5.0/../../../libfltk.a(fl_dnd.obj):fl_dnd.cxx:
(.text$_ZN12FLDropTarget14QueryInterfaceERK5_GUIDPPv+0x27): undefined reference
to `IID_IDropTarget'
c:/mingw/bin/../lib/gcc/mingw32/4.5.0/../../../libfltk.a(fl_dnd.obj):fl_dnd.cxx:
(.text$_ZN12FLDropTarget19fillCurrentDragDataEP11IDataObject[FLDropTarget::fillC
urrentDragData(IDataObject*)]+0xde): undefined reference to `ReleaseStgMedium@4'

c:/mingw/bin/../lib/gcc/mingw32/4.5.0/../../../libfltk.a(fl_dnd.obj):fl_dnd.cxx:
(.text$_ZN12FLDropTarget19fillCurrentDragDataEP11IDataObject[FLDropTarget::fillC
urrentDragData(IDataObject*)]+0x267): undefined reference to `ReleaseStgMedium@4
'
c:/mingw/bin/../lib/gcc/mingw32/4.5.0/../../../libfltk.a(fl_dnd.obj):fl_dnd.cxx:
(.text$_ZN12FLDropSource14QueryInterfaceERK5_GUIDPPv+0x10): undefined reference
to `IID_IUnknown'
c:/mingw/bin/../lib/gcc/mingw32/4.5.0/../../../libfltk.a(fl_dnd.obj):fl_dnd.cxx:
(.text$_ZN12FLDropSource14QueryInterfaceERK5_GUIDPPv+0x27): undefined reference
to `IID_IDropSource'
c:/mingw/bin/../lib/gcc/mingw32/4.5.0/../../../libfltk.a(fl_dnd.obj):fl_dnd.cxx:
(.text$_ZN12FLDataObject14QueryInterfaceERK5_GUIDPPv+0x10): undefined reference
to `IID_IUnknown'
c:/mingw/bin/../lib/gcc/mingw32/4.5.0/../../../libfltk.a(fl_dnd.obj):fl_dnd.cxx:
(.text$_ZN12FLDataObject14QueryInterfaceERK5_GUIDPPv+0x27): undefined reference
to `IID_IDataObject'
collect2: ld returned 1 exit status

C:\Users\0_0\Desktop\stroustrup exercises\a first example>PAUSE
Press any key to continue . . .

Neil Walker
Member #210
April 2000
avatar

does it know where to go to find these headers/lib files? i.e. is the folder before FL in your include path?

Neil.
MAME Cabinet Blog / AXL LIBRARY (a games framework) / AXL Documentation and Tutorial

wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie

William Labbett
Member #4,486
March 2004
avatar

I've put the files in gcc include dir now so that's not a problem anymore.

I'm still having trouble compiling the example though. Can someone help ?

I get this from g++ :

C:\Users\0_0\Desktop\stroustrup exercises\a first example>g++ -o a_first_example
.exe a_first_example.cpp GUI.cpp Simple_window.cpp Graph.cpp Window.cpp -lbookgu
i -lfltk -lfltk_images -lfltk_jpeg -lfltk_png -lgdi32 -luuid -lwininet -lole32 -
lwinmm -lshell32 -lvfw32 -lrpcrt4
g++: GUI.cpp: No such file or directory
In file included from c:\mingw\bin\../lib/gcc/mingw32/4.5.0/include/c++/ext/hash
_map:60:0,
from std_lib_facilities.h:34,
from Graph.h:13,
from a_first_example.cpp:2:
c:\mingw\bin\../lib/gcc/mingw32/4.5.0/include/c++/backward/backward_warning.h:28
:2: warning: #warning This file includes at least one deprecated or antiquated h
eader which may be removed without further notice at a future date. Please use a
non-deprecated interface with equivalent functionality instead. For a listing o
f replacement headers and interfaces, consult the file backward_warning.h. To di
sable this warning use -Wno-deprecated.
In file included from c:\mingw\bin\../lib/gcc/mingw32/4.5.0/include/c++/ext/hash
_map:60:0,
from std_lib_facilities.h:34,
from Graph.h:13,
from GUI.h:11,
from Simple_window.h:10,
from Simple_window.cpp:7:
c:\mingw\bin\../lib/gcc/mingw32/4.5.0/include/c++/backward/backward_warning.h:28
:2: warning: #warning This file includes at least one deprecated or antiquated h
eader which may be removed without further notice at a future date. Please use a
non-deprecated interface with equivalent functionality instead. For a listing o
f replacement headers and interfaces, consult the file backward_warning.h. To di
sable this warning use -Wno-deprecated.
In file included from c:\mingw\bin\../lib/gcc/mingw32/4.5.0/include/c++/ext/hash
_map:60:0,
from std_lib_facilities.h:34,
from Graph.h:13,
from Graph.cpp:9:
c:\mingw\bin\../lib/gcc/mingw32/4.5.0/include/c++/backward/backward_warning.h:28
:2: warning: #warning This file includes at least one deprecated or antiquated h
eader which may be removed without further notice at a future date. Please use a
non-deprecated interface with equivalent functionality instead. For a listing o
f replacement headers and interfaces, consult the file backward_warning.h. To di
sable this warning use -Wno-deprecated.
Graph.cpp: In function 'Graph_lib::Suffix::Encoding Graph_lib::get_encoding(cons
t String&)':
Graph.cpp:394:43: error: 'strlen' was not declared in this scope
In file included from c:\mingw\bin\../lib/gcc/mingw32/4.5.0/include/c++/ext/hash
_map:60:0,
from std_lib_facilities.h:34,
from Graph.h:13,
from Window.cpp:8:
c:\mingw\bin\../lib/gcc/mingw32/4.5.0/include/c++/backward/backward_warning.h:28
:2: warning: #warning This file includes at least one deprecated or antiquated h
eader which may be removed without further notice at a future date. Please use a
non-deprecated interface with equivalent functionality instead. For a listing o
f replacement headers and interfaces, consult the file backward_warning.h. To di
sable this warning use -Wno-deprecated.
Window.cpp:15:1: error: prototype for 'Graph_lib::Window::Window(int, int, const
String&)' does not match any in class 'Graph_lib::Window'
Window.h:26:37: error: candidates are: Graph_lib::Window::Window(const Graph_lib
::Window&)
Window.h:31:9: error: Graph_lib::Window::Window(Point, int, int,
const std::string&)
Window.h:29:9: error: Graph_lib::Window::Window(int, int, const
std::string&)
Window.cpp:23:1: error: prototype for 'Graph_lib::Window::Window(Point, int, int
, const String&)' does not match any in class 'Graph_lib::Window'
Window.h:26:37: error: candidates are: Graph_lib::Window::Window(const Graph_lib
::Window&)
Window.h:31:9: error: Graph_lib::Window::Window(Point, int, int,
const std::string&)
Window.h:29:9: error: Graph_lib::Window::Window(int, int, const
std::string&)

C:\Users\0_0\Desktop\stroustrup exercises\a first example>PAUSE
Press any key to continue . . .

I don't understand it because in Window.h I've got :

namespace Graph_lib
{
    class Shape;   // "forward declare" Shape
    class Widget;

//------------------------------------------------------------------------------

    class Window : public Fl_Window { 
    public:
        // let the system pick the location:
        Window(int w, int h, const string& title);
        // top left corner in xy
        Window(Point xy, int w, int h, const string& title);

and the prototype is here :

#SelectExpand
1 2namespace Graph_lib { 3 4Window::Window(int ww, int hh, const string& title) 5 :Fl_Window(ww,hh,title.c_str()),w(ww),h(hh) 6{ 7 init(); 8} 9 10//------------------------------------------------------------------------------ 11 12Window::Window(Point xy, int ww, int hh, const string& title) 13 :Fl_Window(xy.x,xy.y,ww,hh,title.c_str()),w(ww),h(hh) 14{ 15 init(); 16} 17 18//------------------------------------------------------------------------------ 19 20void Window::init() 21{ 22 resizable(this); 23 show(); 24}

Johan Halmén
Member #1,550
September 2001

I think your problem is that you mix C and C++.

Hi, I doing some exercises from Brian Sroustrup's book and...

It's Brian Kernighan (C)
And it's Bjarne Stroustrup (C++)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Years of thorough research have revealed that the red "x" that closes a window, really isn't red, but white on red background.

Years of thorough research have revealed that what people find beautiful about the Mandelbrot set is not the set itself, but all the rest.

William Labbett
Member #4,486
March 2004
avatar

Yep, got that wrong.

EDIT: it seems a bit poor that the examples don't compile.

torhu
Member #2,727
September 2002
avatar

This bit looks important :P

Quote:

g++: GUI.cpp: No such file or directory

EDIT: It think you're supposed to use the files here: http://stroustrup.com/Programming/Graphics/

I've actually got the book, I wanted to see how Stroustrup himself presents C++ in a teaching context.

William Labbett
Member #4,486
March 2004
avatar

Thanks torhu,

I fixed that problem but I still get this :-

C:\Users\0_0\Desktop\stroustrup exercises\a first example>g++ -o a_first_example
.exe GUI.cpp Simple_window.cpp Graph.cpp Window.cpp
In file included from c:\mingw\bin\../lib/gcc/mingw32/4.5.0/include/c++/ext/hash
_map:60:0,
from std_lib_facilities.h:34,
from Graph.h:13,
from GUI.h:11,
from GUI.cpp:10:
c:\mingw\bin\../lib/gcc/mingw32/4.5.0/include/c++/backward/backward_warning.h:28
:2: warning: #warning This file includes at least one deprecated or antiquated h
eader which may be removed without further notice at a future date. Please use a
non-deprecated interface with equivalent functionality instead. For a listing o
f replacement headers and interfaces, consult the file backward_warning.h. To di
sable this warning use -Wno-deprecated.
In file included from c:\mingw\bin\../lib/gcc/mingw32/4.5.0/include/c++/ext/hash
_map:60:0,
from std_lib_facilities.h:34,
from Graph.h:13,
from GUI.h:11,
from Simple_window.h:10,
from Simple_window.cpp:7:
c:\mingw\bin\../lib/gcc/mingw32/4.5.0/include/c++/backward/backward_warning.h:28
:2: warning: #warning This file includes at least one deprecated or antiquated h
eader which may be removed without further notice at a future date. Please use a
non-deprecated interface with equivalent functionality instead. For a listing o
f replacement headers and interfaces, consult the file backward_warning.h. To di
sable this warning use -Wno-deprecated.
In file included from c:\mingw\bin\../lib/gcc/mingw32/4.5.0/include/c++/ext/hash
_map:60:0,
from std_lib_facilities.h:34,
from Graph.h:13,
from Graph.cpp:10:
c:\mingw\bin\../lib/gcc/mingw32/4.5.0/include/c++/backward/backward_warning.h:28
:2: warning: #warning This file includes at least one deprecated or antiquated h
eader which may be removed without further notice at a future date. Please use a
non-deprecated interface with equivalent functionality instead. For a listing o
f replacement headers and interfaces, consult the file backward_warning.h. To di
sable this warning use -Wno-deprecated.
In file included from c:\mingw\bin\../lib/gcc/mingw32/4.5.0/include/c++/ext/hash
_map:60:0,
from std_lib_facilities.h:34,
from Graph.h:13,
from Window.cpp:10:
c:\mingw\bin\../lib/gcc/mingw32/4.5.0/include/c++/backward/backward_warning.h:28
:2: warning: #warning This file includes at least one deprecated or antiquated h
eader which may be removed without further notice at a future date. Please use a
non-deprecated interface with equivalent functionality instead. For a listing o
f replacement headers and interfaces, consult the file backward_warning.h. To di
sable this warning use -Wno-deprecated.
Window.cpp:16:12: error: 'std::String' has not been declared
Window.cpp:20:1: error: prototype for 'Graph_lib::Window::Window(int, int, const
String&)' does not match any in class 'Graph_lib::Window'
Window.h:26:37: error: candidates are: Graph_lib::Window::Window(const Graph_lib
::Window&)
Window.h:31:9: error: Graph_lib::Window::Window(Point, int, int,
const std::string&)
Window.h:29:9: error: Graph_lib::Window::Window(int, int, const
std::string&)
Window.cpp:28:1: error: prototype for 'Graph_lib::Window::Window(Point, int, int
, const String&)' does not match any in class 'Graph_lib::Window'
Window.h:26:37: error: candidates are: Graph_lib::Window::Window(const Graph_lib
::Window&)
Window.h:31:9: error: Graph_lib::Window::Window(Point, int, int,
const std::string&)
Window.h:29:9: error: Graph_lib::Window::Window(int, int, const
std::string&)

C:\Users\0_0\Desktop\stroustrup exercises\a first example>PAUSE
Press any key to continue . . .

EDIT : I've looked on the google group and loads of people had problems with this stuff, so I'm going to skip it and just read the book, unless someone works it out for me here.

torhu
Member #2,727
September 2002
avatar

Quote:

Window.cpp:16:12: error: 'std::String' has not been declared

Should probably be std::string.

Would be easier to read the error messages if you compile with -Wno-deprecated.

William Labbett
Member #4,486
March 2004
avatar

okay.

C:\Users\0_0\Desktop\stroustrup exercises\a first example>g++ -Wno-deprecated -o
a_first_example.exe GUI.cpp Simple_window.cpp Graph.cpp Window.cpp
Window.cpp:16:12: error: 'std::String' has not been declared
Window.cpp:20:1: error: prototype for 'Graph_lib::Window::Window(int, int, const
String&)' does not match any in class 'Graph_lib::Window'
Window.h:26:37: error: candidates are: Graph_lib::Window::Window(const Graph_lib
::Window&)
Window.h:31:9: error: Graph_lib::Window::Window(Point, int, int,
const std::string&)
Window.h:29:9: error: Graph_lib::Window::Window(int, int, const
std::string&)
Window.cpp:28:1: error: prototype for 'Graph_lib::Window::Window(Point, int, int
, const String&)' does not match any in class 'Graph_lib::Window'
Window.h:26:37: error: candidates are: Graph_lib::Window::Window(const Graph_lib
::Window&)
Window.h:31:9: error: Graph_lib::Window::Window(Point, int, int,
const std::string&)
Window.h:29:9: error: Graph_lib::Window::Window(int, int, const
std::string&)

C:\Users\0_0\Desktop\stroustrup exercises\a first example>PAUSE
Press any key to continue . . .

I don't know why the capital 's' is there : the code's like this :

#SelectExpand
1#include<string> 2#include <sstream> 3#include "Window.h" 4#include "Graph.h" 5#include "GUI.h" 6 7//------------------------------------------------------------------------------ 8 9 10using std::string; 11 12namespace Graph_lib { 13 14Window::Window(int ww, int hh, const string& title) 15 :Fl_Window(ww,hh,title.c_str()),w(ww),h(hh) 16{ 17 init(); 18}

I added the using std::string line to see if would fix the errors.

<code>

verthex
Member #11,340
September 2009
avatar

Believe it or not William you can usually type the errors you have into google and just solve your problem with that.

Johan Halmén
Member #1,550
September 2001

Yes, I use that a lot.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Years of thorough research have revealed that the red "x" that closes a window, really isn't red, but white on red background.

Years of thorough research have revealed that what people find beautiful about the Mandelbrot set is not the set itself, but all the rest.

Neil Walker
Member #210
April 2000
avatar

verthex said:

you can usually type the errors you have into google

I didn't believe you at first, but then I tried it. It works :o http://tinyurl.com/3btossx

Neil.
MAME Cabinet Blog / AXL LIBRARY (a games framework) / AXL Documentation and Tutorial

wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie

Arthur Kalliokoski
Second in Command
February 2005
avatar

That answer doesn't work with my problem at all! >:(

They all watch too much MSNBC... they get ideas.

verthex
Member #11,340
September 2009
avatar

That answer doesn't work with my problem at all! >:(

Its not always a sure shot but its good at least 1/10th of the time.
Unless you end up on slashdot!

I didn't believe you at first, but then I tried it. It works :o http://tinyurl.com/3btossx

And usually use quotation marks around your search.

"undefined reference to IID_IDataObject"

Go to: