Why are "out of source" builds not the default?

I just found out recently that you can configure Visual Studio (but this question is the same for any compiler) to dump the intermediate .o files into a separate folder outside of the source tree, instead of alongside each individual project. That makes it easy to clean the project up to archive to zip or something along those lines. Why is that kind of configuration not more common? Are ther

为什么“脱销”不是默认的?

最近我发现你可以配置Visual Studio(但对于任何编译器来说,这个问题都是一样的),以便将中间.o文件转储到源树之外的单独文件夹中,而不是每个单独的项目旁边。 这样可以很容易地将项目清理到压缩文件或其他文件。 为什么这种配置不常见? 是否有重大缺点? 这是Visual Studio中的默认设置,并且已经有相当长的一段时间了(至少早在VC ++ 6之前)。 中间目录默认与输出目录相同,而不是源目录。 这意味着所有的目标文

how to get compile warning

I'm quite surprised when I compile the following code without any warning using g++ 4.1.2 with -Wall -Wextra -Wconversion enabled. I want g++ to show me every warning to avoid potential harm. I have to stick to g++ 4.1.2. #include <stdint.h> #include <string> using namespace std; int main() { uint8_t u1=1; uint64_t u64=1000; string s1=""; u1=u64; // want war

如何获得编译警告

当我使用启用了-Wall -Wextra -Wconversion的g ++ 4.1.2编译下面的代码时没有任何警告,我感到非常惊讶。 我希望g ++向我展示每一个警告,以避免潜在的伤害。 我必须坚持g ++ 4.1.2。 #include <stdint.h> #include <string> using namespace std; int main() { uint8_t u1=1; uint64_t u64=1000; string s1=""; u1=u64; // want warning here s1=u64; // want warning here s1=u1; }

Is there a way to change the delete action on an existing instance of shared

I have a function where I want a cleanup action done 90% of the time, but in 10% I want some other action to be done. Is there some way to use some standard scoped control like shared_ptr<> so that initially it can have one delete action and then later in the function the delete action can be changed? shared_ptr<T> ptr( new T, std::mem_fun_ref(&T::deleteMe) ); ptr.pn.d = std::m

有没有办法在共享的现有实例上更改删除操作

我有一个功能,我希望在90%的时间内完成清理操作,但在10%的时间内,我想要完成一些其他操作。 有没有办法像shared_ptr<>那样使用一些标准的作用域控制,以便最初它可以有一个删除操作,然后在函数中可以更改删除操作? shared_ptr<T> ptr( new T, std::mem_fun_ref(&T::deleteMe) ); ptr.pn.d = std::mem_fun_ref(&T::queueMe); 我认为一旦创建了shared_ptr ,您就不能更改删除程序。 但是,你为什

min and perfect forwarding

The min algorithm is normally expressed like this: template <typename T> const T& min(const T& x, const T& y) { return y < x ? y : x; } However, this does not allow constructs of the form min(a, b) = 0 . You can achieve that with an additional overload: template <typename T> T& min(T& x, T& y) { return y < x ? y : x; } What I would like to do

分钟和完美的转发

