Trying to Run fltk but would get undefined error

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








up vote
0
down vote

favorite












I am trying to compile a old programming assignment and when using my schools server it compiles without error and still works now. I am trying to compile on my home computer but would give me this error when I make:



g++ -std=c++11 -c -o Graph.o Graph.cpp
g++ -std=c++11 -c -o GUI.o GUI.cpp
g++ -std=c++11 -c -o Simple_window.o Simple_window.cpp
g++ -std=c++11 -c -o Window.o Window.cpp
g++ -std=c++11 -lfltk -lfltk_images sample_main4.cpp Graph.o GUI.o Simple_window.o Window.o

/tmp/ccshmUhR.o: In function `Graph_lib::Window::~Window()':
sample_main4.cpp:(.text._ZN9Graph_lib6WindowD2Ev[_ZN9Graph_lib6WindowD5Ev]+0x31): undefined reference to `Fl_Window::~Fl_Window()'
/tmp/ccshmUhR.o:(.rodata._ZTV13Simple_window[_ZTV13Simple_window]+0x28): undefined reference to `Fl_Window::handle(int)'
/tmp/ccshmUhR.o:(.rodata._ZTV13Simple_window[_ZTV13Simple_window]+0x30): undefined reference to `Fl_Window::resize(int, int, int, int)'
/tmp/ccshmUhR.o:(.rodata._ZTV13Simple_window[_ZTV13Simple_window]+0x38): undefined reference to `Fl_Window::show()'
/tmp/ccshmUhR.o:(.rodata._ZTV13Simple_window[_ZTV13Simple_window]+0x40): undefined reference to `Fl_Window::hide()'
/tmp/ccshmUhR.o:(.rodata._ZTV13Simple_window[_ZTV13Simple_window]+0x60): undefined reference to `Fl_Window::flush()'
Graph.o: In function `Graph_lib::draw_mark(Point, char)':
Graph.cpp:(.text+0xb9e): undefined reference to `fl_draw(char const*, int, int)'
Graph.o: In function `Graph_lib::Text::draw_lines() const':
Graph.cpp:(.text+0x1223): undefined reference to `fl_draw(char const*, int, int)'
Graph.o: In function `Graph_lib::Image::Image(Point, String, Graph_lib::Suffix::Encoding)':
Graph.cpp:(.text+0x1dbc): undefined reference to `Fl_JPEG_Image::Fl_JPEG_Image(char const*)'
Graph.cpp:(.text+0x1df6): undefined reference to `Fl_GIF_Image::Fl_GIF_Image(char const*)'
Graph.o: In function `Fl_Image::Fl_Image(int, int, int)':
Graph.cpp:(.text._ZN8Fl_ImageC2Eiii[_ZN8Fl_ImageC5Eiii]+0x12): undefined reference to `vtable for Fl_Image'
Graph.o: In function `fl_color(unsigned int)':
Graph.cpp:(.text._Z8fl_colorj[_Z8fl_colorj]+0xe): undefined reference to `fl_graphics_driver'
Graph.cpp:(.text._Z8fl_colorj[_Z8fl_colorj]+0x21): undefined reference to `fl_graphics_driver'
Graph.o: In function `fl_color()':
Graph.cpp:(.text._Z8fl_colorv[_Z8fl_colorv]+0x7): undefined reference to `fl_graphics_driver'
Graph.o: In function `fl_line_style(int, int, char*)':
Graph.cpp:(.text._Z13fl_line_styleiiPc[_Z13fl_line_styleiiPc]+0x15): undefined reference to `fl_graphics_driver'
Graph.cpp:(.text._Z13fl_line_styleiiPc[_Z13fl_line_styleiiPc]+0x26): undefined reference to `fl_graphics_driver'
Graph.o:Graph.cpp:(.text._Z7fl_rectiiii[_Z7fl_rectiiii]+0x17): more undefined references to `fl_graphics_driver' follow
Graph.o: In function `Graph_lib::Bad_image::draw(int, int, int, int, int, int)':
Graph.cpp:(.text._ZN9Graph_lib9Bad_image4drawEiiiiii[_ZN9Graph_lib9Bad_image4drawEiiiiii]+0x2d): undefined reference to `Fl_Image::draw_empty(int, int)'
Graph.o:(.rodata._ZTVN9Graph_lib9Bad_imageE[_ZTVN9Graph_lib9Bad_imageE]+0x20): undefined reference to `Fl_Image::copy(int, int)'
Graph.o:(.rodata._ZTVN9Graph_lib9Bad_imageE[_ZTVN9Graph_lib9Bad_imageE]+0x28): undefined reference to `Fl_Image::color_average(unsigned int, float)'
Graph.o:(.rodata._ZTVN9Graph_lib9Bad_imageE[_ZTVN9Graph_lib9Bad_imageE]+0x30): undefined reference to `Fl_Image::desaturate()'
Graph.o:(.rodata._ZTVN9Graph_lib9Bad_imageE[_ZTVN9Graph_lib9Bad_imageE]+0x38): undefined reference to `Fl_Image::label(Fl_Widget*)'
Graph.o:(.rodata._ZTVN9Graph_lib9Bad_imageE[_ZTVN9Graph_lib9Bad_imageE]+0x40): undefined reference to `Fl_Image::label(Fl_Menu_Item*)'
Graph.o:(.rodata._ZTVN9Graph_lib9Bad_imageE[_ZTVN9Graph_lib9Bad_imageE]+0x50): undefined reference to `Fl_Image::uncache()'
Graph.o: In function `Graph_lib::Bad_image::~Bad_image()':
Graph.cpp:(.text._ZN9Graph_lib9Bad_imageD2Ev[_ZN9Graph_lib9Bad_imageD5Ev]+0x20): undefined reference to `Fl_Image::~Fl_Image()'
Graph.o:(.rodata._ZTIN9Graph_lib9Bad_imageE[_ZTIN9Graph_lib9Bad_imageE]+0x10): undefined reference to `typeinfo for Fl_Image'
GUI.o: In function `Graph_lib::Button::attach(Graph_lib::Window&)':
GUI.cpp:(.text+0x5b): undefined reference to `Fl_Button::Fl_Button(int, int, int, int, char const*)'
GUI.o: In function `Graph_lib::In_box::attach(Graph_lib::Window&)':
GUI.cpp:(.text+0x1b3): undefined reference to `Fl_Input::Fl_Input(int, int, int, int, char const*)'
GUI.o: In function `Graph_lib::Out_box::put(String const&)':
GUI.cpp:(.text+0x229): undefined reference to `Fl_Input_::value(char const*)'
GUI.o: In function `Graph_lib::Out_box::attach(Graph_lib::Window&)':
GUI.cpp:(.text+0x291): undefined reference to `Fl_Output::Fl_Output(int, int, int, int, char const*)'
Simple_window.o: In function `Simple_window::wait_for_button()':
Simple_window.cpp:(.text+0x160): undefined reference to `Fl::wait()'
Simple_window.cpp:(.text+0x167): undefined reference to `Fl::redraw()'
Window.o: In function `Graph_lib::Window::Window(int, int, String const&)':
Window.cpp:(.text+0x34): undefined reference to `Fl_Window::Fl_Window(int, int, char const*)'
Window.cpp:(.text+0x9b): undefined reference to `Fl_Window::~Fl_Window()'
Window.o: In function `Graph_lib::Window::Window(Point, int, int, String const&)':
Window.cpp:(.text+0xf6): undefined reference to `Fl_Window::Fl_Window(int, int, int, int, char const*)'
Window.cpp:(.text+0x15d): undefined reference to `Fl_Window::~Fl_Window()'
Window.o: In function `Graph_lib::Window::draw()':
Window.cpp:(.text+0x1c3): undefined reference to `Fl_Window::draw()'
Window.o: In function `Graph_lib::Window::attach(Graph_lib::Widget&)':
Window.cpp:(.text+0x236): undefined reference to `Fl_Group::begin()'
Window.cpp:(.text+0x260): undefined reference to `Fl_Group::end()'
Window.o: In function `Graph_lib::gui_main()':
Window.cpp:(.text+0x47b): undefined reference to `Fl::run()'
Window.o:(.rodata._ZTVN9Graph_lib6WindowE[_ZTVN9Graph_lib6WindowE]+0x28): undefined reference to `Fl_Window::handle(int)'
Window.o:(.rodata._ZTVN9Graph_lib6WindowE[_ZTVN9Graph_lib6WindowE]+0x30): undefined reference to `Fl_Window::resize(int, int, int, int)'
Window.o:(.rodata._ZTVN9Graph_lib6WindowE[_ZTVN9Graph_lib6WindowE]+0x38): undefined reference to `Fl_Window::show()'
Window.o:(.rodata._ZTVN9Graph_lib6WindowE[_ZTVN9Graph_lib6WindowE]+0x40): undefined reference to `Fl_Window::hide()'
Window.o:(.rodata._ZTVN9Graph_lib6WindowE[_ZTVN9Graph_lib6WindowE]+0x60): undefined reference to `Fl_Window::flush()'
Window.o:(.rodata._ZTIN9Graph_lib6WindowE[_ZTIN9Graph_lib6WindowE]+0x10): undefined reference to `typeinfo for Fl_Window'
collect2: error: ld returned 1 exit status
makefile:25: recipe for target 'main' failed
make: *** [main] Error 1


