i has a Qt application which i am converting to normal C++ . I may seem odd because most of the people try the reverse. I had some parallelization problem with Qt and this is why i am getting back to basic.
I am having compilation error now which compiled fine with Qt. The error is as follows:
1 2 3 4 5 6 7 8 9 10 11
kdtree.cpp:39: error: expected constructor, destructor, or type conversion before ‘<’ token
kdtree.cpp:49: error: expected constructor, destructor, or type conversion before ‘<’ token
kdtree.cpp:57: error: expected initializer before ‘<’ token
kdtree.cpp:169: error: expected initializer before ‘<’ token
kdtree.cpp:287: error: expected initializer before ‘<’ token
kdtree.cpp:345: error: expected initializer before ‘<’ token
kdtree.cpp:421: error: expected initializer before ‘<’ token
kdtree.cpp:446: error: expected initializer before ‘<’ token
kdtree.cpp:501: error: expected initializer before ‘<’ token
kdtree.cpp:522: error: expected initializer before ‘<’ token
On the lines(line 39) where the error showed up is as follows:
I don't see anything wrong with the above code snippet either, can you post more code? Also, if KDTree is used in any other compilation unit your implementation for the template class will need to be in the header or you will not be able to link.
The issue is solved . I forgot the fact that gcc do not like to separate the template class declaration and definition in separate .h and .cpp files respectively.
Now i have the declared and defined the template class functions in the same header file and it compiles fine.