| trialanderror usually (21) | ||||||
|
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:
if i include it in Main.cpp and use the class, the compiler gives an error: Main.cpp:
Compiler:
| ||||||
|
|
||||||
| HiteshVaghani1 (187) | |
|
you need to read Templates and multiple-file projects from blow links.. http://www.cplusplus.com/doc/tutorial/templates/ | |
|
|
|
| Peter87 (3691) | |||
I don't see what the problem is. This code compiles fine.
There must be some problem with the code that you have not shown or you are including the wrong file. | |||
|
|
|||
| trialanderror usually (21) | |
|
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? | |
|
|
|
| Peter87 (3691) | |||
Most likely not.
Hard to say without seeing the code. | |||
|
|
|||
| trialanderror usually (21) | |
|
The Problem sits 30cm from the Screen, like each time :D I modified the wrong file (same name but diffrent path) | |
|
|
|