• Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at \$59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.

Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!

### #Actualkloffy

Posted 07 April 2013 - 11:52 PM

I use templates in some of my projects and have been using "Method 1" (or as he writes, "Mehtod 1") to get around linking errors. Although, I too use only MSVC (haven't gotten a chance to learn how to use GNU tools yet).

It looks like "Method 1" is just a backward way to get explicit template instantiation (as mentioned by SiCrane). I think the usual syntax would be something like:

template class GENERIC_STACK<int>;

Edit: And "Method 3" is generally done like AllEightUp described (all code ends up in the header)...

### #4kloffy

Posted 07 April 2013 - 11:51 PM

I use templates in some of my projects and have been using "Method 1" (or as he writes, "Mehtod 1") to get around linking errors. Although, I too use only MSVC (haven't gotten a chance to learn how to use GNU tools yet).

It looks like "Method 1" is just a backward way to get explicit template instantiation as mentioned by SiCrane. I think the usual syntax would be something like:

template class GENERIC_STACK<int>;

Edit: And "Method 3" is generally done like AllEightUp described (all code ends up in the header)...

### #3kloffy

Posted 07 April 2013 - 11:51 PM

I use templates in some of my projects and have been using "Method 1" (or as he writes, "Mehtod 1") to get around linking errors. Although, I too use only MSVC (haven't gotten a chance to learn how to use GNU tools yet).

It looks like "Method 1" is just a backward way to get explicit template instantiation as mentioned by SiCrane. I think the usual syntax would be something like:
template class GENERIC_STACK<int>;
Edit: And "Method 3" is generally done like AllEightUp described (all code ends up in the header)...

### #2kloffy

Posted 07 April 2013 - 11:50 PM

I use templates in some of my projects and have been using "Method 1" (or as he writes, "Mehtod 1") to get around linking errors. Although, I too use only MSVC (haven't gotten a chance to learn how to use GNU tools yet).

It looks like "Method 1" is just a backward way to get explicit template instantiation as mentioned by SiCrane. I think the usual syntax would be something like:
template class GENERIC_STACK<int>;
Edit: "Method 3" is generally done like AllEightUp described...

### #1kloffy

Posted 07 April 2013 - 11:45 PM

I use templates in some of my projects and have been using "Method 1" (or as he writes, "Mehtod 1") to get around linking errors. Although, I too use only MSVC (haven't gotten a chance to learn how to use GNU tools yet).

It looks like "Method 1" is just a backward way to get explicit template instantiation (as mentioned by SiCrane). I think the usual syntax would be something like:
template class GENERIC_STACK<int>;

PARTNERS