![]() |
| | #1 |
| The wheel reinvent0^r Join Date: Aug 2008 Location: Србија
Posts: 115
| Static libraries and template functions My question is how do I create static libraries with template functions? |
| hauzer is offline | |
| | #2 |
| Kernel hacker Join Date: Jul 2007 Location: Farncombe, Surrey, England
Posts: 15,686
| The entire template implementation needs to be in a header file when using templates. -- Mats
__________________ Compilers can produce warnings - make the compiler programmers happy: Use them! Please don't PM me for help - and no, I don't do help over instant messengers. |
| matsp is offline | |
| | #3 |
| The wheel reinvent0^r Join Date: Aug 2008 Location: Србија
Posts: 115
| Ahh.. so there's no way.. |
| hauzer is offline | |
| | #4 |
| Kernel hacker Join Date: Jul 2007 Location: Farncombe, Surrey, England
Posts: 15,686
| Well, at least not if you: 1. Want to be able to compile it with most common compilers. 2. Do not want to write EVERY implementation that you could possibly conceive - this is really what prevents it from linking is that the way the templates work is that the code is generated as needed by the compiler. If you actually write Code: stack::push<int>(int)
{
... // Code that pushes an integer onto a stack<int>
}
But the whole point of using templates is generally that you do not WANT to write every variant of every function that you have templates for. -- Mats
__________________ Compilers can produce warnings - make the compiler programmers happy: Use them! Please don't PM me for help - and no, I don't do help over instant messengers. |
| matsp is offline | |
| | #5 |
| The wheel reinvent0^r Join Date: Aug 2008 Location: Србија
Posts: 115
| Okay, thank you. |
| hauzer is offline | |
![]() |
| Tags |
| functions, library, problem, static library, templates |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| error: template with C linkage | michaels-r | C++ Programming | 3 | 05-17-2006 08:11 AM |
| im extreamly new help | rigo305 | C++ Programming | 27 | 04-23-2004 11:22 PM |
| Prime Number Generator... Help !?!! | Halo | C++ Programming | 9 | 10-20-2003 07:26 PM |
| include question | Wanted420 | C++ Programming | 8 | 10-17-2003 03:49 AM |
| Borland, libraries, and template member functions | roktsyntst | C++ Programming | 0 | 06-01-2003 09:52 PM |