Gundamflare
10-16-05, 05:59 PM
Hey guys,
I've got an error that I can't pin down, and it's quite upsetting that it would happen during linking, especially when I'm almost done!
Anyway, the error is
LinkedList.o:LinkedList.cpp:(.bss+0x0): multiple definition of `_DEFAULT'
LinkTest.o:LinkTest.cpp:(.bss+0x0): first defined here
LinkedList.o:LinkedList.cpp:(.bss+0x4): multiple definition of `_INIT'
LinkTest.o:LinkTest.cpp:(.bss+0x4): first defined here
LinkedList.o:LinkedList.cpp:(.data+0x0): multiple definition of `_NULLVAL'
LinkTest.o:LinkTest.cpp:(.data+0x0): first defined here
collect2: ld returned 1 exit status
DEFAULT, INIT, NULLVAL are all global definitions (as per instructor's instructions)
and the file hierarchy is something like this:
LinkedList.h <-Interface
LinkedList.cpp <-Implementation
LinkTest.cpp <-Client program / Tester
cygwin commands:
$ g++ -c LinkedList.h LinkedList.cpp LinkTest.cpp
no errors
$ g++ LinkedList.o LinkTest.o -o Linktest.exe
Get the above error.
I conditionally compiled the .h so I'm not sure why I'm getting that error! meaning i have:
#ifndef LINKEDLIST_H
#define LINKEDLIST_H
//code
#endif
Any ideas? Will post source if necesary, but would rather not want to.
I've got an error that I can't pin down, and it's quite upsetting that it would happen during linking, especially when I'm almost done!
Anyway, the error is
LinkedList.o:LinkedList.cpp:(.bss+0x0): multiple definition of `_DEFAULT'
LinkTest.o:LinkTest.cpp:(.bss+0x0): first defined here
LinkedList.o:LinkedList.cpp:(.bss+0x4): multiple definition of `_INIT'
LinkTest.o:LinkTest.cpp:(.bss+0x4): first defined here
LinkedList.o:LinkedList.cpp:(.data+0x0): multiple definition of `_NULLVAL'
LinkTest.o:LinkTest.cpp:(.data+0x0): first defined here
collect2: ld returned 1 exit status
DEFAULT, INIT, NULLVAL are all global definitions (as per instructor's instructions)
and the file hierarchy is something like this:
LinkedList.h <-Interface
LinkedList.cpp <-Implementation
LinkTest.cpp <-Client program / Tester
cygwin commands:
$ g++ -c LinkedList.h LinkedList.cpp LinkTest.cpp
no errors
$ g++ LinkedList.o LinkTest.o -o Linktest.exe
Get the above error.
I conditionally compiled the .h so I'm not sure why I'm getting that error! meaning i have:
#ifndef LINKEDLIST_H
#define LINKEDLIST_H
//code
#endif
Any ideas? Will post source if necesary, but would rather not want to.