This is my make file:



CC = g++ # the c compiler to use
DFLAGS = -std=c++11 # common defines
FLTK = -lfltk -lfltk_images # fltk defines

all: main

clean:
rm -f *.o

# ==== FLTK LIBRARY ====
Graph.o: Graph.cpp
$(CC) $(DFLAGS) -c -o $@ $<

GUI.o: GUI.cpp
$(CC) $(DFLAGS) -c -o $@ $<

Simple_window.o: Simple_window.cpp
$(CC) $(DFLAGS) -c -o $@ $<

Window.o: Window.cpp
$(CC) $(DFLAGS) -c -o $@ $<

# ==== MAIN FILE ====
main: Graph.o GUI.o Simple_window.o Window.o
$(CC) $(DFLAGS) $(FLTK) sample_main4.cpp Graph.o GUI.o
Simple_window.o Window.o


It should compile but I dont know what I am missing in my ubuntu since it works on my school server, but not mine. All files are in the exact place on both servers.










share|improve this question



















  • 1




    I'd suspect the libraries -lfltk -lfltk_images need to go AFTER the other objects (making the link order L to R)
    – steeldriver
    Mar 15 at 2:58










  • i.e. $(CC) $(DFLAGS) sample_main4.cpp Graph.o GUI.o $(FLTK)
    – steeldriver
    Mar 15 at 8:22










  • Doing this method: $(CC) $(DFLAGS) sample_main4.cpp Graph.o GUI.o Simple_window.o Window.o $(FLTK) Gives this error: Graph.o: In function Graph_lib::Bad_images(int, int ): Graph.cpp:(.text._ZN9Graph_lib9Bad_imageC2Eii.....) : undefined reference to `Fl_Image::Fl_image(int, int, int) collect2: error: ld returned 1 exit status makefile:25: recipe for target 'main' failed make: *** [main] Error 1
    – Roberto Jimenez
    Mar 15 at 21:01











  • What is your school computer? And home one? I don't want Manufactures and Models but operating systems (with versions). Debugging a problem between two Ubuntu machines is probably less of an issue than say Ununtu 14.04 and Windows 10. To close voters we may not be the best site for coding issuesbut it is not off topic.
    – Warren Hill
    Mar 21 at 22:58














up vote
0
down vote

favorite












I am trying to compile a old programming assignment and when using my schools server it compiles without error and still works now. I am trying to compile on my home computer but would give me this error when I make:



g++ -std=c++11 -c -o Graph.o Graph.cpp
g++ -std=c++11 -c -o GUI.o GUI.cpp
g++ -std=c++11 -c -o Simple_window.o Simple_window.cpp
g++ -std=c++11 -c -o Window.o Window.cpp
g++ -std=c++11 -lfltk -lfltk_images sample_main4.cpp Graph.o GUI.o Simple_window.o Window.o

/tmp/ccshmUhR.o: In function `Graph_lib::Window::~Window()':
sample_main4.cpp:(.text._ZN9Graph_lib6WindowD2Ev[_ZN9Graph_lib6WindowD5Ev]+0x31): undefined reference to `Fl_Window::~Fl_Window()'
/tmp/ccshmUhR.o:(.rodata._ZTV13Simple_window[_ZTV13Simple_window]+0x28): undefined reference to `Fl_Window::handle(int)'
/tmp/ccshmUhR.o:(.rodata._ZTV13Simple_window[_ZTV13Simple_window]+0x30): undefined reference to `Fl_Window::resize(int, int, int, int)'
/tmp/ccshmUhR.o:(.rodata._ZTV13Simple_window[_ZTV13Simple_window]+0x38): undefined reference to `Fl_Window::show()'
/tmp/ccshmUhR.o:(.rodata._ZTV13Simple_window[_ZTV13Simple_window]+0x40): undefined reference to `Fl_Window::hide()'
/tmp/ccshmUhR.o:(.rodata._ZTV13Simple_window[_ZTV13Simple_window]+0x60): undefined reference to `Fl_Window::flush()'
Graph.o: In function `Graph_lib::draw_mark(Point, char)':
Graph.cpp:(.text+0xb9e): undefined reference to `fl_draw(char const*, int, int)'
Graph.o: In function `Graph_lib::Text::draw_lines() const':
Graph.cpp:(.text+0x1223): undefined reference to `fl_draw(char const*, int, int)'
Graph.o: In function `Graph_lib::Image::Image(Point, String, Graph_lib::Suffix::Encoding)':
Graph.cpp:(.text+0x1dbc): undefined reference to `Fl_JPEG_Image::Fl_JPEG_Image(char const*)'
Graph.cpp:(.text+0x1df6): undefined reference to `Fl_GIF_Image::Fl_GIF_Image(char const*)'
Graph.o: In function `Fl_Image::Fl_Image(int, int, int)':
Graph.cpp:(.text._ZN8Fl_ImageC2Eiii[_ZN8Fl_ImageC5Eiii]+0x12): undefined reference to `vtable for Fl_Image'
Graph.o: In function `fl_color(unsigned int)':
Graph.cpp:(.text._Z8fl_colorj[_Z8fl_colorj]+0xe): undefined reference to `fl_graphics_driver'
Graph.cpp:(.text._Z8fl_colorj[_Z8fl_colorj]+0x21): undefined reference to `fl_graphics_driver'
Graph.o: In function `fl_color()':
Graph.cpp:(.text._Z8fl_colorv[_Z8fl_colorv]+0x7): undefined reference to `fl_graphics_driver'
Graph.o: In function `fl_line_style(int, int, char*)':
Graph.cpp:(.text._Z13fl_line_styleiiPc[_Z13fl_line_styleiiPc]+0x15): undefined reference to `fl_graphics_driver'
Graph.cpp:(.text._Z13fl_line_styleiiPc[_Z13fl_line_styleiiPc]+0x26): undefined reference to `fl_graphics_driver'
Graph.o:Graph.cpp:(.text._Z7fl_rectiiii[_Z7fl_rectiiii]+0x17): more undefined references to `fl_graphics_driver' follow
Graph.o: In function `Graph_lib::Bad_image::draw(int, int, int, int, int, int)':
Graph.cpp:(.text._ZN9Graph_lib9Bad_image4drawEiiiiii[_ZN9Graph_lib9Bad_image4drawEiiiiii]+0x2d): undefined reference to `Fl_Image::draw_empty(int, int)'
Graph.o:(.rodata._ZTVN9Graph_lib9Bad_imageE[_ZTVN9Graph_lib9Bad_imageE]+0x20): undefined reference to `Fl_Image::copy(int, int)'
Graph.o:(.rodata._ZTVN9Graph_lib9Bad_imageE[_ZTVN9Graph_lib9Bad_imageE]+0x28): undefined reference to `Fl_Image::color_average(unsigned int, float)'
Graph.o:(.rodata._ZTVN9Graph_lib9Bad_imageE[_ZTVN9Graph_lib9Bad_imageE]+0x30): undefined reference to `Fl_Image::desaturate()'
Graph.o:(.rodata._ZTVN9Graph_lib9Bad_imageE[_ZTVN9Graph_lib9Bad_imageE]+0x38): undefined reference to `Fl_Image::label(Fl_Widget*)'
Graph.o:(.rodata._ZTVN9Graph_lib9Bad_imageE[_ZTVN9Graph_lib9Bad_imageE]+0x40): undefined reference to `Fl_Image::label(Fl_Menu_Item*)'
Graph.o:(.rodata._ZTVN9Graph_lib9Bad_imageE[_ZTVN9Graph_lib9Bad_imageE]+0x50): undefined reference to `Fl_Image::uncache()'
Graph.o: In function `Graph_lib::Bad_image::~Bad_image()':
Graph.cpp:(.text._ZN9Graph_lib9Bad_imageD2Ev[_ZN9Graph_lib9Bad_imageD5Ev]+0x20): undefined reference to `Fl_Image::~Fl_Image()'
Graph.o:(.rodata._ZTIN9Graph_lib9Bad_imageE[_ZTIN9Graph_lib9Bad_imageE]+0x10): undefined reference to `typeinfo for Fl_Image'
GUI.o: In function `Graph_lib::Button::attach(Graph_lib::Window&)':
GUI.cpp:(.text+0x5b): undefined reference to `Fl_Button::Fl_Button(int, int, int, int, char const*)'
GUI.o: In function `Graph_lib::In_box::attach(Graph_lib::Window&)':
GUI.cpp:(.text+0x1b3): undefined reference to `Fl_Input::Fl_Input(int, int, int, int, char const*)'
GUI.o: In function `Graph_lib::Out_box::put(String const&)':
GUI.cpp:(.text+0x229): undefined reference to `Fl_Input_::value(char const*)'
GUI.o: In function `Graph_lib::Out_box::attach(Graph_lib::Window&)':
GUI.cpp:(.text+0x291): undefined reference to `Fl_Output::Fl_Output(int, int, int, int, char const*)'
Simple_window.o: In function `Simple_window::wait_for_button()':
Simple_window.cpp:(.text+0x160): undefined reference to `Fl::wait()'
Simple_window.cpp:(.text+0x167): undefined reference to `Fl::redraw()'
Window.o: In function `Graph_lib::Window::Window(int, int, String const&)':
Window.cpp:(.text+0x34): undefined reference to `Fl_Window::Fl_Window(int, int, char const*)'
Window.cpp:(.text+0x9b): undefined reference to `Fl_Window::~Fl_Window()'
Window.o: In function `Graph_lib::Window::Window(Point, int, int, String const&)':
Window.cpp:(.text+0xf6): undefined reference to `Fl_Window::Fl_Window(int, int, int, int, char const*)'
Window.cpp:(.text+0x15d): undefined reference to `Fl_Window::~Fl_Window()'
Window.o: In function `Graph_lib::Window::draw()':
Window.cpp:(.text+0x1c3): undefined reference to `Fl_Window::draw()'
Window.o: In function `Graph_lib::Window::attach(Graph_lib::Widget&)':
Window.cpp:(.text+0x236): undefined reference to `Fl_Group::begin()'
Window.cpp:(.text+0x260): undefined reference to `Fl_Group::end()'
Window.o: In function `Graph_lib::gui_main()':
Window.cpp:(.text+0x47b): undefined reference to `Fl::run()'
Window.o:(.rodata._ZTVN9Graph_lib6WindowE[_ZTVN9Graph_lib6WindowE]+0x28): undefined reference to `Fl_Window::handle(int)'
Window.o:(.rodata._ZTVN9Graph_lib6WindowE[_ZTVN9Graph_lib6WindowE]+0x30): undefined reference to `Fl_Window::resize(int, int, int, int)'
Window.o:(.rodata._ZTVN9Graph_lib6WindowE[_ZTVN9Graph_lib6WindowE]+0x38): undefined reference to `Fl_Window::show()'
Window.o:(.rodata._ZTVN9Graph_lib6WindowE[_ZTVN9Graph_lib6WindowE]+0x40): undefined reference to `Fl_Window::hide()'
Window.o:(.rodata._ZTVN9Graph_lib6WindowE[_ZTVN9Graph_lib6WindowE]+0x60): undefined reference to `Fl_Window::flush()'
Window.o:(.rodata._ZTIN9Graph_lib6WindowE[_ZTIN9Graph_lib6WindowE]+0x10): undefined reference to `typeinfo for Fl_Window'
collect2: error: ld returned 1 exit status
makefile:25: recipe for target 'main' failed
make: *** [main] Error 1


This is my make file:



CC = g++ # the c compiler to use
DFLAGS = -std=c++11 # common defines
FLTK = -lfltk -lfltk_images # fltk defines

all: main

clean:
rm -f *.o

# ==== FLTK LIBRARY ====
Graph.o: Graph.cpp
$(CC) $(DFLAGS) -c -o $@ $<

GUI.o: GUI.cpp
$(CC) $(DFLAGS) -c -o $@ $<

Simple_window.o: Simple_window.cpp
$(CC) $(DFLAGS) -c -o $@ $<

Window.o: Window.cpp
$(CC) $(DFLAGS) -c -o $@ $<

# ==== MAIN FILE ====
main: Graph.o GUI.o Simple_window.o Window.o
$(CC) $(DFLAGS) $(FLTK) sample_main4.cpp Graph.o GUI.o
Simple_window.o Window.o


It should compile but I dont know what I am missing in my ubuntu since it works on my school server, but not mine. All files are in the exact place on both servers.










share|improve this question



















  • 1




    I'd suspect the libraries -lfltk -lfltk_images need to go AFTER the other objects (making the link order L to R)
    – steeldriver
    Mar 15 at 2:58










  • i.e. $(CC) $(DFLAGS) sample_main4.cpp Graph.o GUI.o $(FLTK)
    – steeldriver
    Mar 15 at 8:22










  • Doing this method: $(CC) $(DFLAGS) sample_main4.cpp Graph.o GUI.o Simple_window.o Window.o $(FLTK) Gives this error: Graph.o: In function Graph_lib::Bad_images(int, int ): Graph.cpp:(.text._ZN9Graph_lib9Bad_imageC2Eii.....) : undefined reference to `Fl_Image::Fl_image(int, int, int) collect2: error: ld returned 1 exit status makefile:25: recipe for target 'main' failed make: *** [main] Error 1
    – Roberto Jimenez
    Mar 15 at 21:01











  • What is your school computer? And home one? I don't want Manufactures and Models but operating systems (with versions). Debugging a problem between two Ubuntu machines is probably less of an issue than say Ununtu 14.04 and Windows 10. To close voters we may not be the best site for coding issuesbut it is not off topic.
    – Warren Hill
    Mar 21 at 22:58












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I am trying to compile a old programming assignment and when using my schools server it compiles without error and still works now. I am trying to compile on my home computer but would give me this error when I make:



