免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 6580 | 回复: 2
打印 上一主题 下一主题

[已解决]undefined reference to构造函数和析构函数 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-10-28 09:52 |只看该作者 |倒序浏览
大家好,我在http://www.gtkmm.org/docs/gtkmm- ... drawingarea/simple/
尝试编译教程给出的demo,结果我这里Make输出的是,我已经详细对了代码,和教程给的一样,除了我自己修改了make -o为drawline之外,其他并无任何差别。已经google了好久,没找到解决方法,请大家帮我看看。

  1. g++ main.cc -o drawline `pkg-config gtkmm-2.4 --cflags --libs`
  2. /tmp/ccv6G64L.o: In function `main':
  3. main.cc:(.text+0xa8): undefined reference to `MyArea::MyArea()'
  4. main.cc:(.text+0xe2): undefined reference to `MyArea::~MyArea()'
  5. main.cc:(.text+0xfb): undefined reference to `MyArea::~MyArea()'
  6. collect2: ld returned 1 exit status
  7. make: *** [drawline] Error 1
复制代码


附上我的环境:

g++ -v的输出:

  1. Using built-in specs.
  2. Target: i486-linux-gnu
  3. Configured with: ../src/configure -v --with-pkgversion='Debian 4.3.2-1' --with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3 --program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-targets=all --enable-cld --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu
  4. Thread model: posix
  5. gcc version 4.3.2 (Debian 4.3.2-1)
复制代码


make -v的输出:
  1. make -v
  2. GNU Make 3.81
  3. Copyright (C) 2006  Free Software Foundation, Inc.
  4. This is free software; see the source for copying conditions.
  5. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
  6. PARTICULAR PURPOSE.

  7. This program built for i486-pc-linux-gnu
复制代码


gtkmm库装的是libgtkmm-2.4版本的

系统是debian lenny 更新到最新状态。
请大家帮帮我,谢谢。

[ 本帖最后由 ganquanvip 于 2008-10-28 10:48 编辑 ]

论坛徽章:
0
2 [报告]
发表于 2008-10-28 10:09 |只看该作者
MyArea,你在哪个文件定义的?链接时加上其目标文件

论坛徽章:
0
3 [报告]
发表于 2008-10-28 10:47 |只看该作者
谢谢楼上大哥。解决了。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP