#11 Several includes of <tclap/CmdLine.h> produces linker error

closed-accepted
None
3
2008-05-22
2008-03-04
No

When including the <tclap/CmdLine.h> header into several compiled files, linking is impossible due to multiple definitions. g++ complains with:

A.o: In function `TCLAP::MultiSwitchArg::longID(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const':
A.cc:(.text+0xb0): multiple definition of `TCLAP::MultiSwitchArg::longID(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
test.o:test.cc:(.text+0xc0): first defined here
A.o: In function `TCLAP::MultiSwitchArg::shortID(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const':
A.cc:(.text+0x230): multiple definition of `TCLAP::MultiSwitchArg::shortID(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
test.o:test.cc:(.text+0x240): first defined here
A.o: In function `TCLAP::OptionalUnlabeledTracker::check(bool, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
A.cc:(.text+0x3b0): multiple definition of `TCLAP::OptionalUnlabeledTracker::check(bool, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
test.o:test.cc:(.text+0x3c0): first defined here
collect2: ld returned 1 exit status
make: *** [spheres] Error 1
make: Target `all' not remade because of errors.

A minimal testcase follows:

A.cc:
---------------
#include <tclap/CmdLine.h>
---------------

test.cc:
---------------
#include <tclap/CmdLine.h>

int main()
{
return 0;
}
---------------

Discussion

  • Daniel Aarno

    Daniel Aarno - 2008-05-19
    • priority: 5 --> 3
    • assigned_to: nobody --> macbishop
    • status: open --> open-accepted
     
  • Daniel Aarno

    Daniel Aarno - 2008-05-22
    • status: open-accepted --> closed-accepted
     
  • Daniel Aarno

    Daniel Aarno - 2008-05-22

    Logged In: YES
    user_id=330479
    Originator: NO

    This issue is no longer reproducible with the latest CVS HEAD.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks