A random guess… the ‘cerr’ bit suggests that something is looking for iostream and not finding it? I agree that it looks more like a linker error, though.
Thanks for the reply. I should have put the complete message here.
/home/oberhuber/local/include/tnl-0.1/core/tnlField2D.h(28): error: identifier “_ZSt4cerr” is undefined
/home/oberhuber/local/include/tnl-0.1/core/tnlField2D.h(28): warning: a value of type “int” cannot be assigned to an entity of type “struct _ZSo *”
and here is the code
21 #include
22 #include <core/tnlLongVectorHost.h>
23
24 using namespace std;
25
26 template< class T > class tnlFieldCUDA2D;
27
28 template< class T > class tnlField2D : public tnlLongVector< T >
29 {
30 public:
31
32 tnlField2D( const char* name = 0 )
33 : tnlLongVector< T >( name )
34 {
35 };
I have added the lines 21 and 24 just because of the error message. They were not in the code before. I don’t get the message if I remove the line 26. This code can be compiled with gcc without errors.
This is the smallest one giving the error message.
//------------------------------------------------------- #include
using namespace std;
enum tnlDevice { tnlHost, tnlCuda };
class tnlObject
{
public:
tnlObject();
virtual ~tnlObject(){};
};
template< typename T, tnlDevice device > class tnlLongVector : public tnlObject
{
};
template< class T > class tnlLongVector< T, tnlCuda > : public tnlObject
{
public:
~tnlLongVector()
{
cerr << “Unable to free alocated memory on CUDA device of .” << endl;
};
};
template< class T > class tnlGridCUDA2D : public tnlLongVector< T, tnlCuda >
{
public:
tnlGridCUDA2D( )
{
};
};
template class tnlGridCUDA2D< double >;
//---------------------------------------------------------------------------------------
Btw, there seems to be another problem with the templates parsing. Try this code:
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2009 NVIDIA Corporation
Built on Fri_Feb_19_19:12:59_PST_2010
Cuda compilation tools, release 3.0, V0.2.1221
I get this
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 0 has invalid symbol index 11
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 1 has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 2 has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 3 has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 4 has invalid symbol index 11
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 5 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 6 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 7 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 8 has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 9 has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 10 has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 11 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 12 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 13 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 14 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 15 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 16 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 17 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 18 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 19 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 20 has invalid symbol index 20
/usr/lib/gcc/x86_64-linux-gnu/4.3.4/../../../../lib/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
/tmp/tmpxft_000008f0_00000000-12_bug.o: In function `tnlLongVector<double, (tnlDevice)1>::tnlLongVector()':
tmpxft_000008f0_00000000-1_bug.cudafe1.cpp:(.text._ZN13tnlLongVectorIdL9tnlDevice1EEC2Ev[tnlLongVector<double, (tnlDevice)1>::tnlLongVector()]+0x11): undefined reference to `tnlObject::tnlObject()'
collect2: ld returned 1 exit status
which is ok. The weird message comes from nvcc version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2010 NVIDIA Corporation
Built on Mon_Jun__7_18:56:31_PDT_2010
Cuda compilation tools, release 3.1, V0.2.1221
Concerning the second bug - you are right, is is not a problem of nvcc, g++ does not accept it either eventhough it should I think.