multiple definition of `__start__Z

Jun 16, 2010 at 3:56pm
mytest/lib/libtest.a(utils.r): In function `__stop__ZN9__gnu_cxx13new_allocatorISt4pairIKSsSsEE9constructEPS3_RKS3_':
/local/jsn/utils/Buffer.cpp:159: multiple definition of `__start__ZnwjPv'
collect2: ld returned 1 exit status

I have a class Buffer contained only static methods as follow

File: Buffer.h
class Buffer{
....
static int foo();
....
};

File: Buffer.cpp
...
int Buffer::foo(){
...
}

Could some one explain what this means?

1. `__stop__'
2. multiple definition of `__start__ZnwjPv' What does __start imply?

Thanks
Jun 16, 2010 at 6:52pm
Make sure your Buffer.h file has the following structure:
1
2
3
4
5
6
7
8
9
#pragma once
#ifndef BUFFER_H
#define BUFFER_H

class Buffer {
  ...
};

#endif 

Let us know if that does not solve your problem. (There are other, more obscure, reasons it could happen.)
Jun 16, 2010 at 8:37pm
Buffer.h already has "prama once", but still having the same error
Last edited on Jun 17, 2010 at 1:48am
Topic archived. No new replies allowed.