LNK2019 error - PPP chapter 16 Drill

I'm going through Bjarne Stroustrup's Programming Principles and practice and have reached chapter 16, which is the introduction of callbacks.
The Drill at the end of the chapter have you recreate a Line Drawing Program from the chapter. I managed to get the first iteration to run, which only includes the use of a few widgets (Inbox, Outbox and buttons), but in the second iteration, (which adds a menu to the program) I started getting LNK2019 errors in VS. Without a menu object, the program runs, but as soon as I add a menu data member to my Window class Lines_window it requires a default constructor, which addition results in the aforementioned error.

Error message: https://pastebin.com/xVX47Vpb


Before someone asks, I've linked the fltk Library Directories and Additional Include Directories to all configurations and the Additional Dependencies for Debug and Release configurations.
Additionally, I've added the header files:
fltk.h: https://pastebin.com/ERTYT2nY
Graph.h: https://pastebin.com/0x4SpYgk
GUI.h: https://pastebin.com/LwPtnCRA
Point.h: https://pastebin.com/hufZxEVs
std_lib_facilities.h: https://pastebin.com/nQMgaZVK
Window.h: https://pastebin.com/1a7gmLWi
Lines_window.h: https://pastebin.com/8jMbbRiR

As well as the source files:
Graph.cpp: https://pastebin.com/rpu26nTb
Window.cpp: https://pastebin.com/0c3scGLQ
GUI.cpp: https://pastebin.com/diPFLSNJ
C16_main.cpp: https://pastebin.com/RCuQyrdd
Lines_window.cpp: https://pastebin.com/m1sGPKAB

EDIT: Link to Github repository containing header and source files as well as the error message: https://github.com/tattermunge/Lines_window

I know much of this is irrelevant, but since I've made some changes to the original files, I thought it would be best if I linked all of them, just to be on the safe side.
If someone could help me decipher and locate the problem, it would be much appreciated.


Last edited on
can't use pastebin, ¿mind to upload it to github?
also, paste your build command
can't use pastebin, ¿mind to upload it to github?
also, paste your build command


I've created a Github repository, the link is in the OP. Not sure what my build command is though?
Last edited on
C16_main.cpp:1:9: fatal error: ../../lib_files/Lines_window_2.h: No such file or directory
fltk.h:13:10: fatal error: Fl/Fl_JPEG_Image.H: No such file or directory
My_Graph_lib.cpp:1:10: fatal error: My_Graph_lib.h: No such file or directory


about your unresolved reference error http://www.cplusplus.com/forum/general/113904/
it complains that the implementation of Menu(Point xy, int w, int h, Kind kk, const string& s); doesn't exist.
that function is commented out in GUI.cpp lines 55--58, ¿why?

> Not sure what my build command is though?
https://docs.microsoft.com/en-us/visualstudio/ide/how-to-view-save-and-configure-build-log-files?view=vs-2019 (I hope that that shows the command used and not only their output)
C16_main.cpp:1:9: fatal error: ../../lib_files/Lines_window_2.h: No such file or directory
fltk.h:13:10: fatal error: Fl/Fl_JPEG_Image.H: No such file or directory
My_Graph_lib.cpp:1:10: fatal error: My_Graph_lib.h: No such file or directory

Sorry about that, Lines_window_2.h was my attempt to locate the problem by recreating the program step by step. That was the way I determined it was related to the Menu class.

about your unresolved reference error http://www.cplusplus.com/forum/general/113904/
it complains that the implementation of Menu(Point xy, int w, int h, Kind kk, const string& s); doesn't exist.
that function is commented out in GUI.cpp lines 55--58, ¿why?

I honestly have no idea, as I can think of no reason why I would comment it out. I suspect I got the files from a secondary source, since when I download the header from the books website(http://www.stroustrup.com/Programming/PPP2code/), it isn't commented out.
And sure enough, when I run the program with the uncommented Menu constructor, the compiler builds the program without any apparent issues.

I've added the build commands (one with the commented constructor and one without) to the Github repository in case you are still interested.

I guess I should have found the commented constructor suspicious, but since I thought that it was done on purpose by the author(s), I was reluctant to make any changes as a beginner.

In any case, it seems you have solved my problem, for which I am very grateful.
So until next time, have a nice day ;)
Last edited on
Topic archived. No new replies allowed.