Re: Code compiles with g++ 3.3 but not g++ 4.4

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

 



Hi David,

On Fri, Oct 16, 2009 at 10:58:33AM -0700, daviddoria wrote:
> 
> With this code:
> http://www.rpi.edu/~doriad/Daniweb/maxflow/
> If I run
> 
> g++ Example.cpp graph.cpp
> 
> with g++ 3.3, everything works fine. However if I run the same command with
> g++ 4.4, I get this error:
> 
> Example.cpp:(.text+0x38): undefined reference to `Graph<int, int,
> int>::Graph(int, int, void (*)(char*))'
as far as I understand the C++ - standard, the statement "template class
Graph<int,int,int>;" does define the class "Graph<int,int,int>" and
declare all member functions. However, it does NOT define the member
functions of Graph<init,int,int>.
> Does anyone know how I can get this to work with g++ 4.4?
If you explicitely instantiate the template member function, it will
work:

template class Graph<int,int,int>::Graph(int, int, void (*)(char *));


(Besides: your code does not compile - "NULL" is not defined, you should
a e.g. #include <cstdlib> :-)

HTH,

Axel

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux