提问人:Danh Le 提问时间:10/18/2023 更新时间:10/18/2023 访问量:50
在 Ubuntu 22 上安装 FLTK 1.3.8 时未定义引用
undefined reference when install fltk 1.3.8 on ubuntu 22
问:
我正在用Stroutrup的PPP书学习C++。我需要安装 fltk 来跟进他的课程。
在 dowloading 和 upzip 之后,我运行: 我得到了这个摘要(看起来没问题)./congiure
Configuration Summary
-------------------------------------------------------------------------
Directories: prefix=/usr/local
bindir=${exec_prefix}/bin
datadir=${datarootdir}
datarootdir=${prefix}/share
exec_prefix=${prefix}
includedir=${prefix}/include
libdir=${exec_prefix}/lib
mandir=${datarootdir}/man
Graphics: X11 + Xft + Xdbe + Xfixes + Xinerama + Xcursor + Xrender
Image Libraries: JPEG=System
PNG=System
ZLIB=System
Large Files: YES
OpenGL: YES
Threads: YES
configure: creating ./config.status
config.status: creating makeinclude
config.status: creating fltk.list
config.status: creating fltk-config
config.status: creating fltk.spec
config.status: creating FL/Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: creating FL/abi-version.h
config.status: FL/abi-version.h is unchanged
然后,我跑了我得到很多make
undefined refence to...
undo.cxx: In function ‘char* undo_filename(int, char*, int)’:
undo.cxx:68:29: warning: ‘undo_’ directive output may be truncated writing 5 bytes into a region of size between 1 and 2048 [-Wformat-truncation=]
68 | snprintf(buf, bufsize, "%sundo_%d_%d.fl", undo_path, getpid(), level);
| ^~~~~
In file included from /usr/include/stdio.h:894,
from ../FL/fl_utf8.h:34,
from ../FL/Fl.H:32,
from undo.cxx:19:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:71:35: note: ‘__builtin___snprintf_chk’ output between 12 and 2079 bytes into a destination of size 2048
71 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
| ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72 | __glibc_objsize (__s), __fmt,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
73 | __va_arg_pack ());
| ~~~~~~~~~~~~~~~~~
Compiling widget_panel.cxx...
Linking fluid...
/usr/bin/ld: Fl_Function_Type.o: in function `Fl_Decl_Type::make()':
Fl_Function_Type.cxx:(.text._ZN12Fl_Decl_Type4makeEv+0x34): undefined reference to `operator new(unsigned long)'
/usr/bin/ld: Fl_Function_Type.o: in function `Fl_Code_Type::make()':
Fl_Function_Type.cxx:(.text._ZN12Fl_Code_Type4makeEv+0x45): undefined reference to `operator new(unsigned long)'
/usr/bin/ld: Fl_Function_Type.o: in function `Fl_Class_Type::~Fl_Class_Type()':
Fl_Function_Type.cxx:(.text._ZN13Fl_Class_TypeD0Ev[_ZN13Fl_Class_TypeD5Ev]+0x21): undefined reference to `operator delete(void*, unsigned long)'
/usr/bin/ld: Fl_Function_Type.o: in function `Fl_Comment_Type::~Fl_Comment_Type()':
Fl_Function_Type.cxx:(.text._ZN15Fl_Comment_TypeD0Ev[_ZN15Fl_Comment_TypeD5Ev]+0x21): undefined reference to `operator delete(void*, unsigned long)'
.
.
.
/usr/bin/ld: ../lib/libfltk_images.a(Fl_PNG_Image.o): in function `Fl_PNG_Image::~Fl_PNG_Image()':
Fl_PNG_Image.cxx:(.text._ZN12Fl_PNG_ImageD0Ev[_ZN12Fl_PNG_ImageD5Ev]+0x21): undefined reference to `operator delete(void*, unsigned long)'
/usr/bin/ld: ../lib/libfltk_images.a(Fl_PNG_Image.o): in function `Fl_PNG_Image::load_png_(char const*, unsigned char const*, int)':
Fl_PNG_Image.cxx:(.text._ZN12Fl_PNG_Image9load_png_EPKcPKhi+0x323): undefined reference to `operator new[](unsigned long)'
/usr/bin/ld: Fl_PNG_Image.cxx:(.text._ZN12Fl_PNG_Image9load_png_EPKcPKhi+0x356): undefined reference to `operator new[](unsigned long)'
/usr/bin/ld: Fl_PNG_Image.cxx:(.text._ZN12Fl_PNG_Image9load_png_EPKcPKhi+0x3b6): undefined reference to `operator delete[](void*)'
/usr/bin/ld: Fl_PNG_Image.cxx:(.text._ZN12Fl_PNG_Image9load_png_EPKcPKhi+0x400): undefined reference to `operator new(unsigned long)'
/usr/bin/ld: ../lib/libfltk_images.a(Fl_PNG_Image.o):(.data.rel.ro._ZTI12Fl_PNG_Image[_ZTI12Fl_PNG_Image]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
/usr/bin/ld: ../lib/libfltk_images.a(Fl_PNM_Image.o): in function `Fl_PNM_Image::~Fl_PNM_Image()':
Fl_PNM_Image.cxx:(.text._ZN12Fl_PNM_ImageD0Ev[_ZN12Fl_PNM_ImageD5Ev]+0x21): undefined reference to `operator delete(void*, unsigned long)'
/usr/bin/ld: ../lib/libfltk_images.a(Fl_PNM_Image.o): in function `Fl_PNM_Image::Fl_PNM_Image(char const*)':
Fl_PNM_Image.cxx:(.text._ZN12Fl_PNM_ImageC2EPKc+0x294): undefined reference to `operator new[](unsigned long)'
/usr/bin/ld: ../lib/libfltk_images.a(Fl_PNM_Image.o):(.data.rel.ro._ZTI12Fl_PNM_Image[_ZTI12Fl_PNM_Image]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:51: fluid] Error 1
make[1]: Leaving directory '/home/danhpc/Downloads/fltk-1.3.8-source/fltk-1.3.8/fluid'
make: *** [Makefile:22: all] Error 1
当链接过程开始时,似乎一切都变坏了。
我尝试安装旧版本。 我尝试安装所有依赖项,例如
sudo apt-get install autoconf
sudo apt-get install libx11-dev
sudo apt-get install libglu1-mesa-dev
These two are optional, but highly recommended:
sudo apt-get install libasound2-dev
sudo apt-get install libxft-dev
我什至尝试安装不同的 GUI 库,例如 wxwidget,但仍然有同样的问题。
我希望安装成功,并且测试运行将是 .
任何帮助将不胜感激OK
答: 暂无答案
评论
apt-get install libfltk1.3-dev
#include <FL/Fl.H>
fltk
wxwidget