Fast Qt C++ compile on windows

I have a large project that uses the Qt framework and am trying to find the fastest way to compile it on my Windows install. On my linux machine at home I use 3 year old Linux Mint setup with a dual core (the machine is 3 years old not Linux Mint install), using: make -j2 both cores are used full(ish) and compiles the code relatively quick, around 10 minutes from clean build. However on my wo

在Windows上快速Qt C ++编译

我有一个使用Qt框架的大型项目,并试图找到在我的Windows安装上编译它的最快方法。 在我家的linux机器上,我使用了3年前的Linux Mint安装程序和一个双核心(机器是3年的时间,而不是Linux Mint安装),使用:make -j2两个核心都使用完整(ish)并且编译代码相对较快,从干净的构建大约10分钟。 然而,在我的工作Windows PC 2.0 GHz英特尔酷睿2四核(XP)我似乎无法让编译速度与我的Linux机器一样快。 该程序的开发人员文档

Why does C++ linking use virtually no CPU?

On a native C++ project, linking right now can take a minute or two. Yet, during this time CPU drops from 100% during compilation to virtually zero. Does this mean linking is primarily a disk activity? If so, is this the main area an SSD would make big changes? But, why aren't all my OBJ files (or as many as possible) kept in RAM after compilation to avoid this? With 4 GB of RAM I shoul

为什么C ++链接几乎不使用CPU?

在本地C ++项目上,现在链接可能需要一两分钟。 然而,在此期间,CPU在编译期间从100%下降到几乎为零。 这是否意味着链接主要是磁盘活动? 如果是这样,这是SSD将发生重大变化的主要领域吗? 但是,编译完成后,为什么不把所有OBJ文件(或尽可能多)保存在RAM中以避免这种情况? 有了4 GB的RAM,我应该可以节省大量的磁盘访问,并再次进行CPU限制,不是吗? 更新:所以显而易见的后续行动是,VC ++编译器和链接器可以更

How to improve Visual C++ compilation times?

I am compiling 2 C++ projects in a buildbot, on each commit. Both are around 1000 files, one is 100 kloc, the other 170 kloc. Compilation times are very different from gcc (4.4) to Visual C++ (2008). Visual C++ compilations for one project take in the 20 minutes. They cannot take advantage of the multiple cores because a project depend on the other. In the end, a full compilation of both pr

如何提高Visual C ++编译时间?

我正在编译一个buildbot中的2个C ++项目,每次提交。 两者都有大约1000个文件,其中一个是100kloc,另一个是170kloc。 编译时间与gcc(4.4)到Visual C ++(2008)非常不同。 一个项目的Visual C ++编译在20分钟内完成。 他们无法利用多核心,因为项目依赖于其他核心。 最后,调试和发布中的32位和64位两个项目的完整编译需要超过2个半小时。 一个项目的gcc汇编需要4分钟。 它可以在4个核心上并行,大约需要1分10秒。

Is uninitialized local variable the fastest random number generator?

