multiple definition of `std::abs(long)'

  • Thread starter Philipp Klaus Krause
  • Start date
P

Philipp Klaus Krause

I just tried to compile some old code that seemed fine some time ago.
When linking I get lots of errors like:

colecovision.o: In function `std::abs(long)':
/usr/include/c++/4.3/cstdlib:144: multiple definition of `std::abs(long)'
z80.o:/usr/include/c++/4.3/cstdlib:144: first defined here

And so on for some other functions from the standard library. I use
g++-4.3. Lines 143 and 144 from cstdlib are:

inline long
abs(long __i) { return labs(__i); }

Philipp
 
P

Philipp Klaus Krause

Philipp said:
I just tried to compile some old code that seemed fine some time ago.
When linking I get lots of errors like:

colecovision.o: In function `std::abs(long)':
/usr/include/c++/4.3/cstdlib:144: multiple definition of `std::abs(long)'
z80.o:/usr/include/c++/4.3/cstdlib:144: first defined here

And so on for some other functions from the standard library. I use
g++-4.3. Lines 143 and 144 from cstdlib are:

inline long
abs(long __i) { return labs(__i); }

Philipp

Sorry to bother you with this. While trying to get a small example
suitable for posting in this group out of the code I noticed that
somewhere an old include file had a #define inline in it (I suppose some
leftover from C code which was written in C99 first and then changed to
compile on ANSI C compilers).

Philipp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top