min算法通常表达如下: template <typename T> const T& min(const T& x, const T& y) { return y < x ? y : x; } 但是,这不允许形式为min(a, b) = 0构造。 您可以通过额外的重载实现该目标: template <typename T> T& min(T& x, T& y) { return y < x ? y : x; } 我想要做的是通过完美转发来统一这两个重载: template <typename T> T&& min(T&&am

Serializing QGraphicsScene contents

I am using the Qt QGraphicsScene class, adding pre-defined items such as QGraphicsRectItem , QGraphicsLineItem , etc. and I want to serialize the scene contents to disk. However, the base QGraphicsItem class (that the other items I use derive from) doesn't support serialization so I need to roll my own code. The problem is that all access to these objects is via a base QGraphicsItem pointer

序列化QGraphicsScene内容

我正在使用Qt QGraphicsScene类,添加了预定义的项目,如QGraphicsRectItem , QGraphicsLineItem等,我想将场景内容序列化到磁盘。 然而,基础QGraphicsItem类(即我使用的其他项目)不支持序列化,所以我需要推出我自己的代码。 问题是所有对这些对象的访问都是通过一个基本的QGraphicsItem指针,所以我的序列化代码是可怕的: QGraphicsScene* scene = new QGraphicsScene; scene->addRect(QRectF(0, 0, 100, 100)); sce

Unable to display responses of type "application/octet

*response << "HTTP/1.1 200 OKrnContent-Length: " << success.length(); *response << "rnContent-Type: application/octet-stream"; *response << "rnContent-Disposition: attachment; filename="" << filename << '"'; *response << "rnrn" << success; I set the response header like this to let the browser to download the result from the server rather than to sh

无法显示“application / octet”类型的响应

*response << "HTTP/1.1 200 OKrnContent-Length: " << success.length(); *response << "rnContent-Type: application/octet-stream"; *response << "rnContent-Disposition: attachment; filename="" << filename << '"'; *response << "rnrn" << success; 我这样设置响应头,让浏览器从服务器下载结果,而不是直接显示结果。 但它无法按预期显示下载框,并且浏览器显示“无

CRXIR2 doesn't work with VS2010 on Windows 7 nor on Vista

We're upgrading from VS2005 to VS2010. We are almost there but there is a problem with Crystal Reports. We use the RDC (COM-based) component within our C++ application. On Windows 7 or on VISTA, I can't get the viewer nor the designer controls working. I get Access Violations when the control is activated: // from atlhost.h (line 2208) hr = m_spOleObject->DoVerb(OLEIVERB_INPLACEA

在Windows 7和Vista上,CRXIR2不适用于VS2010

我们正在从VS2005升级到VS2010。 我们几乎在那里,但Crystal Reports存在问题。 我们在C ++应用程序中使用RDC(基于COM的)组件。 在Windows 7或VISTA上,我无法使浏览器或设计人员控制工作。 当控件激活时,我得到访问冲突: // from atlhost.h (line 2208) hr = m_spOleObject->DoVerb(OLEIVERB_INPLACEACTIVATE, NULL, spClientSite, 0, m_hWnd, &m_rcPos); 奇怪的是,当我在XP机器上运行相同的exe时,它似乎工

How to use PBO with Qt OpenGL

I'm trying to use QOpenGLBuffer as a Pixel Buffer Object. The goal would be to display a high resolution video stream (4K, 60FPS) so I need good performance. Since I'm just starting with OpenGL, I'm trying at first to display a simple 2D texture the best way possible. I've already included VBO and VAO, the next step (As I read it) would be to use a PBO for better performance.

如何在Qt OpenGL中使用PBO

我试图使用QOpenGLBuffer作为像素缓冲区对象。 目标是显示高分辨率视频流(4K,60FPS),所以我需要良好的性能。 由于我刚刚开始使用OpenGL,因此我首先尝试以最佳方式显示简单的2D纹理。 我已经包含了VBO和VAO,下一步(当我阅读它时)将使用PBO来获得更好的性能。 有PBO的教程,但有glGenBufferARB(),而不是QOpenGLBuffer。 这是我的代码: glwidget.h #ifndef GLWIDGET_H #define GLWIDGET_H #include <QOpe

OpenGL PBO texture uploading oddities

I'm basing my tests on this popular PBO example (see pboUnpack.zip from http://www.songho.ca/opengl/gl_pbo.html). Tests are done on PBO Mode 1 per the example. Running the original sample, I found that on my NVIDIA 560GTX PCIe x16 (driver v334.89 Win7 PRO x64 Core i5 Ivy Bridge 3.6GHz), glMapBufferARB() blocks for 15ms even when the glBufferDataARB() preceding was meant to prevent it from

OpenGL PBO纹理上传怪异

我将我的测试基于这个流行的PBO示例(请参阅http://www.songho.ca/opengl/gl_pbo.html中的pboUnpack.zip)。 每个示例都在PBO模式1上进行测试。 运行原始示例,我发现在我的NVIDIA 560GTX PCIe x16(驱动程序v334.89 Win7 PRO x64 Core i5 Ivy Bridge 3.6GHz)上, glMapBufferARB()阻塞15ms,即使上面的glBufferDataARB()前面是为了防止其阻塞(即抛弃PBO)。 然后,我将图像大小从原来的1024 * 1024更改为400 * 400,认为

PBO 2 way copy from and into the same FBO texture attachment

I am trying to achieve this : I have A custom frame buffer into which I render some geometry.The FBO has a color attachment texture at that moment.Then I am copying it into PBO .After that I want to copy back pixels from the PBO into that texture and blit the custom FBO into default frame buffer.It doesn't work. I updated the code to be more understandable in terms what I do : // Here I

PBO 2方式复制来自同一个FBO纹理附件

我试图做到这一点:我有一个自定义帧缓冲区,我渲染一些几何图形。FBO在那个时候有一个颜色附件纹理。然后我将它复制到PBO中。之后,我想从PBO中复制像素进入该纹理,并将自定义FBO闪烁到默认帧缓冲区中。它不起作用。 我更新了代码,以我的方式更容易理解: // Here I init the PBO : void Init(const int bufferWidth,const int bufferHeight){ glGenBuffers(1,&_imagePBO); glBindBuffer(GL_PIXEL_PA