[opensuse] building app; cpp undefined reference to constructor - need help fixing?
Guys, I'm trying to apply a patch to the GNU external ballistics source and package it in a rpm, but I've got an undefined reference error during the link I need help fixing. The source for the app (patched for opensuse 11.4 [113k]) is: When building, I get an error during linking: g++ -O3 -O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -L./lib/ballistics -o gebc InputWindow.o PlotWindow.o RangeWindow.o LicenseWindow.o AboutWindow.o PBRWindow.o GBCSolution.o GNU_Ballistics.o -lhpdf -lballistics -L/usr/lib64 -lfltk_images -lpng -lz -ljpeg -lfltk -lXext -lXft -lfontconfig -lXinerama -lpthread -ldl -lm -lX11 InputWindow.o: In function `InputWindow::cb_Target(Fl_Widget*, void*)': /usr/src/packages/BUILD/gebc-1.07/InputWindow.cpp:812: undefined reference to `TargetWindow::TargetWindow(int, int, GBCSolution*, GBCSolution*, GBCSolution*, GBCSolution*)' collect2: ld returned 1 exit status The error is generated on the 'new' call to create an instance of TargetWindow (line 812) in InputWindow.cpp below: void InputWindow::cb_Target(Fl_Widget* o, void* v){ InputWindow* T = (InputWindow*)v; GBCSolution* sln = T->gsln; GBCSolution* lmem1 = T->mem1; GBCSolution* lmem2 = T->mem2; GBCSolution* lmem3 = T->mem3;
new TargetWindow(600,600,sln,lmem1,lmem2,lmem3);
} InputWindow.h properly includes TargetWindow.h, so I don't understand why I get the undefined reference to TargetWindow::TargetWindow. The InputWindow.h includes: #ifndef __INPUTWINDOW #define __INPUTWINDOW #include "lib/ballistics/ballistics.h" #include <FL/Fl.H> #include <FL/Fl_Window.H> #include <FL/Fl_Help_Dialog.H> #include <FL/Fl_Output.H> #include <FL/Fl_File_Chooser.H> #include <FL/Fl_BMP_Image.H> #include <FL/Fl_Button.H> #include <FL/Fl_Input.H> #include <FL/Fl_Round_Button.H> #include <FL/Fl_Int_Input.H> #include <FL/Fl_Float_Input.H> #include <FL/Fl_Check_Button.H> #include <FL/Fl_Menu_Item.H> #include <FL/Fl_Menu_Bar.H> #include <FL/Fl_Multiline_Output.H> #include <FL/Fl_Box.H> #include <FL/Fl_Text_Display.H> #include <stdlib.h> #include <stdio.h> #include "GBCSolution.h" #include "RangeWindow.h" #include "AboutWindow.h" #include "LicenseWindow.h" #include "PlotWindow.h" #include "TargetWindow.h" class InputWindow : public Fl_Window{ public: InputWindow(int w, int h, const char* title ); ~InputWindow(); <snip> static void cb_Target(Fl_Widget*, void*); <snip> TargetWindow.h contains the prototype for the TargetWindow constructor: #ifndef __TARGETWINDOW #define __TARGETWINDOW #include <FL/Fl.H> #include <FL/Fl_Window.H> #include <FL/Fl_Round_Button.H> #include <FL/Fl_Check_Button.H> #include <FL/Fl_Value_Slider.H> #include <FL/fl_draw.H> #include <FL/Fl_Menu_Bar.H> #include <FL/Fl_Menu_Item.H> #include <FL/Fl_Choice.H> #include <stdio.h> #include <stdlib.h> #include <math.h> #include "GBCSolution.h" class TargetWindow : public Fl_Window { public: TargetWindow(int, int, GBCSolution*, GBCSolution*, GBCSolution*, GBCSolution*); ~TargetWindow(void); <snip> And, finally TargetWindow.cpp contains the constructor: #include "TargetWindow.h" #define PT_PATH 0 TargetWindow::TargetWindow(int w, int h, GBCSolution* Gsln, GBCSolution* GMEM1, GBCSolution* GMEM2, GBCSolution* GMEM3) : Fl_Window(w,h,"Solution Visualization Tools"){ <snip> So what rule am I not seeing that is leading to the "InputWindow.cpp:812: undefined reference to `TargetWindow::TargetWindow(..." error? Is there something simple in the way it is declared that causes the problem? If I can send anything else, please let me know. I'm curious -- what am I missing here -- it all looks good (to me). Thanks. ======== original sourceforge sources + patches below ========= http://sourceforge.net/projects/balcomp/files/GNU%20Ballistics%20-%20Source/... The original patch is: https://sourceforge.net/tracker/?func=detail&aid=3167921&group_id=216428&atid=1037641 The patch to build on opensuse is (just fixes fl_draw.h -> fl_draw.H): http://www.3111skyline.com/dl/suse/sources/gebc-openSuSE.diff -- David C. Rankin, J.D.,P.E. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
El 16/05/12 23:20, David C. Rankin escribió:
Guys,
I'm trying to apply a patch to the GNU external ballistics source and package it in a rpm, but I've got an undefined reference error during the link I need help fixing. The source for the app (patched for opensuse 11.4 [113k]) is:
When building, I get an error during linking:
g++ -O3 -O2 -g -m64 -fmessage-length=0 -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -L./lib/ballistics -o gebc InputWindow.o PlotWindow.o RangeWindow.o LicenseWindow.o AboutWindow.o PBRWindow.o GBCSolution.o GNU_Ballistics.o -lhpdf -lballistics -L/usr/lib64 -lfltk_images -lpng -lz -ljpeg -lfltk -lXext -lXft -lfontconfig -lXinerama -lpthread -ldl -lm -lX11 InputWindow.o: In function `InputWindow::cb_Target(Fl_Widget*, void*)': /usr/src/packages/BUILD/gebc-1.07/InputWindow.cpp:812: undefined reference to `TargetWindow::TargetWindow(int, int, GBCSolution*, GBCSolution*, GBCSolution*, GBCSolution*)' collect2: ld returned 1 exit status (snip) And, finally TargetWindow.cpp contains the constructor:
There is no "TargetWindow.o" object in the linker command line, and hence it will obviously fail undefined references... -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 16/05/12 23:42, Cristian Rodríguez wrote: undefined
reference to `TargetWindow::TargetWindow(int, int, GBCSolution*, GBCSolution*, GBCSolution*, GBCSolution*)' collect2: ld returned 1 exit status (snip) And, finally TargetWindow.cpp contains the constructor:
There is no "TargetWindow.o" object in the linker command line, and hence it will obviously fail undefined references...
btw, what is the target distro of the build in question ? the compiler will clearly tell you that an object "foo.o" is missing in the command line with newer distros when using the adecuate build environment.. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 05/16/2012 10:56 PM, Cristian Rodríguez wrote:
On 16/05/12 23:42, Cristian Rodríguez wrote: undefined
reference to `TargetWindow::TargetWindow(int, int, GBCSolution*, GBCSolution*, GBCSolution*, GBCSolution*)' collect2: ld returned 1 exit status (snip) And, finally TargetWindow.cpp contains the constructor:
There is no "TargetWindow.o" object in the linker command line, and hence it will obviously fail undefined references...
btw, what is the target distro of the build in question ? the compiler will clearly tell you that an object "foo.o" is missing in the command line with newer distros when using the adecuate build environment..
Thanks Christian, I got it! After patching, running autoreconf before configure fixed it :) -- David C. Rankin, J.D.,P.E. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 05/17/2012 08:37 AM, David C. Rankin wrote:
btw, what is the target distro of the build in question ? the compiler will
clearly tell you that an object "foo.o" is missing in the command line with newer distros when using the adecuate build environment..
Thanks Christian, I got it! After patching, running autoreconf before configure fixed it :)
If anyone is interested in shooting or ballistics, this little app works quite well. If put together a src.rpm for it for 11.4 if you are interested at: [161k] http://www.3111skyline.com/dl/suse/sources/gebc-1.07-1.0.src.rpm You will need fltk-devel installed to build. -- David C. Rankin, J.D.,P.E. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
participants (2)
-
Cristian Rodríguez
-
David C. Rankin