g++ -std=c++11 -c -o Graph.o Graph.cpp
g++ -std=c++11 -c -o GUI.o GUI.cpp
g++ -std=c++11 -c -o Simple_window.o Simple_window.cpp
g++ -std=c++11 -c -o Window.o Window.cpp
g++ -std=c++11 -lfltk -lfltk_images sample_main4.cpp Graph.o GUI.o Simple_window.o Window.o

/tmp/ccshmUhR.o: In function `Graph_lib::Window::~Window()':
sample_main4.cpp:(.text._ZN9Graph_lib6WindowD2Ev[_ZN9Graph_lib6WindowD5Ev]+0x31): undefined reference to `Fl_Window::~Fl_Window()'
/tmp/ccshmUhR.o:(.rodata._ZTV13Simple_window[_ZTV13Simple_window]+0x28): undefined reference to `Fl_Window::handle(int)'
/tmp/ccshmUhR.o:(.rodata._ZTV13Simple_window[_ZTV13Simple_window]+0x30): undefined reference to `Fl_Window::resize(int, int, int, int)'
/tmp/ccshmUhR.o:(.rodata._ZTV13Simple_window[_ZTV13Simple_window]+0x38): undefined reference to `Fl_Window::show()'
/tmp/ccshmUhR.o:(.rodata._ZTV13Simple_window[_ZTV13Simple_window]+0x40): undefined reference to `Fl_Window::hide()'
/tmp/ccshmUhR.o:(.rodata._ZTV13Simple_window[_ZTV13Simple_window]+0x60): undefined reference to `Fl_Window::flush()'
Graph.o: In function `Graph_lib::draw_mark(Point, char)':
Graph.cpp:(.text+0xb9e): undefined reference to `fl_draw(char const*, int, int)'
Graph.o: In function `Graph_lib::Text::draw_lines() const':
Graph.cpp:(.text+0x1223): undefined reference to `fl_draw(char const*, int, int)'
Graph.o: In function `Graph_lib::Image::Image(Point, String, Graph_lib::Suffix::Encoding)':
Graph.cpp:(.text+0x1dbc): undefined reference to `Fl_JPEG_Image::Fl_JPEG_Image(char const*)'
Graph.cpp:(.text+0x1df6): undefined reference to `Fl_GIF_Image::Fl_GIF_Image(char const*)'
Graph.o: In function `Fl_Image::Fl_Image(int, int, int)':
Graph.cpp:(.text._ZN8Fl_ImageC2Eiii[_ZN8Fl_ImageC5Eiii]+0x12): undefined reference to `vtable for Fl_Image'
Graph.o: In function `fl_color(unsigned int)':
Graph.cpp:(.text._Z8fl_colorj[_Z8fl_colorj]+0xe): undefined reference to `fl_graphics_driver'
Graph.cpp:(.text._Z8fl_colorj[_Z8fl_colorj]+0x21): undefined reference to `fl_graphics_driver'
Graph.o: In function `fl_color()':
Graph.cpp:(.text._Z8fl_colorv[_Z8fl_colorv]+0x7): undefined reference to `fl_graphics_driver'
Graph.o: In function `fl_line_style(int, int, char*)':
Graph.cpp:(.text._Z13fl_line_styleiiPc[_Z13fl_line_styleiiPc]+0x15): undefined reference to `fl_graphics_driver'
Graph.cpp:(.text._Z13fl_line_styleiiPc[_Z13fl_line_styleiiPc]+0x26): undefined reference to `fl_graphics_driver'
Graph.o:Graph.cpp:(.text._Z7fl_rectiiii[_Z7fl_rectiiii]+0x17): more undefined references to `fl_graphics_driver' follow
Graph.o: In function `Graph_lib::Bad_image::draw(int, int, int, int, int, int)':
Graph.cpp:(.text._ZN9Graph_lib9Bad_image4drawEiiiiii[_ZN9Graph_lib9Bad_image4drawEiiiiii]+0x2d): undefined reference to `Fl_Image::draw_empty(int, int)'
Graph.o:(.rodata._ZTVN9Graph_lib9Bad_imageE[_ZTVN9Graph_lib9Bad_imageE]+0x20): undefined reference to `Fl_Image::copy(int, int)'
Graph.o:(.rodata._ZTVN9Graph_lib9Bad_imageE[_ZTVN9Graph_lib9Bad_imageE]+0x28): undefined reference to `Fl_Image::color_average(unsigned int, float)'
Graph.o:(.rodata._ZTVN9Graph_lib9Bad_imageE[_ZTVN9Graph_lib9Bad_imageE]+0x30): undefined reference to `Fl_Image::desaturate()'
Graph.o:(.rodata._ZTVN9Graph_lib9Bad_imageE[_ZTVN9Graph_lib9Bad_imageE]+0x38): undefined reference to `Fl_Image::label(Fl_Widget*)'
Graph.o:(.rodata._ZTVN9Graph_lib9Bad_imageE[_ZTVN9Graph_lib9Bad_imageE]+0x40): undefined reference to `Fl_Image::label(Fl_Menu_Item*)'
Graph.o:(.rodata._ZTVN9Graph_lib9Bad_imageE[_ZTVN9Graph_lib9Bad_imageE]+0x50): undefined reference to `Fl_Image::uncache()'
Graph.o: In function `Graph_lib::Bad_image::~Bad_image()':
Graph.cpp:(.text._ZN9Graph_lib9Bad_imageD2Ev[_ZN9Graph_lib9Bad_imageD5Ev]+0x20): undefined reference to `Fl_Image::~Fl_Image()'
Graph.o:(.rodata._ZTIN9Graph_lib9Bad_imageE[_ZTIN9Graph_lib9Bad_imageE]+0x10): undefined reference to `typeinfo for Fl_Image'
GUI.o: In function `Graph_lib::Button::attach(Graph_lib::Window&)':
GUI.cpp:(.text+0x5b): undefined reference to `Fl_Button::Fl_Button(int, int, int, int, char const*)'
GUI.o: In function `Graph_lib::In_box::attach(Graph_lib::Window&)':
GUI.cpp:(.text+0x1b3): undefined reference to `Fl_Input::Fl_Input(int, int, int, int, char const*)'
GUI.o: In function `Graph_lib::Out_box::put(String const&)':
GUI.cpp:(.text+0x229): undefined reference to `Fl_Input_::value(char const*)'
GUI.o: In function `Graph_lib::Out_box::attach(Graph_lib::Window&)':
GUI.cpp:(.text+0x291): undefined reference to `Fl_Output::Fl_Output(int, int, int, int, char const*)'
Simple_window.o: In function `Simple_window::wait_for_button()':
Simple_window.cpp:(.text+0x160): undefined reference to `Fl::wait()'
Simple_window.cpp:(.text+0x167): undefined reference to `Fl::redraw()'
Window.o: In function `Graph_lib::Window::Window(int, int, String const&)':
Window.cpp:(.text+0x34): undefined reference to `Fl_Window::Fl_Window(int, int, char const*)'
Window.cpp:(.text+0x9b): undefined reference to `Fl_Window::~Fl_Window()'
Window.o: In function `Graph_lib::Window::Window(Point, int, int, String const&)':
Window.cpp:(.text+0xf6): undefined reference to `Fl_Window::Fl_Window(int, int, int, int, char const*)'
Window.cpp:(.text+0x15d): undefined reference to `Fl_Window::~Fl_Window()'
Window.o: In function `Graph_lib::Window::draw()':
Window.cpp:(.text+0x1c3): undefined reference to `Fl_Window::draw()'
Window.o: In function `Graph_lib::Window::attach(Graph_lib::Widget&)':
Window.cpp:(.text+0x236): undefined reference to `Fl_Group::begin()'
Window.cpp:(.text+0x260): undefined reference to `Fl_Group::end()'
Window.o: In function `Graph_lib::gui_main()':
Window.cpp:(.text+0x47b): undefined reference to `Fl::run()'
Window.o:(.rodata._ZTVN9Graph_lib6WindowE[_ZTVN9Graph_lib6WindowE]+0x28): undefined reference to `Fl_Window::handle(int)'
Window.o:(.rodata._ZTVN9Graph_lib6WindowE[_ZTVN9Graph_lib6WindowE]+0x30): undefined reference to `Fl_Window::resize(int, int, int, int)'
Window.o:(.rodata._ZTVN9Graph_lib6WindowE[_ZTVN9Graph_lib6WindowE]+0x38): undefined reference to `Fl_Window::show()'
Window.o:(.rodata._ZTVN9Graph_lib6WindowE[_ZTVN9Graph_lib6WindowE]+0x40): undefined reference to `Fl_Window::hide()'
Window.o:(.rodata._ZTVN9Graph_lib6WindowE[_ZTVN9Graph_lib6WindowE]+0x60): undefined reference to `Fl_Window::flush()'
Window.o:(.rodata._ZTIN9Graph_lib6WindowE[_ZTIN9Graph_lib6WindowE]+0x10): undefined reference to `typeinfo for Fl_Window'
collect2: error: ld returned 1 exit status
makefile:25: recipe for target 'main' failed
make: *** [main] Error 1


