[英]Huge compilation time when linking with library using boost::serialization
Hello and thanks for reading. 您好,感谢您的阅读。
I have a dynamic library using boost::serialization with about 200 different classes. 我有一个使用boost :: serialization的动态库,其中包含约200个不同的类。 I use this library in my program, thanks to the header messageExports.h, which looks like this :
由于标题messageExports.h,我在程序中使用了这个库,它看起来像这样:
#include "classe1.h"
//...
#include "classe200.h"
BOOST_CLASS_EXPORT(ns::classe1);
//...
BOOST_CLASS_EXPORT(ns::classe200);
But the file including messaeExports.h needs a really long time to compile, and this each time I modify it. 但是包括messaeExports.h在内的文件需要很长时间才能编译,而每次我修改它时都需要编译一次。 As I am using Qt and qmake, i tried the PRECOMPILED_HEADERS method but it took a lot more time than without, and it seems qmake adds the precompiled header to each obj file.
当我使用Qt和qmake时,我尝试了PRECOMPILED_HEADERS方法,但是花了比没有更多的时间,而且qmake似乎将预编译的标头添加到每个obj文件中。
Do you have idea how I could reduce my compilation time ? 您知道我可以如何减少编译时间吗? Is it possible to rearrange the messageExport.h header to avoid the boost export defines ?
是否可以重新排列messageExport.h标头,以避免boost导出定义?
Thank you in advance, 先感谢您,
Roland 罗兰
Seeing sample code would probably help, but... 看到示例代码可能会有所帮助,但是...
Can you remove common, boilerplate code from "classe*.h" easily? 您可以轻松地从“ classe * .h”中删除通用的样板代码吗?
Use include guards to prevent multiple includes of the same file? 使用包含防护措施来防止同一文件的多个包含?
// File: ---classe1.h---
#ifndef __CLASSE1_H_INCLUDED
#define __CLASSE1_H_INCLUDED
// Stuff goes here
// Here
// Here (ad naseum)
#endif // __CLASSE1_H_INCLUDED
// End Of File: ---classe1.h---
Just a few suggestions... 只是一些建议...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.