help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

strange link problem


From: arcimboldo
Subject: strange link problem
Date: 7 Mar 2006 03:44:29 -0800
User-agent: G2/0.2

Hello,

I got a strange link problem; here are the simplest files showing the
error:

a.h::
  #include <utility>

  class a{
   public:
    typedef int perm;
    static const perm PERM_NONE = 0;
    a();
  private:
    std::pair<int, perm> aaa;
  };

a.cpp::
  #include "a.h"
  a::a() : aaa(0,PERM_NONE) { }
  main () { }

Compiling with g++ (GCC) 3.3.5 (Debian 1:3.3.5-13) I get::

  $ g++ a.cpp
  /tmp/ccKKUXg8.o: In function
`a::a[not-in-charge]()':a.cpp:(.text+0xa): undefined reference to
`a::PERM_NONE'
  /tmp/ccKKUXg8.o: In function `a::a[in-charge]()':a.cpp:(.text+0x34):
undefined reference to `a::PERM_NONE'
  collect2: ld returned 1 exit status

The file compiles correctly, the error shows up only when linking.

What could it possibly be? Thanks for any help!

Arcimboldo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]