visual-c++ 相关问题

Microsoft Visual C ++是Windows的C,C ++和C ++ / CLI编译器。最新版本的编译器是Visual C ++ 2017.编译器支持以下语言:C:支持C90和ISO C ++标准的大部分C99和C11部分,自Visual Studio 2017 C ++开始:支持大多数C ++ 11功能以及Visual Studio 2017 C ++ / CLI中的一些C ++ 14和C ++ 17功能

我不知道如何解决将数组传递到类方法时出现的错误

当我将湖人队名单放入湖人队方法参数中时,它显示: 错误:删除时未知数组大小 和 注意:这里首先需要合成方法“Team::~Team()” 湖人队(“Los A...

回答 1 投票 0

无效的Resx; '<', hexadecimal value 0x3C, is an invalid attribute character

我在 Visual Studio 2022 上遇到了一些档案问题,所以我从资源中删除了它们(我对此还很陌生),然后,我遇到了这个问题,但我不知道该怎么办,只能出现...

回答 1 投票 0

调用 std::stacktrace_entry::description 的静态初始化 jthread 上出现死锁

下面的代码会导致退出 main() 时出现死锁 #包括 #包括 #包括 #包括 #包括 使用名字...

回答 1 投票 0

Visual Studio 无法识别 __AVX2__ 或 __AVX__

我正在用 C++ 实现一个简单的 SIMD 包装器。 为了使其跨平台,我使用 CMake 通过 Visual Studio 设置项目 我添加了 /Arch:AVX2,但 Visual Studio 无法识别 __AVX2__ ...

回答 1 投票 0

C++ MSVC - 显示未捕获的异常消息

我有一个简单的 C++ 代码,我尝试使用 Visual Studio 2019 进行编译: #包括 #包括 int main() { std::cout << "Hello World!\n"; throw std::

回答 2 投票 0

为什么返回引用类型的局部变量在VS2012中有效[重复]

我对下面的代码感到非常困惑,该代码在 VS2012 Update 5 中有效,但在 g++ 8.1 中失败。 int&func() { 整数 i = 0; 返回我; } int main() { int ri = func(); ri++; std::cou...

回答 2 投票 0

Visual studio c++,断点不停止调试DLL(GODOT GDExtention)

嘿总之,所有编译和运行,但断点没有被击中。 使用VC++ 2022。按照本教程操作 调用: scons -j4 target=template_debug dev_build=yes debug_symbols=yes 所有 dll ...

回答 1 投票 0

如何使用 CsvHelper 将字符串解析为标记列表?

我有一个 C# DLL,它已经使用 CsvHelper 来读取 CSV 文件。所以我想知道 CsvHelper 是否有能力让我简单地向它传递一个字符串(而不是文件)并返回令牌列表? 所以...

回答 1 投票 0

有使用 CStrBufT 和 CString 的有效示例吗?

官方文档:CStrBufT 我偶然发现了这门课。我进行了搜索并没有找到任何例子。是否属于以下情况: CString str1 = L”XYZ”; CStrBufT str1buf = CStrBufT(str1); ?确实有人用过这个

回答 1 投票 0

c++ 不存在从“myClass1”到“myClass1”的合适的用户定义转换

我对 C++ 非常陌生,当 Visual Studio 2010 突出显示此语法错误时,我感到非常困惑。 定义 类 myClass1 { 民众: myClass1(); } 类 myClass2 { 公开...

回答 1 投票 0

为什么在使用 Visual C++ 2022 编译时会出现奇怪的类方法重定义错误?

我正在尝试编写我的向量,使其尽可能类似于STL版本,我使用了这些类型名称。 使用 value_type = 类型; 使用迭代器=向量_迭代器 我正在尝试编写我的向量,使其尽可能类似于 STL 版本,我使用了这些类型名称。 using value_type = Type; using iterator = vector_iterator<value_type>; using const_iterator = const vector_iterator<value_type>; using reverse_iterator = std::reverse_iterator<iterator>; using const_reverse_iterator = std::reverse_iterator<const_iterator>; 并实现了很多方法,包括以下迭代器相关的方法。 constexpr iterator begin() noexcept; constexpr const_iterator begin() const noexcept; constexpr const_iterator cbegin() const noexcept; constexpr iterator end() noexcept; constexpr const_iterator end() const noexcept; constexpr const_iterator cend() const noexcept; constexpr reverse_iterator rbegin() noexcept; constexpr const_reverse_iterator rbegin() const noexcept; constexpr const_reverse_iterator crbegin() const noexcept; constexpr reverse_iterator rend() noexcept; constexpr const_reverse_iterator rend() const noexcept; constexpr const_reverse_iterator crend() const noexcept; 就像STL中的标准向量一样,每个begin()、end()、rbegin()和rend()都有两个重载,返回一个非常量迭代器和一个常量迭代器。 cbegin()、cend() 和 crbegin()、crend() 被视为返回 const 迭代器的方法的别名。 每组实现看起来像这样(例如begin()和rend()): // non-const version of begin() template <typename Type, typename Allocator> constexpr typename vector<Type, Allocator>::iterator vector<Type, Allocator>::begin() noexcept { return iterator(ptr_data_); } // const version of begin() template <typename Type, typename Allocator> constexpr typename vector<Type, Allocator>::const_iterator vector<Type, Allocator>::begin() const noexcept { return const_iterator(ptr_data_); } // cbegin() template <typename Type, typename Allocator> constexpr typename vector<Type, Allocator>::const_iterator vector<Type, Allocator>::cbegin() const noexcept { return const_iterator(ptr_data_); } // non-const version of rend() template <typename Type, typename Allocator> constexpr typename vector<Type, Allocator>::reverse_iterator vector<Type, Allocator>::rend() noexcept { return reverse_iterator(begin()); } // const version of rend() template <typename Type, typename Allocator> constexpr typename vector<Type, Allocator>::const_reverse_iterator vector<Type, Allocator>::rend() const noexcept { return const_reverse_iterator(begin()); } // crend() template <typename Type, typename Allocator> constexpr typename vector<Type, Allocator>::const_reverse_iterator vector<Type, Allocator>::crend() const noexcept { return const_reverse_iterator(cbegin()); } 然后,当我尝试运行测试项目时,Visual Studio告诉我,const版本的begin()、const版本的end()、cbegin()和cend()由于重新定义而触发C2373错误. C2373 'clb_container::vector::begin': 重新定义;不同类型修饰符 C2373 'clb_container::vector::cbegin': 重新定义;不同类型修饰符 C2373 'clb_container::vector::end': 重新定义;不同类型修饰符 C2373 'clb_container::vector::cend': 重新定义;不同类型修饰符 这是我的 vector_iterator 的构造函数: template <typename Type> vector_iterator<Type>::vector_iterator(pointer ptr) { iterator_ptr_ = ptr; } template <typename T> vector_iterator<T>::vector_iterator(const vector_iterator& target) { iterator_ptr_ = target.iterator_ptr_; } 我确信我没有两次定义这些方法。 我已尝试以下步骤: 我把上面提到的方法都注释掉了,重新编译了。错误立即消失。 然后我一一取消注释,发现只要const版本的begin()、const版本的end、cbegin()和cend()之一可用,C2373就会再次出现。 我将这些代码片段分别传递给 Copilot 和 Claude-3-Sonnet,他们没有发现明显的重新定义。 最后,我用Visual Studio Installer安装了“C++ Clang tools for Windows under Desktopdevelopment with C++”,并配置了测试项目使用Clang。 C2373消失,程序编译正常。但是,如果我将“平台工具集”更改回默认的“Visual Studio 2022(v143)”,则会再次出现错误。所以我认为这个问题很可能是由 Visual C++ 2022 引起的。 但是,作为我小小的STL的一部分,我希望它能够在大多数编译器下正常编译,而不是因为一些莫名其妙的原因而失败,尤其是在像Visual Studio这样用户众多的平台上,但我仍然找不到真正的问题. constexpr 意味着const... constexpr iterator begin() noexcept; constexpr const_iterator begin() const noexcept; 是相同的东西,除了返回类型。并且您不能执行仅返回类型不同的重载。

回答 1 投票 0

如何在没有 Visual Studio 的情况下下载并安装 Microsoft 的 Visual Studio C/C++ 编译器

我正在尝试在 Windows 上运行 C 代码,但我有一台低端 PC,我认为我不应该安装 Visual Studio。 如何只安装自带的C/C++编译器,而不安装Vi...

回答 2 投票 0

INT_MIN、INT8_MIN、INT16_MIN 之间的区别。也适合 MAX

在 VScode 中,我使用了 INT_MIN/INT_MAX,但是今天我收到了一个错误,说“Unidentified Classifier”。相反,它建议我使用 INT8_MIN。 使用这个后,效果非常好。 但是...

回答 1 投票 0

“pip install mariadb”指出它在我的 Windows 10 桌面上找不到包含文件“mysql.h”

我在我的电脑上以管理员身份运行cmd.exe。然后输入:pip install mariadb,但这是它显示的输出: 收集 mariadb 使用缓存的 mariadb-1.1.10.tar.gz (84 kB) 安装构建

回答 1 投票 0

为什么 MSVC 从不为成员函数返回 RAX 中的结构体?

我在 MSVC 代码生成中偶然发现了一个奇怪的现象,涉及用作返回值的结构。考虑以下代码(此处为现场演示): 结构结果 { uint64_t 值; }; 结果

回答 2 投票 0

编程选项

有没有可以在手机上使用Android智能手机开始编程、创建程序和学习编程的程序 我一直在尝试使用我的 Android 手机,但我无法弄清楚...

回答 1 投票 0

如果我在 Visual Studio 中链接两个提供相同符号的不同库会发生什么?

背景:我的 Windows 机器上安装了 Python 3.11 和开发源。相关的二进制文件是 python3.dll python311.dll 二进制 python3.dll 实现了 python31 的子集...

回答 1 投票 0

如何将解决方案从 git 移至 tfs

我决定与一位程序员同事分享一个解决方案。我们都有权在共享 Team Foundation Server 中添加和处理项目。 我在 Git 中错误地创建了它,现在它已经...

回答 1 投票 0

为什么在编译模块实现单元时会收到警告 C4844?

我试图将模块实现的各个部分拆分为一个单独的源文件作为模块实现单元: 香蕉.cppm 导出模块banana; 导出 int 香蕉(); 香蕉.impl.cppm 模块...

回答 2 投票 0

flutter 桌面应用程序“错误 MSB3073:命令“setlocal”

我正在使用 VS Code 构建一个 Flutter 桌面应用程序,突然出现了这个完全不熟悉的错误。 任何人有关于如何处理这个问题的解决方案,我很感激 以下是我的

回答 2 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.