如题。请问vs2013里面如何调用vs2010生成的lib文件,因为没有源码,只有头文件和lib文件,所以无法重新生成vs2013版本的lib
在你的vs2013里使用vc2010的编译器,同时安装好vs2010,在compiler/linker/libraries (project properties->General->Platform toolset可以设置。
或者用vs2010将lib编译为dll,再在2013调用。
你这个说得就有问题了,调用动lib是用不着有源码的,调用时候只要包含了头文件和lib文件就行,别说是vs2010做的,就算用vc6做的都不会有什么障碍;
当然你只提到有lib,我姑且理解为静态库,调用方法:
#include " 头文件”
#pragma comment(lib,“lib文件”)
如果是平台冲突,你2013工程里面可以选一下编译平台试试:
不管是静态库,动态库,都不建议不同版本混合,因为你很可能会用到一些不兼容的类库等,而造成一些比较奇怪的问题,最好是用vs2010包一个exe来加载vs2010的lib,然后你vs2013的库等和这个exe进行通信等来进行功能交互
If you are distributing static libraries, you may be able to distribute version-independent libraries, depending on exactly what you are doing. If you are only making calls to the OS, then you may be OK. C RTL functions, maybe. But if you use any C++ Standard Library functions, classes, or templates, then probably not.
If distributing DLLs, you will need separate libraries for each VS version. Sometimes you even need separate libraries for various service-pack levels. And as mentioned by VolkerK, users of your library will have to use compatible compiler and linker settings. And even if you do everything right, users may need to link with other libraries that are somehow incompatible with yours.
Due to these issues, instead of spending time trying to build all these libraries for your users, I'd spend the time making them as easy to build as possible, so that users can can build them on their own with minimal fuss.