This is my make file:



CC = g++ # the c compiler to use
DFLAGS = -std=c++11 # common defines
FLTK = -lfltk -lfltk_images # fltk defines

all: main

clean:
rm -f *.o

# ==== FLTK LIBRARY ====
Graph.o: Graph.cpp
$(CC) $(DFLAGS) -c -o $@ $<

GUI.o: GUI.cpp
$(CC) $(DFLAGS) -c -o $@ $<

Simple_window.o: Simple_window.cpp
$(CC) $(DFLAGS) -c -o $@ $<

Window.o: Window.cpp
$(CC) $(DFLAGS) -c -o $@ $<

# ==== MAIN FILE ====
main: Graph.o GUI.o Simple_window.o Window.o
$(CC) $(DFLAGS) $(FLTK) sample_main4.cpp Graph.o GUI.o
Simple_window.o Window.o


It should compile but I dont know what I am missing in my ubuntu since it works on my school server, but not mine. All files are in the exact place on both servers.










share|improve this question















I am trying to compile a old programming assignment and when using my schools server it compiles without error and still works now. I am trying to compile on my home computer but would give me this error when I make:



g++ -std=c++11 -c -o Graph.o Graph.cpp
g++ -std=c++11 -c -o GUI.o GUI.cpp
g++ -std=c++11 -c -o Simple_window.o Simple_window.cpp
g++ -std=c++11 -c -o Window.o Window.cpp
g++ -std=c++11 -lfltk -lfltk_images sample_main4.cpp Graph.o GUI.o Simple_window.o Window.o

