Articles of c ++ 11

Clang或GCC编译器用于Windows上的c ++ 11兼容性编程?

我想知道哪个编译器在Windows操作系统(8.1)上兼容c ++ 11(和更高版本)函数,liberies和特性(如lambdas)的兼容性更好,而且使用起来也很舒适(减less错误)。 我是一名大学生,因此我并不看产品的主题(尽pipe我喜欢为我的研究项目编写更多的代码)。 我现在正在使用eclipse luna IDE。

C ++ wcout unocode(西里尔文,日文)

在我的应用程序中,我使用西里尔文和日文字符。 当我使用: _setmode(_fileno(stdout), _O_U16TEXT). 在操作系统Windows上 – 我的输出数据如下所示: 西里尔文:Привет 日语: 可能是什么问题呢?

如何处理Windows树视图项目上的点击事件

我如何处理在MS Windows树视图中单击的项目? 我的Windows proc有: LRESULT CALLBACK WndProcTreeView(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { PAINTSTRUCT paintStruct; HDC hDC; switch (message) { case WM_PAINT: { hDC = BeginPaint(hwnd, &paintStruct); EndPaint(hwnd, &paintStruct); break; } case WM_NOTIFY: { switch (reinterpret_cast<LPNMHDR>(lParam)->code) { case NM_CLICK: MessageBox(nullptr, "click", "click", MB_OK); } } default: { return DefWindowProc(hwnd, message, wParam, lParam); break; […]

工作线程被强制终止之前,破坏静态对象的DLL(但不是.exe)?

考虑下面的代码。 以下所有内容都是在Visual Studio 2015中使用v140 C ++运行库进行编译和执行的: #include <thread> #include <atomic> #include <sstream> #include <Windows.h> struct StaticThreadTest { ~StaticThreadTest() { _terminationRequested = true; if (_thread.joinable()) _thread.join(); std::ostringstream ss; ss << "Thread finished gracefully: " << _threadFinishedGracefully << "\n"; OutputDebugStringA(ss.str().c_str()); } void startThread() { _thread = std::thread([&]() { while (!_terminationRequested); _threadFinishedGracefully = true; }); } std::thread _thread; […]

如何开始与c + +中的线程(返回)

您好我开始在Windows中的c + +的线程。 #include <iostream> #include <thread> #include <windows.h> using namespace std; static const int num_threads = 2; CRITICAL_SECTION critSection; int thread1 ( int id ) { EnterCriticalSection ( &critSection ); cout <<"thread1 had id: " << id<<endl; LeaveCriticalSection ( &critSection ); return 15; } void thread2() { EnterCriticalSection ( &critSection ); cout << "Sleeping"<< […]

索引超出界限在Windows上,但不是在Mac上

在我的程序中]错误地写了这样的话: std::vector<std::string> foo; std::string test = "hello"; for (int i = 0; i < 10; i++){ foo.puch_back(test); } qDebug() << QString::FromStdString(foo[10]); 这显然不起作用,因为索引10大于向量的大小。 当我在Mac上运行此代码时,我得到"" ,而在Windows上运行时,我得到一个错误: 索引超出界限 我想知道为什么在Windows上崩溃(如我所料),而在Mac上“工程”

VS 2012 Professional中的“debugging位置”工具栏中的“挂起,恢复下拉框”被禁用

当我debugging我的VC ++窗口应用程序时,如何启用debugging位置工具栏中的暂停,恢复下拉框。

采用Windows媒体基础的H.264编码

我正在开发一个服务器应用程序,stream的Windows应用程序的高品质的实时video。 考虑到H.264的优点,我打算将这种格式用于videostream。 我知道有很多第三方编解码器,但我可以使用Windows媒体基础API将捕获的帧编码为H.264stream吗? 如果你能指导我一个示例应用程序,这将是非常好的。 我打算为我的服务器应用程序使用C ++。 任何build议将被认真考虑!

通过其索引获取(实际)监视器的句柄

假设我有3台显示器。 我如何才能通过索引获得第二个句柄? EnumDisplayMonitors()不能工作,因为它枚举伪设备以及EnumDisplayDevices()不给我处理。

notify_one性能影响

我正在读一些有关std::condition_variable ,更具体地讲如何使用std::condition_variable::notify_one通知等待的线程。 我遇到了几个问题,我会很乐意得到答案: 当一个线程调用notify_one (OS-wise)时究竟发生了什么? 我想这是特定于操作系统,所以为了争论 – 我在Windows工作。 如果线程在没有等待线程时调用notify_one会发生什么? 这个调用是否有任何性能影响(CPU周期,电源等)? 谢谢