23得票4回答
C++实现函数`int next(std::string param)`时出现奇怪的编译错误

我被下面的代码咬得很惨,浪费了很多宝贵的时间。#include<string> int next(std::string param){ return 0; } void foo(){ next(std::string{ "abc" }); } 这会在Visua...

14得票2回答
尽管禁用了优化(/Od),但函数没有地址。

在 MSVC 2012 中进行调试时,我尝试从“观察”窗口调用一些函数以将数据转储到文件中。然而,我不断收到以下错误:Function Matrix::Save has no address, possibly due to compiler optimizations. 类Matrix...

13得票3回答
如何在Visual Studio 2013中修复“error MSB4018: The 'VCMessage' task failed unexpectedly”的错误

这是我所见到的:1>------ Build started: Project: xxx (xxx\xxx), Configuration: Debug Win32 ------ 1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0...

13得票3回答
无法将字符串字面值赋值给包装的std::string向量

这是我的类型系统的简化版: #include <string> #include <vector> template<typename T> class Box { public: Box(const T& value) : _value...

11得票2回答
为什么在MSVC12中unique_ptr的is_copy_constructible返回true

我本以为这个静态断言会触发:#include <type_traits> #include <memory> int main() { static_assert(std::is_copy_constructible<std::unique_ptr<i...

11得票1回答
MSVC12(VS2013)中可能存在指定初始化程序的编译器错误

使用VS2013 Update 2时,我遇到了一些奇怪的错误信息:// test.c int main(void) { struct foo { int i; float f; }; struct bar { unsig...

9得票1回答
在MSVC、GCC和Clang中,std::promise如何存储const类型?

最近,我开始使用 MSVC 编译一些之前一直用 GCC 和 Clang 编译的代码。这段代码的某个部分产生了一个有趣的编译错误(截断): C:/data/msvc/14.33.31424-Pre/include\future(311) error C2678: binary '=': no ...

9得票1回答
GCC默认导出所有符号的设计理念和MSVC默认不导出任何内容的设计理念有何区别?

C++编译器GCC和MSVC之间的许多关键差异之一是,在前者中,默认情况下导出共享库中的所有符号,而MSVC则不导出任何内容。 其中一些影响是,在MSVC中,您必须显式导出实例化的模板类。 虽然我已经接受了这个事实,但我想知道从编译器设计师的角度来看,每种方法的设计影响、权衡等方面有哪些考...

8得票3回答
MSVC安装在哪里?-检测`cl.exe`和`link.exe`的位置

我记得在旧日子里,在Windows上编译任何东西之前,要求人们运行vcvarsall.bat。假设默认安装位置,如果cl.exe、link.exe和相关文件不在PATH中,该去哪里找它们呢? 尝试: #include <stdlib.h> #include <stdio....

8得票2回答
Delphi:使用调试器调用C dll函数需要15秒,而不使用调试器仅需要0.16秒。为什么?

我有以下设置: 1.一个用Delphi XE5编写的命令行应用程序,在Debug 64位下构建。 2.一个用Microsoft Visual Studio 2013编写的C dll,在Release 64位下构建。 3.Delphi命令行应用程序调用C dll中的函数。 意料之外的是: ...