/tmp/ccshmUhR.o: In function `Graph_lib::Window::~Window()':
sample_main4.cpp:(.text._ZN9Graph_lib6WindowD2Ev[_ZN9Graph_lib6WindowD5Ev]+0x31): undefined reference to `Fl_Window::~Fl_Window()'
/tmp/ccshmUhR.o:(.rodata._ZTV13Simple_window[_ZTV13Simple_window]+0x28): undefined reference to `Fl_Window::handle(int)'
/tmp/ccshmUhR.o:(.rodata._ZTV13Simple_window[_ZTV13Simple_window]+0x30): undefined reference to `Fl_Window::resize(int, int, int, int)'
/tmp/ccshmUhR.o:(.rodata._ZTV13Simple_window[_ZTV13Simple_window]+0x38): undefined reference to `Fl_Window::show()'
/tmp/ccshmUhR.o:(.rodata._ZTV13Simple_window[_ZTV13Simple_window]+0x40): undefined reference to `Fl_Window::hide()'
/tmp/ccshmUhR.o:(.rodata._ZTV13Simple_window[_ZTV13Simple_window]+0x60): undefined reference to `Fl_Window::flush()'
Graph.o: In function `Graph_lib::draw_mark(Point, char)':
Graph.cpp:(.text+0xb9e): undefined reference to `fl_draw(char const*, int, int)'
Graph.o: In function `Graph_lib::Text::draw_lines() const':
Graph.cpp:(.text+0x1223): undefined reference to `fl_draw(char const*, int, int)'
Graph.o: In function `Graph_lib::Image::Image(Point, String, Graph_lib::Suffix::Encoding)':
Graph.cpp:(.text+0x1dbc): undefined reference to `Fl_JPEG_Image::Fl_JPEG_Image(char const*)'
Graph.cpp:(.text+0x1df6): undefined reference to `Fl_GIF_Image::Fl_GIF_Image(char const*)'
Graph.o: In function `Fl_Image::Fl_Image(int, int, int)':
Graph.cpp:(.text._ZN8Fl_ImageC2Eiii[_ZN8Fl_ImageC5Eiii]+0x12): undefined reference to `vtable for Fl_Image'
Graph.o: In function `fl_color(unsigned int)':
Graph.cpp:(.text._Z8fl_colorj[_Z8fl_colorj]+0xe): undefined reference to `fl_graphics_driver'
Graph.cpp:(.text._Z8fl_colorj[_Z8fl_colorj]+0x21): undefined reference to `fl_graphics_driver'
Graph.o: In function `fl_color()':
Graph.cpp:(.text._Z8fl_colorv[_Z8fl_colorv]+0x7): undefined reference to `fl_graphics_driver'
Graph.o: In function `fl_line_style(int, int, char*)':
Graph.cpp:(.text._Z13fl_line_styleiiPc[_Z13fl_line_styleiiPc]+0x15): undefined reference to `fl_graphics_driver'
Graph.cpp:(.text._Z13fl_line_styleiiPc[_Z13fl_line_styleiiPc]+0x26): undefined reference to `fl_graphics_driver'
Graph.o:Graph.cpp:(.text._Z7fl_rectiiii[_Z7fl_rectiiii]+0x17): more undefined references to `fl_graphics_driver' follow
Graph.o: In function `Graph_lib::Bad_image::draw(int, int, int, int, int, int)':
Graph.cpp:(.text._ZN9Graph_lib9Bad_image4drawEiiiiii[_ZN9Graph_lib9Bad_image4drawEiiiiii]+0x2d): undefined reference to `Fl_Image::draw_empty(int, int)'
Graph.o:(.rodata._ZTVN9Graph_lib9Bad_imageE[_ZTVN9Graph_lib9Bad_imageE]+0x20): undefined reference to `Fl_Image::copy(int, int)'
Graph.o:(.rodata._ZTVN9Graph_lib9Bad_imageE[_ZTVN9Graph_lib9Bad_imageE]+0x28): undefined reference to `Fl_Image::color_average(unsigned int, float)'
Graph.o:(.rodata._ZTVN9Graph_lib9Bad_imageE[_ZTVN9Graph_lib9Bad_imageE]+0x30): undefined reference to `Fl_Image::desaturate()'
Graph.o:(.rodata._ZTVN9Graph_lib9Bad_imageE[_ZTVN9Graph_lib9Bad_imageE]+0x38): undefined reference to `Fl_Image::label(Fl_Widget*)'
Graph.o:(.rodata._ZTVN9Graph_lib9Bad_imageE[_ZTVN9Graph_lib9Bad_imageE]+0x40): undefined reference to `Fl_Image::label(Fl_Menu_Item*)'
Graph.o:(.rodata._ZTVN9Graph_lib9Bad_imageE[_ZTVN9Graph_lib9Bad_imageE]+0x50): undefined reference to `Fl_Image::uncache()'
Graph.o: In function `Graph_lib::Bad_image::~Bad_image()':
Graph.cpp:(.text._ZN9Graph_lib9Bad_imageD2Ev[_ZN9Graph_lib9Bad_imageD5Ev]+0x20): undefined reference to `Fl_Image::~Fl_Image()'
Graph.o:(.rodata._ZTIN9Graph_lib9Bad_imageE[_ZTIN9Graph_lib9Bad_imageE]+0x10): undefined reference to `typeinfo for Fl_Image'
GUI.o: In function `Graph_lib::Button::attach(Graph_lib::Window&)':
GUI.cpp:(.text+0x5b): undefined reference to `Fl_Button::Fl_Button(int, int, int, int, char const*)'
GUI.o: In function `Graph_lib::In_box::attach(Graph_lib::Window&)':
GUI.cpp:(.text+0x1b3): undefined reference to `Fl_Input::Fl_Input(int, int, int, int, char const*)'
GUI.o: In function `Graph_lib::Out_box::put(String const&)':
GUI.cpp:(.text+0x229): undefined reference to `Fl_Input_::value(char const*)'
GUI.o: In function `Graph_lib::Out_box::attach(Graph_lib::Window&)':
GUI.cpp:(.text+0x291): undefined reference to `Fl_Output::Fl_Output(int, int, int, int, char const*)'
Simple_window.o: In function `Simple_window::wait_for_button()':
Simple_window.cpp:(.text+0x160): undefined reference to `Fl::wait()'
Simple_window.cpp:(.text+0x167): undefined reference to `Fl::redraw()'
Window.o: In function `Graph_lib::Window::Window(int, int, String const&)':
Window.cpp:(.text+0x34): undefined reference to `Fl_Window::Fl_Window(int, int, char const*)'
Window.cpp:(.text+0x9b): undefined reference to `Fl_Window::~Fl_Window()'
Window.o: In function `Graph_lib::Window::Window(Point, int, int, String const&)':
Window.cpp:(.text+0xf6): undefined reference to `Fl_Window::Fl_Window(int, int, int, int, char const*)'
Window.cpp:(.text+0x15d): undefined reference to `Fl_Window::~Fl_Window()'
Window.o: In function `Graph_lib::Window::draw()':
Window.cpp:(.text+0x1c3): undefined reference to `Fl_Window::draw()'
Window.o: In function `Graph_lib::Window::attach(Graph_lib::Widget&)':
Window.cpp:(.text+0x236): undefined reference to `Fl_Group::begin()'
Window.cpp:(.text+0x260): undefined reference to `Fl_Group::end()'
Window.o: In function `Graph_lib::gui_main()':
Window.cpp:(.text+0x47b): undefined reference to `Fl::run()'
Window.o:(.rodata._ZTVN9Graph_lib6WindowE[_ZTVN9Graph_lib6WindowE]+0x28): undefined reference to `Fl_Window::handle(int)'
Window.o:(.rodata._ZTVN9Graph_lib6WindowE[_ZTVN9Graph_lib6WindowE]+0x30): undefined reference to `Fl_Window::resize(int, int, int, int)'
Window.o:(.rodata._ZTVN9Graph_lib6WindowE[_ZTVN9Graph_lib6WindowE]+0x38): undefined reference to `Fl_Window::show()'
Window.o:(.rodata._ZTVN9Graph_lib6WindowE[_ZTVN9Graph_lib6WindowE]+0x40): undefined reference to `Fl_Window::hide()'
Window.o:(.rodata._ZTVN9Graph_lib6WindowE[_ZTVN9Graph_lib6WindowE]+0x60): undefined reference to `Fl_Window::flush()'
Window.o:(.rodata._ZTIN9Graph_lib6WindowE[_ZTIN9Graph_lib6WindowE]+0x10): undefined reference to `typeinfo for Fl_Window'
collect2: error: ld returned 1 exit status
makefile:25: recipe for target 'main' failed
make: *** [main] Error 1


