标题: 如何在linux下编译fltk
coco_rainning
新生入学
Rank: 1



UID 208546
精华 0
积分 10(积分有什么用?)
帖子 41
阅读权限 10
注册 2007-8-23
状态 离线
发表于 2007-10-17 15:53  资料  个人空间  短消息  加为好友 
如何在linux下编译fltk

我现在 下载了fltk的1.17在redhat9中进行了安装,但是在启动fluid生成界面后却不知道该如何去编译,因为按照帮助文档里提供的hello.cxx 利用gcc  -o myhello myhello.cxx`fltk-config  --cxxflag` -l/usr/local/lib -X11 -Xext  -lm进行编译,但是却出错有很多错误,首先是X11找不到,随后是不存在Xext ,
我的源代码hello.cxx
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Box.H>

int main(int argc, char **argv) {
  Fl_Window *window = new Fl_Window(300,180);
  Fl_Box *box = new Fl_Box(20,40,260,100,"Hello, World!");
  box->box(FL_UP_BOX);
  box->labelsize(36);
  box->labelfont(FL_BOLD+FL_ITALIC);
  box->labeltype(FL_SHADOW_LABEL);
  window->end();
  window->show(argc, argv);
  return Fl::run();
}
我当时用的命令是
gcc `fltk-config --cxxflags` -o myhello hello.cxx  -L/usr/local/lib -I/usr/local/include/FL -lfltk -L/usr/X11R6/lib -lXext -lX11 -lm
编译时出的错误
/tmp/ccOKGP6s.o(.text+0x26): In function `main':
hello.cxx: undefined reference to `operator new(unsigned int)'
/tmp/ccOKGP6s.o(.text+0x53):hello.cxx: undefined reference to `operator new(unsigned int)'
/usr/local/lib/libfltk.a(Fl.o)(.text+0xff): In function `Fl::repeat_timeout(double, void (*)(void*), void*)':
Fl.cxx: undefined reference to `operator new(unsigned int)'
/usr/local/lib/libfltk.a(Fl.o)(.text+0x1fa): In function `Fl::add_check(void (*)(void*), void*)':
Fl.cxx: undefined reference to `operator new[](unsigned int)'
/usr/local/lib/libfltk.a(Fl.o)(.text+0x468):Fl.cxx: undefined reference to `operator delete[](void*)'
/usr/local/lib/libfltk.a(Fl.o)(.text+0x359): In function `Fl::remove_handler(int (*)(int))':
Fl.cxx: undefined reference to `operator delete(void*)'
/usr/local/lib/libfltk.a(Fl.o)(.text+0x13c6): In function `Fl_Window::hide()':
Fl.cxx: undefined reference to `operator delete(void*)'
/usr/local/lib/libfltk.a(Fl.o)(.text+0x13f5): In function `Fl_Window::~Fl_Window()':
Fl.cxx: undefined reference to `operator delete(void*)'
/usr/local/lib/libfltk.a(Fl_Box.o)(.gnu.linkonce.r._ZTI6Fl_Box[typeinfo for Fl_Box]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
/usr/local/lib/libfltk.a(Fl_Box.o)(.gnu.linkonce.t._ZN6Fl_BoxD0Ev[Fl_Box::~Fl_Box()]+0x1c): In function `Fl_Box::~Fl_Box()':
Fl_Box.cxx: undefined reference to `operator delete(void*)'
/usr/local/lib/libfltk.a(Fl_Group.o)(.text+0x4c): In function `Fl_Group::init_sizes()':
Fl_Group.cxx: undefined reference to `operator delete[](void*)'
/usr/local/lib/libfltk.a(Fl_Group.o)(.text+0x6f0): In function `Fl_Group::sizes()':
Fl_Group.cxx: undefined reference to `operator new[](unsigned int)'
/usr/local/lib/libfltk.a(Fl_Group.o)(.text+0x2a3): In function `Fl_Group::~Fl_Group()':
Fl_Group.cxx: undefined reference to `operator delete(void*)'
/usr/local/lib/libfltk.a(Fl_Group.o)(.gnu.linkonce.r._ZTI8Fl_Group[typeinfo for Fl_Group]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
/usr/local/lib/libfltk.a(Fl_arg.o)(.text+0x652): In function `Fl_Window::show(int, char**)':
Fl_arg.cxx: undefined reference to `operator new[](unsigned int)'
/usr/local/lib/libfltk.a(Fl_arg.o)(.text+0x69f):Fl_arg.cxx: undefined reference to `operator delete[](void*)'
/usr/local/lib/libfltk.a(Fl_get_system_colors.o)(.text+0x410): In function `Fl::reload_scheme()':
Fl_get_system_colors.cxx: undefined reference to `operator new(unsigned int)'
/usr/local/lib/libfltk.a(Fl_x.o)(.text+0x725): In function `Fl::copy(char const*, int, int)':
Fl_x.cxx: undefined reference to `operator delete[](void*)'
/usr/local/lib/libfltk.a(Fl_x.o)(.text+0x72f):Fl_x.cxx: undefined reference to `operator new[](unsigned int)'
/usr/local/lib/libfltk.a(Fl_x.o)(.text+0x8d3): In function `Fl_X::set_xid(Fl_Window*, unsigned long)':
Fl_x.cxx: undefined reference to `operator new(unsigned int)'
/usr/local/lib/libfltk.a(Fl_x.o)(.text+0x1150): In function `fl_handle(_XEvent const&)':
Fl_x.cxx: undefined reference to `operator delete[](void*)'
/usr/local/lib/libfltk.a(Fl_x.o)(.text+0x115e):Fl_x.cxx: undefined reference to `operator new[](unsigned int)'
/usr/local/lib/libfltk.a(fl_color.o)(.text+0x3ee): In function `fl_xpixel(Fl_Color)':
fl_color.cxx: undefined reference to `operator new[](unsigned int)'
/usr/local/lib/libfltk.a(fl_font.o)(.text+0x267): In function `fl_font(int, int)':
fl_font.cxx: undefined reference to `operator new(unsigned int)'
/usr/local/lib/libfltk.a(fl_font.o)(.text+0x47c):fl_font.cxx: undefined reference to `operator new(unsigned int)'
/usr/local/lib/libfltk.a(Fl_Image.o)(.text+0xa1): In function `Fl_RGB_Image::~Fl_RGB_Image()':
Fl_Image.cxx: undefined reference to `operator delete[](void*)'
/usr/local/lib/libfltk.a(Fl_Image.o)(.text+0x2ee): In function `Fl_RGB_Image::desaturate()':
Fl_Image.cxx: undefined reference to `operator new[](unsigned int)'
/usr/local/lib/libfltk.a(Fl_Image.o)(.text+0x36f):Fl_Image.cxx: undefined reference to `operator delete[](void*)'
/usr/local/lib/libfltk.a(Fl_Image.o)(.text+0x61c): In function `Fl_RGB_Image::copy(int, int)':
/usr/local/lib/libfltk.a(Fl_Menu_Window.o)(.text+0x47): In function `Fl_Menu_Window::~Fl_Menu_Window()':
Fl_Menu_Window.cxx: undefined reference to `operator delete(void*)'
/usr/local/lib/libfltk.a(Fl_Menu_Window.o)(.gnu.linkonce.r._ZTI14Fl_Menu_Window[typeinfo for Fl_Menu_Window]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
/usr/local/lib/libfltk.a(Fl_Pixmap.o)(.text+0x91): In function `Fl_Pixmap::delete_data()':
Fl_Pixmap.cxx: undefined reference to `operator delete[](void*)'
/usr/local/lib/libfltk.a(Fl_Pixmap.o)(.text+0x2e6): In function `Fl_Pixmap::draw(int, int, int, int, int, int)':
Fl_Pixmap.cxx: undefined reference to `operator delete[](void*)'
/usr/local/lib/libfltk.a(Fl_Pixmap.o)(.text+0x42b): In function `Fl_Pixmap::copy_data()':
Fl_Pixmap.cxx: undefined reference to `operator new[](unsigned int)'
/usr/local/lib/libfltk.a(Fl_Pixmap.o)(.text+0x448):Fl_Pixmap.cxx: undefined reference to `operator new[](unsigned int)'
/usr/local/lib/libfltk.a(Fl_Pixmap.o)(.text+0x711): In function `Fl_Pixmap::desaturate()':
Fl_Pixmap.cxx: undefined reference to `operator delete[](void*)'
/usr/local/lib/libfltk.a(Fl_Pixmap.o)(.text+0x730):Fl_Pixmap.cxx: undefined reference to `operator new[](unsigned int)'
/usr/local/lib/libfltk.a(Fl_Pixmap.o)(.text+0xa5a): In function `Fl_Pixmap::color_average(Fl_Color, float)':
Fl_Pixmap.cxx: undefined reference to `operator delete[](void*)'
/usr/local/lib/libfltk.a(Fl_Pixmap.o)(.text+0xa7d):Fl_Pixmap.cxx: undefined reference to `operator new[](unsigned int)'
/usr/local/lib/libfltk.a(Fl_Pixmap.o)(.text+0xad): In function `Fl_Pixmap::delete_data()':
Fl_Pixmap.cxx: undefined reference to `operator delete[](void*)'
/usr/local/lib/libfltk.a(Fl_Pixmap.o)(.text+0xe2): In function `Fl_Pixmap::~Fl_Pixmap()':
Fl_Pixmap.cxx: undefined reference to `operator delete(void*)'
/usr/local/lib/libfltk.a(Fl_Pixmap.o)(.gnu.linkonce.r._ZTI9Fl_Pixmap[typeinfo for Fl_Pixmap]+0x0): /usr/local/lib/libfltk.a(Fl_Tiled_Image.o)(.text+0xfc): In function `Fl_Tiled_Image::copy(int, int)':
/usr/local/lib/libfltk.a(fl_draw_image.o)(.text+0xded):fl_draw_image.cxx: undefined reference to `operator new[](unsigned int)'
/usr/local/lib/libfltk.a(fl_draw_pixmap.o)(.text+0x21b): In function `fl_draw_pixmap(char const* const*, int, int, Fl_Color)':
fl_draw_pixmap.cxx: undefined reference to `operator new[](unsigned int)'
/usr/local/lib/libfltk.a(fl_draw_pixmap.o)(.text+0x377):fl_draw_pixmap.cxx: undefined reference to `operator new[](unsigned int)'
/usr/local/lib/libfltk.a(fl_draw_pixmap.o)(.text+0x54e):fl_draw_pixmap.cxx: undefined reference to `operator delete[](void*)'/usr/local/lib/libfltk.a(Fl_Bitmap.o)(.text+0x60): In function `fl_create_alphamask(int, int, int, int, unsigned char const*)':
Fl_Bitmap.cxx: undefined reference to `operator new[](unsigned int)'
/usr/local/lib/libfltk.a(Fl_Bitmap.o)(.text+0x103):Fl_Bitmap.cxx: undefined reference to `operator delete[](void*)'
/usr/local/lib/libfltk.a(Fl_Bitmap.o)(.text+0x3d7):Fl_Bitmap.cxx: undefined reference to `operator new(unsigned int)'
/usr/local/lib/libfltk.a(Fl_Bitmap.o)(.text+0x1d3): In function `Fl_Bitmap::~Fl_Bitmap()':
Fl_Bitmap.cxx: undefined reference to `operator delete(void*)'
/usr/local/lib/libfltk.a(Fl_Bitmap.o)(.gnu.linkonce.r._ZTI9Fl_Bitmap[typeinfo for Fl_Bitmap]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
/usr/local/lib/libfltk.a(Fl_Button.o)(.gnu.linkonce.t._ZN9Fl_ButtonD0Ev[Fl_Button::~Fl_Button()]+0x1c): In function `Fl_Button::~Fl_Button()':
Fl_Button.cxx: undefined reference to `operator delete(void*)'
collect2: ld returned 1 exit status






这个错误长了些所以只把最重要的传了上来。还请多多指点。

请各位高手指点一二,不胜感激!多谢!

顶部
不容错过的IBM 集群技术资源汇总
coco_rainning
新生入学
Rank: 1



UID 208546
精华 0
积分 10(积分有什么用?)
帖子 41
阅读权限 10
注册 2007-8-23
状态 离线
发表于 2007-10-18 22:26  资料  个人空间  短消息  加为好友 
请各位帮帮忙吧!

我今天又试了一天但是仍然编不过去,还请各位高手帮帮忙!
多谢!!

顶部
不容错过的IBM 集群技术资源汇总
AIKO_sex
特聘作家
Rank: 5Rank: 5
伊甸园杰出贡献会员



UID 12054
精华 20
积分 41(积分有什么用?)
帖子 11558
阅读权限 10
注册 2002-3-20
状态 离线
发表于 2007-10-18 22:34  资料  个人空间  短消息  加为好友 
没有安装或者安装全xfree86开发包





象一阵风 拂过我身边 忽然间 想要去很远 和你去看繁华世界
顶部
 



当前时区 GMT+8, 现在时间是 2008-5-18 11:21

    Powered by Discuz! 5.5.0  © 2001-2007 Comsenz Inc.
Processed in 0.053495 second(s), 5 queries

清除 Cookies - 联系我们 - Linux伊甸园 - Archiver - WAP