multiple definition ; first defined here
来源:互联网 发布:长图文制作软件 编辑:程序博客网 时间:2024/05/21 08:40
main.o(.data+0x0): multiple definition of `rect'
renlianjiance.o(.data+0x0): first defined here
main.o(.data+0x880): multiple definition of `LBP_tree'
renlianjiance.o(.data+0x880): first defined here
main.o(.data+0x2080): multiple definition of `LBP'
renlianjiance.o(.data+0x2080): first defined here
main.o(.data+0x2120): multiple definition of `std_g_jh'
renlianjiance.o(.data+0x2120): first defined here
collect2: ld returned 1 exit status
renlianjiance.o(.data+0x0): first defined here
main.o(.data+0x880): multiple definition of `LBP_tree'
renlianjiance.o(.data+0x880): first defined here
main.o(.data+0x2080): multiple definition of `LBP'
renlianjiance.o(.data+0x2080): first defined here
main.o(.data+0x2120): multiple definition of `std_g_jh'
renlianjiance.o(.data+0x2120): first defined here
collect2: ld returned 1 exit status
make: *** [renlianjiance] Error 1
这是我做人脸检测时候的一个错误。该错误的原因是在头文件中定义了数组或者数据结构并且初始化。
#ifndef STRUCT_TREE
#define STRUCT_TREE
struct tree
{
int rect_number;
signed int feature[8];
float leafvalue[2];
}struct tree LBP_tree[139]={};//没有将定义和初始化分来
#endif
尽管使用了#ifndef #define *****#endif 语句来避免重复包含,这在编译的时候可以通过,但是在链接的时候就会产生上述错误。初始化后分配了空间,会使得所有引用了相同头文件的文件都包含了初始化的数据。
以下是我的更改:
#ifndef STRUCT_TREE
#define STRUCT_TREE
struct tree
{
int rect_number;
signed int feature[8];
float leafvalue[2];
};
#endif
struct tree LBP_tree[139]={};//将定义和初始化分来
然后再使用到struct tree的文件里面使用
#ifndef STRUCT_TREE
#define STRUCT_TREE
struct tree
{
int rect_number;
signed int feature[8];
float leafvalue[2];
};
#endif
这样就可以了,避免了重复定义,重复分配空间。其他的错误一次解决。
- multiple definition ; first defined here
- C++ "multiple definition of .. first defined here" 错误的修改
- C++ "multiple definition of .. first defined here 错误的修改
- multiple definition of `main' /(text+0x0): first defined here
- C++的multiple definition of *** first defined here错误
- qtopia 编译程序中出现的重复问题---multiple definition of 、first defined 等问题的解决
- C++ 解决 multiple definition of & previous definition here编译错误
- main.cpp first defined here 解决
- multiple definition
- sqlite3fun.c:155: first defined here execSqlite3 closeSqlite3 getSqlite3dbName编译不通过
- "multiple definition of" 错误
- multiple definition of...
- multiple definition of...
- 解决 multiple definition of
- extern: multiple definition of
- gcc: multiple definition of
- multiple definition of XXXX
- 解决 multiple definition of
- 设计一个个人纳税计算程序
- SQL Serve 分页方式
- Programming Perl----------Column1
- 如果有一天你没有了动力,可以看看
- 百度之星-百度的新大厦
- multiple definition ; first defined here
- The difference between Proxy and CGLIB
- 1000~2000之间能同时被17和37整除的数的编程
- SuperParsing: Scalable Nonparametric Image Parsing with Superpixels
- 机器学习中的相似性度量
- 怀念一下我的博客!关闭了,把一些文章搬来csdn
- 模式识别简介(2) 分析框架
- The difference between Proxy and CGLIB
- 无线有线网络