This is my make file:



CC = g++ # the c compiler to use
DFLAGS = -std=c++11 # common defines
FLTK = -lfltk -lfltk_images # fltk defines

all: main

clean:
rm -f *.o

# ==== FLTK LIBRARY ====
Graph.o: Graph.cpp
$(CC) $(DFLAGS) -c -o $@ $<

GUI.o: GUI.cpp
$(CC) $(DFLAGS) -c -o $@ $<

Simple_window.o: Simple_window.cpp
$(CC) $(DFLAGS) -c -o $@ $<

Window.o: Window.cpp
$(CC) $(DFLAGS) -c -o $@ $<

# ==== MAIN FILE ====
main: Graph.o GUI.o Simple_window.o Window.o
$(CC) $(DFLAGS) $(FLTK) sample_main4.cpp Graph.o GUI.o
Simple_window.o Window.o


It should compile but I dont know what I am missing in my ubuntu since it works on my school server, but not mine. All files are in the exact place on both servers.







compiling c++ make






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 15 at 3:27









muru

130k19274467




130k19274467










asked Mar 15 at 2:42









Roberto Jimenez

42




42







  • 1




    I'd suspect the libraries -lfltk -lfltk_images need to go AFTER the other objects (making the link order L to R)
    – steeldriver
    Mar 15 at 2:58










  • i.e. $(CC) $(DFLAGS) sample_main4.cpp Graph.o GUI.o $(FLTK)
    – steeldriver
    Mar 15 at 8:22










  • Doing this method: $(CC) $(DFLAGS) sample_main4.cpp Graph.o GUI.o Simple_window.o Window.o $(FLTK) Gives this error: Graph.o: In function Graph_lib::Bad_images(int, int ): Graph.cpp:(.text._ZN9Graph_lib9Bad_imageC2Eii.....) : undefined reference to `Fl_Image::Fl_image(int, int, int) collect2: error: ld returned 1 exit status makefile:25: recipe for target 'main' failed make: *** [main] Error 1
    – Roberto Jimenez
    Mar 15 at 21:01











  • What is your school computer? And home one? I don't want Manufactures and Models but operating systems (with versions). Debugging a problem between two Ubuntu machines is probably less of an issue than say Ununtu 14.04 and Windows 10. To close voters we may not be the best site for coding issuesbut it is not off topic.
    – Warren Hill
    Mar 21 at 22:58












  • 1




    I'd suspect the libraries -lfltk -lfltk_images need to go AFTER the other objects (making the link order L to R)
    – steeldriver
    Mar 15 at 2:58










  • i.e. $(CC) $(DFLAGS) sample_main4.cpp Graph.o GUI.o $(FLTK)
    – steeldriver
    Mar 15 at 8:22










  • Doing this method: $(CC) $(DFLAGS) sample_main4.cpp Graph.o GUI.o Simple_window.o Window.o $(FLTK) Gives this error: Graph.o: In function Graph_lib::Bad_images(int, int ): Graph.cpp:(.text._ZN9Graph_lib9Bad_imageC2Eii.....) : undefined reference to `Fl_Image::Fl_image(int, int, int) collect2: error: ld returned 1 exit status makefile:25: recipe for target 'main' failed make: *** [main] Error 1
    – Roberto Jimenez
    Mar 15 at 21:01











  • What is your school computer? And home one? I don't want Manufactures and Models but operating systems (with versions). Debugging a problem between two Ubuntu machines is probably less of an issue than say Ununtu 14.04 and Windows 10. To close voters we may not be the best site for coding issuesbut it is not off topic.
    – Warren Hill
    Mar 21 at 22:58







