Problem with Template-Application

Hey Guys,

here i am again :)

I have to declare a template class or template struct in a header, so i can use it later only with an include.

Thats my declaration in the header test.h:

1
2
3
4
5
6
7
8
9
10
11
namespace LL1000
{
...
template<typename T>
class test
{
  public:
    T Value;
};
...
}


if i include it in Main.cpp and use the class, the compiler gives an error:

Main.cpp:
1
2
3
4
5
6
7
8
9
10
11
...
#include "test.h"
...
...
int main(int argc, char* argv[])
{
...
LL1000::test<int> oTestobjekt;
...
}


Compiler:

error C2039: 'test' : is not a member of 'LL1000'
you need to read Templates and multiple-file projects from blow links..
http://www.cplusplus.com/doc/tutorial/templates/
I don't see what the problem is. This code compiles fine.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
namespace LL1000
{
template<typename T>
class test
{
public:
	T Value;
};
}


int main(int argc, char* argv[])
{
	LL1000::test<int> oTestobjekt;
}

There must be some problem with the code that you have not shown or you are including the wrong file.
Hmm...

If i put it in main.cpp it works fine.
But if i put it in a Header (which contains another class), it wont.

Now i replace the template-class for testing with a simple int variable calls "var". He says its not a member of LL1000, although my addin shows "var" as a member of LL1000...

The clou is: I can instantiate an object of the other class in the same header and namespace without a compiler error. WTF is wrong?

Is there maybe a Problem with the Compiler?
Is there maybe a Problem with the Compiler?

Most likely not.

WTF is wrong?

Hard to say without seeing the code.
The Problem sits 30cm from the Screen, like each time :D

I modified the wrong file (same name but diffrent path)
Topic archived. No new replies allowed.