I know the uninitialized local variable is undefined behaviour(UB), and also the value may have trap representations which may affect further operation, but sometimes I want to use the random number only for visual representation and will not further use them in other part of program, for example, set something with random color in a visual effect, for example: void updateEffect(){ for(int i

未初始化的局部变量是最快的随机数生成器吗?

我知道未初始化的局部变量是未定义的行为(UB),并且该值可能具有可能影响进一步操作的陷阱表示,但有时我想仅将该随机数用于视觉表示,并且不会在其他部分进一步使用它们程序,例如,用随机颜色设置视觉效果,例如: void updateEffect(){ for(int i=0;i<1000;i++){ int r; int g; int b; star[i].setColor(r%255,g%255,b%255); bool isVisible; star[i].setVisible(i

How do I find out where the compiler spends its time?

How do I find out where the compiler spends its time? My build is too slow, I'm already using a RAMdisk for the VC++ temporary files and it doesn't make any difference. (I have an SSD, so I expected no difference.) Most single C++ files in this project take approx. 2 seconds to compile which seems awful (as I also don't have any in-project parallelization because I'm using V

我如何找出编译器花费的时间?

我如何找出编译器花费的时间? 我的构建速度太慢,我已经在使用RAMdisk作为VC ++临时文件,并且没有任何区别。 (我有一个SSD,所以我预计没有区别。) 该项目中的大多数单个C ++文件大约需要。 2秒来编译这看起来很糟糕(因为我使用VS2005,我也没有任何项目内并行化)。 我怎样才能优化这个? 不要优化没有分析,但我如何分析编译器? 注意:这些不是很有帮助: 剖析C ++编译过程 在Visual Studio中显示构建时

g++ giving errors where visual studio was happy

I have some code that runs fine on Visual Studio, and I am now trying to compile it on g++. It is giving me 'undefined reference to SomeClass::someMethod() const' in a bunch of places. Most commonly, it's the following situation: for (const SomeListNode *node = owner->some_list; node != 0; node = node->getNext()) In this case, I get 'undefined reference to SomeListNode:

g ++给视觉工作室感到高兴的错误

我有一些在Visual Studio上运行良好的代码,现在我正试图在g ++上编译它。 它在一堆地方给我'对SomeClass :: someMethod()const'的未定义引用。 最常见的情况如下: for (const SomeListNode *node = owner->some_list; node != 0; node = node->getNext()) 在这种情况下,我得到'SomeListNode :: getNext()const'的未定义引用。 这个类的头文件是明确包含的。 为什么这在g ++中不合法? 编

API documentation for the yaml

I decided to use the yaml-cpp v0.3 library to parse a config file for a FOSS daemon I maintain. I've decided to move to the new 0.5 API but my biggest problem so far is that there does not seem to be any proper documentation other than this: https://github.com/jbeder/yaml-cpp/wiki/Tutorial ...and some third party tutorials which are nice as an intro but there do not seem to be any Doxyge

yaml的API文档

我决定使用yaml-cpp v0.3库来解析我维护的FOSS守护进程的配置文件。 我决定迁移到新的0.5 API,但迄今为止我最大的问题是,除此之外似乎没有任何适当的文档: https://github.com/jbeder/yaml-cpp/wiki/Tutorial ...以及一些第三方教程,这些教程在介绍中都很好,但是在yaml-cpp源代码中似乎没有任何Doxygen注释。 是否有类似API的Doxygen概述? 我非常喜欢这个新的API,但缺乏文档使得它不必要的繁琐。 这里有一个doxy

How do I get Doxygen to document a class defined in a C++ file?

I know classes should be defined in hpp files. Company convention requires me to keep this particular class in a cpp file. Doxygen is parsing the cpp file in question and documenting a few #defines in it, but totally skipping over the class. How do I get Doxygen to see it? Can I put something in the doxyfile or in the file itself? From the Doxygen documentation located here: http://www.sta

如何让Doxygen记录在C ++文件中定义的类?

我知道类应该在hpp文件中定义。 公司约定要求我将这个特定的类保存在一个cpp文件中。 Doxygen解析了有问题的cpp文件,并记录了其中的几个#define,但完全跳过了该类。 我如何让Doxygen看到它? 我可以把东西放在doxyfile或文件本身中吗? 从位于此处的Doxygen文档:http://www.stack.nl/~dimitri/doxygen/config.html#config_build 我发现这两个选项应该有所帮助: EXTRACT_LOCAL_CLASSES 如果EXTRACT_LOCAL_CLASSE

Coding C++ (mostly) in header files vs .cpp files

For years I've been coding C++ in the standard way, with class declarations in header files .hpp and the function definitions in source .cpp files. Recently I moved to a new company where the code (seemingly influenced by boost coding styles) is entirely coded in .hpp files with one short .cpp file to include the header files and create the object/program binary. It got me thinking - what

在头文件和.cpp文件中编写C ++(大部分)

多年来,我一直以标准的方式编写C ++,在头文件.hpp中使用类声明,在源.cpp文件中使用函数定义。 最近我搬到了一家新公司,在那里代码(看起来受boost编码风格的影响)完全用.hpp文件编码,并带有一个简短的.cpp文件以包含头文件并创建对象/程序二进制文件。 它让我思考 - 在头文件中编写代码与编写每个对象的.hpp&.cpp文件相比,有哪些优势/弱点? 这假定我们的项目不会创建通用库,然后将其链接到程序二进制文件中,而是

Condensing Declaration and Implementation into an HPP file

I've read a few of the articles about the need / applicability / practicality of keeping headers around in C++ but I can't seem to find anywhere a solid reason why / when the above should or should not be done. I'm aware that boost uses .hpp files to deliver template functions to end users without the need for an associated .cpp file, and this thought is partially sourced off browsin

凝聚声明和实施到一个HPP文件

我已经阅读了一些关于在C ++中保留头文件的需求/适用性/实用性的文章,但是我似乎无法找到任何地方为什么/何时应该或者何时应该完成上述内容的坚实原因。 我知道boost使用.hpp文件为最终用户提供模板功能,而不需要关联的.cpp文件,而这种想法部分来源于浏览代码。 看起来,这将是一种方便的方式来提供单个文件模块,例如新的Wt或Qt小部件(仍然坚持每个.h约定的一个类)。 然而,是否有任何负面的技术实现可以让某个单独的.