1




1




I'd suspect the libraries -lfltk -lfltk_images need to go AFTER the other objects (making the link order L to R)
– steeldriver
Mar 15 at 2:58




I'd suspect the libraries -lfltk -lfltk_images need to go AFTER the other objects (making the link order L to R)
– steeldriver
Mar 15 at 2:58












i.e. $(CC) $(DFLAGS) sample_main4.cpp Graph.o GUI.o $(FLTK)
– steeldriver
Mar 15 at 8:22




i.e. $(CC) $(DFLAGS) sample_main4.cpp Graph.o GUI.o $(FLTK)
– steeldriver
Mar 15 at 8:22












Doing this method: $(CC) $(DFLAGS) sample_main4.cpp Graph.o GUI.o Simple_window.o Window.o $(FLTK) Gives this error: Graph.o: In function Graph_lib::Bad_images(int, int ): Graph.cpp:(.text._ZN9Graph_lib9Bad_imageC2Eii.....) : undefined reference to `Fl_Image::Fl_image(int, int, int) collect2: error: ld returned 1 exit status makefile:25: recipe for target 'main' failed make: *** [main] Error 1
– Roberto Jimenez
Mar 15 at 21:01





Doing this method: $(CC) $(DFLAGS) sample_main4.cpp Graph.o GUI.o Simple_window.o Window.o $(FLTK) Gives this error: Graph.o: In function Graph_lib::Bad_images(int, int ): Graph.cpp:(.text._ZN9Graph_lib9Bad_imageC2Eii.....) : undefined reference to `Fl_Image::Fl_image(int, int, int) collect2: error: ld returned 1 exit status makefile:25: recipe for target 'main' failed make: *** [main] Error 1
– Roberto Jimenez
Mar 15 at 21:01













What is your school computer? And home one? I don't want Manufactures and Models but operating systems (with versions). Debugging a problem between two Ubuntu machines is probably less of an issue than say Ununtu 14.04 and Windows 10. To close voters we may not be the best site for coding issuesbut it is not off topic.
– Warren Hill
Mar 21 at 22:58




What is your school computer? And home one? I don't want Manufactures and Models but operating systems (with versions). Debugging a problem between two Ubuntu machines is probably less of an issue than say Ununtu 14.04 and Windows 10. To close voters we may not be the best site for coding issuesbut it is not off topic.
– Warren Hill
Mar 21 at 22:58















active

oldest

votes











Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "89"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1015045%2ftrying-to-run-fltk-but-would-get-undefined-error%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1015045%2ftrying-to-run-fltk-but-would-get-undefined-error%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

pylint3 and pip3 broken

Missing snmpget and snmpwalk

How to enroll fingerprints to Ubuntu 17.10 with VFS491