开发者

Differences between template class implemenations in C++ on Linux and MSVC Win32

I'm trying to port some old Linux code to run on Windows and am running into a whole bunch of compiler errors that seem to be stemming from the considerable use of template classes. Are there really any significant differences between how templates must be implemented for linux vs MSVC? If so, could someone give an over开发者_高级运维view of what's actually different? I've found lots of documentation, but nothing that actually lays down what the differences are.


The C++ language is defined by the C++ Standard - it isn't an operating system specific thing. How well the Standard is implemented varies from compiler to compiler, not from OS to OS.

Having said that, if it is very old code, you will probably find that the modern compilers on both Windows and Linux won't compile it. This is because these modern compilers are much stricter in their adherence to the C++ Standard, and chuck out code that earlier and less compliant compilers would have let slide.

Bottom line - you need to address each error on its own terms. Or possibly junk the code, if it is really, really old.


It's going to depend a lot on the versions of compilers you are using both on Windows and on Linux. So I think the only way is to go through and fix the errors one by one.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