在 Windows 10 上使用 nuwen MinGW 的 C++17 文件系统

2024-02-28

我想尝试 C++17 中的新文件系统库,因此尝试复制来自 cppreference.com 的 std::filesystem::current_path 示例 https://en.cppreference.com/w/cpp/filesystem/current_path并使用最新版本(16.0)进行编译来自 nuwen.net 的 MinGW 发行版 https://nuwen.net/mingw.html在我的 Windows 10 x64 计算机上。这包括 gcc v8.1,它应该支持文件系统库cppreference.com 编译器支持页面 https://en.cppreference.com/w/cpp/compiler_support.

这是我试图编译的代码:

#include <iostream>
#include <filesystem>
namespace fs = std::filesystem;
int main()
{
    std::cout << "Current path is " << fs::current_path() << '\n';
}

我正在使用的编译器命令:

g++ -std=c++17 filesystem_test.cpp

这是我在尝试编译时遇到的错误:

In file included from c:\mingw\include\c++\8.1.0\filesystem:37,
                 from filesystem_test.cpp:2:
c:\mingw\include\c++\8.1.0\bits\fs_path.h: In member function 'std::filesystem::__cxx11::path& std::filesystem::__cxx11::path::operator/=(const std::filesystem::__cxx11::path&)':
c:\mingw\include\c++\8.1.0\bits\fs_path.h:237:47: error: no match for 'operator!=' (operand types are 'std::filesystem::__cxx11::path' and 'std::filesystem::__cxx11::path')
    || (__p.has_root_name() && __p.root_name() != root_name()))
                               ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
In file included from c:\mingw\include\c++\8.1.0\iosfwd:40,
                 from c:\mingw\include\c++\8.1.0\ios:38,
                 from c:\mingw\include\c++\8.1.0\ostream:38,
                 from c:\mingw\include\c++\8.1.0\iostream:39,
                 from filesystem_test.cpp:1:
c:\mingw\include\c++\8.1.0\bits\postypes.h:221:5: note: candidate: 'template<class _StateT> bool std::operator!=(const std::fpos<_StateT>&, const std::fpos<_StateT>&)'
     operator!=(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
     ^~~~~~~~
c:\mingw\include\c++\8.1.0\bits\postypes.h:221:5: note:   template argument deduction/substitution failed:
In file included from c:\mingw\include\c++\8.1.0\filesystem:37,
                 from filesystem_test.cpp:2:
c:\mingw\include\c++\8.1.0\bits\fs_path.h:237:60: note:   'std::filesystem::__cxx11::path' is not derived from 'const std::fpos<_StateT>'
    || (__p.has_root_name() && __p.root_name() != root_name()))
                                                            ^
In file included from c:\mingw\include\c++\8.1.0\bits\stl_algobase.h:64,
                 from c:\mingw\include\c++\8.1.0\bits\char_traits.h:39,
                 from c:\mingw\include\c++\8.1.0\ios:40,
                 from c:\mingw\include\c++\8.1.0\ostream:38,
                 from c:\mingw\include\c++\8.1.0\iostream:39,
                 from filesystem_test.cpp:1:
c:\mingw\include\c++\8.1.0\bits\stl_pair.h:456:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator!=(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&)'
     operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
     ^~~~~~~~
c:\mingw\include\c++\8.1.0\bits\stl_pair.h:456:5: note:   template argument deduction/substitution failed:
In file included from c:\mingw\include\c++\8.1.0\filesystem:37,
                 from filesystem_test.cpp:2:
c:\mingw\include\c++\8.1.0\bits\fs_path.h:237:60: note:   'std::filesystem::__cxx11::path' is not derived from 'const std::pair<_T1, _T2>'
    || (__p.has_root_name() && __p.root_name() != root_name()))
                                                            ^
In file included from c:\mingw\include\c++\8.1.0\bits\stl_algobase.h:67,
                 from c:\mingw\include\c++\8.1.0\bits\char_traits.h:39,
                 from c:\mingw\include\c++\8.1.0\ios:40,
                 from c:\mingw\include\c++\8.1.0\ostream:38,
                 from c:\mingw\include\c++\8.1.0\iostream:39,
                 from filesystem_test.cpp:1:
c:\mingw\include\c++\8.1.0\bits\stl_iterator.h:311:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_Iterator>&)'
     operator!=(const reverse_iterator<_Iterator>& __x,
     ^~~~~~~~
c:\mingw\include\c++\8.1.0\bits\stl_iterator.h:311:5: note:   template argument deduction/substitution failed:
In file included from c:\mingw\include\c++\8.1.0\filesystem:37,
                 from filesystem_test.cpp:2:
c:\mingw\include\c++\8.1.0\bits\fs_path.h:237:60: note:   'std::filesystem::__cxx11::path' is not derived from 'const std::reverse_iterator<_Iterator>'
    || (__p.has_root_name() && __p.root_name() != root_name()))
                                                            ^
In file included from c:\mingw\include\c++\8.1.0\bits\stl_algobase.h:67,
                 from c:\mingw\include\c++\8.1.0\bits\char_traits.h:39,
                 from c:\mingw\include\c++\8.1.0\ios:40,
                 from c:\mingw\include\c++\8.1.0\ostream:38,
                 from c:\mingw\include\c++\8.1.0\iostream:39,
                 from filesystem_test.cpp:1:
c:\mingw\include\c++\8.1.0\bits\stl_iterator.h:349:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_IteratorR>&)'
     operator!=(const reverse_iterator<_IteratorL>& __x,
     ^~~~~~~~
c:\mingw\include\c++\8.1.0\bits\stl_iterator.h:349:5: note:   template argument deduction/substitution failed:
In file included from c:\mingw\include\c++\8.1.0\filesystem:37,
                 from filesystem_test.cpp:2:
c:\mingw\include\c++\8.1.0\bits\fs_path.h:237:60: note:   'std::filesystem::__cxx11::path' is not derived from 'const std::reverse_iterator<_Iterator>'
    || (__p.has_root_name() && __p.root_name() != root_name()))
                                                            ^
In file included from c:\mingw\include\c++\8.1.0\bits\stl_algobase.h:67,
                 from c:\mingw\include\c++\8.1.0\bits\char_traits.h:39,
                 from c:\mingw\include\c++\8.1.0\ios:40,
                 from c:\mingw\include\c++\8.1.0\ostream:38,
                 from c:\mingw\include\c++\8.1.0\iostream:39,
                 from filesystem_test.cpp:1:
c:\mingw\include\c++\8.1.0\bits\stl_iterator.h:1124:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorR>&)'
     operator!=(const move_iterator<_IteratorL>& __x,
     ^~~~~~~~
c:\mingw\include\c++\8.1.0\bits\stl_iterator.h:1124:5: note:   template argument deduction/substitution failed:
In file included from c:\mingw\include\c++\8.1.0\filesystem:37,
                 from filesystem_test.cpp:2:
c:\mingw\include\c++\8.1.0\bits\fs_path.h:237:60: note:   'std::filesystem::__cxx11::path' is not derived from 'const std::move_iterator<_IteratorL>'
    || (__p.has_root_name() && __p.root_name() != root_name()))
                                                            ^
In file included from c:\mingw\include\c++\8.1.0\bits\stl_algobase.h:67,
                 from c:\mingw\include\c++\8.1.0\bits\char_traits.h:39,
                 from c:\mingw\include\c++\8.1.0\ios:40,
                 from c:\mingw\include\c++\8.1.0\ostream:38,
                 from c:\mingw\include\c++\8.1.0\iostream:39,
                 from filesystem_test.cpp:1:
c:\mingw\include\c++\8.1.0\bits\stl_iterator.h:1130:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorL>&)'
     operator!=(const move_iterator<_Iterator>& __x,
     ^~~~~~~~
c:\mingw\include\c++\8.1.0\bits\stl_iterator.h:1130:5: note:   template argument deduction/substitution failed:
In file included from c:\mingw\include\c++\8.1.0\filesystem:37,
                 from filesystem_test.cpp:2:
c:\mingw\include\c++\8.1.0\bits\fs_path.h:237:60: note:   'std::filesystem::__cxx11::path' is not derived from 'const std::move_iterator<_IteratorL>'
    || (__p.has_root_name() && __p.root_name() != root_name()))
                                                            ^
In file included from c:\mingw\include\c++\8.1.0\string:41,
                 from c:\mingw\include\c++\8.1.0\bits\locale_classes.h:40,
                 from c:\mingw\include\c++\8.1.0\bits\ios_base.h:41,
                 from c:\mingw\include\c++\8.1.0\ios:42,
                 from c:\mingw\include\c++\8.1.0\ostream:38,
                 from c:\mingw\include\c++\8.1.0\iostream:39,
                 from filesystem_test.cpp:1:
c:\mingw\include\c++\8.1.0\bits\allocator.h:158:5: note: candidate: 'template<class _T1, class _T2> bool std::operator!=(const std::allocator<_CharT>&, const std::allocator<_T2>&)'
     operator!=(const allocator<_T1>&, const allocator<_T2>&)
     ^~~~~~~~
c:\mingw\include\c++\8.1.0\bits\allocator.h:158:5: note:   template argument deduction/substitution failed:
In file included from c:\mingw\include\c++\8.1.0\filesystem:37,
                 from filesystem_test.cpp:2:
c:\mingw\include\c++\8.1.0\bits\fs_path.h:237:60: note:   'std::filesystem::__cxx11::path' is not derived from 'const std::allocator<_CharT>'
    || (__p.has_root_name() && __p.root_name() != root_name()))
                                                            ^
In file included from c:\mingw\include\c++\8.1.0\string:41,
                 from c:\mingw\include\c++\8.1.0\bits\locale_classes.h:40,
                 from c:\mingw\include\c++\8.1.0\bits\ios_base.h:41,
                 from c:\mingw\include\c++\8.1.0\ios:42,
                 from c:\mingw\include\c++\8.1.0\ostream:38,
                 from c:\mingw\include\c++\8.1.0\iostream:39,
                 from filesystem_test.cpp:1:
c:\mingw\include\c++\8.1.0\bits\allocator.h:164:5: note: candidate: 'template<class _Tp> bool std::operator!=(const std::allocator<_CharT>&, const std::allocator<_CharT>&)'
     operator!=(const allocator<_Tp>&, const allocator<_Tp>&)
     ^~~~~~~~
c:\mingw\include\c++\8.1.0\bits\allocator.h:164:5: note:   template argument deduction/substitution failed:
In file included from c:\mingw\include\c++\8.1.0\filesystem:37,
                 from filesystem_test.cpp:2:
c:\mingw\include\c++\8.1.0\bits\fs_path.h:237:60: note:   'std::filesystem::__cxx11::path' is not derived from 'const std::allocator<_CharT>'
    || (__p.has_root_name() && __p.root_name() != root_name()))
                                                            ^
In file included from c:\mingw\include\c++\8.1.0\bits\basic_string.h:48,
                 from c:\mingw\include\c++\8.1.0\string:52,
                 from c:\mingw\include\c++\8.1.0\bits\locale_classes.h:40,
                 from c:\mingw\include\c++\8.1.0\bits\ios_base.h:41,
                 from c:\mingw\include\c++\8.1.0\ios:42,
                 from c:\mingw\include\c++\8.1.0\ostream:38,
                 from c:\mingw\include\c++\8.1.0\iostream:39,
                 from filesystem_test.cpp:1:
c:\mingw\include\c++\8.1.0\string_view:454:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator!=(std::basic_string_view<_CharT, _Traits>, std::basic_string_view<_CharT, _Traits>)'
     operator!=(basic_string_view<_CharT, _Traits> __x,
     ^~~~~~~~
c:\mingw\include\c++\8.1.0\string_view:454:5: note:   template argument deduction/substitution failed:
In file included from c:\mingw\include\c++\8.1.0\filesystem:37,
                 from filesystem_test.cpp:2:
c:\mingw\include\c++\8.1.0\bits\fs_path.h:237:60: note:   'std::filesystem::__cxx11::path' is not derived from 'std::basic_string_view<_CharT, _Traits>'
    || (__p.has_root_name() && __p.root_name() != root_name()))
                                                            ^
In file included from c:\mingw\include\c++\8.1.0\bits\basic_string.h:48,
                 from c:\mingw\include\c++\8.1.0\string:52,
                 from c:\mingw\include\c++\8.1.0\bits\locale_classes.h:40,
                 from c:\mingw\include\c++\8.1.0\bits\ios_base.h:41,
                 from c:\mingw\include\c++\8.1.0\ios:42,
                 from c:\mingw\include\c++\8.1.0\ostream:38,
                 from c:\mingw\include\c++\8.1.0\iostream:39,
                 from filesystem_test.cpp:1:
c:\mingw\include\c++\8.1.0\string_view:460:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator!=(std::basic_string_view<_CharT, _Traits>, std::__detail::__idt<std::basic_string_view<_CharT, _Traits> >)'
     operator!=(basic_string_view<_CharT, _Traits> __x,
     ^~~~~~~~
c:\mingw\include\c++\8.1.0\string_view:460:5: note:   template argument deduction/substitution failed:
In file included from c:\mingw\include\c++\8.1.0\filesystem:37,
                 from filesystem_test.cpp:2:
c:\mingw\include\c++\8.1.0\bits\fs_path.h:237:60: note:   'std::filesystem::__cxx11::path' is not derived from 'std::basic_string_view<_CharT, _Traits>'
    || (__p.has_root_name() && __p.root_name() != root_name()))
                                                            ^
In file included from c:\mingw\include\c++\8.1.0\bits\basic_string.h:48,
                 from c:\mingw\include\c++\8.1.0\string:52,
                 from c:\mingw\include\c++\8.1.0\bits\locale_classes.h:40,
                 from c:\mingw\include\c++\8.1.0\bits\ios_base.h:41,
                 from c:\mingw\include\c++\8.1.0\ios:42,
                 from c:\mingw\include\c++\8.1.0\ostream:38,
                 from c:\mingw\include\c++\8.1.0\iostream:39,
                 from filesystem_test.cpp:1:
c:\mingw\include\c++\8.1.0\string_view:466:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator!=(std::__detail::__idt<std::basic_string_view<_CharT, _Traits> >, std::basic_string_view<_CharT, _Traits>)'
     operator!=(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
     ^~~~~~~~
c:\mingw\include\c++\8.1.0\string_view:466:5: note:   template argument deduction/substitution failed:
In file included from c:\mingw\include\c++\8.1.0\filesystem:37,
                 from filesystem_test.cpp:2:
c:\mingw\include\c++\8.1.0\bits\fs_path.h:237:60: note:   'std::filesystem::__cxx11::path' is not derived from 'std::basic_string_view<_CharT, _Traits>'
    || (__p.has_root_name() && __p.root_name() != root_name()))
                                                            ^
In file included from c:\mingw\include\c++\8.1.0\string:52,
                 from c:\mingw\include\c++\8.1.0\bits\locale_classes.h:40,
                 from c:\mingw\include\c++\8.1.0\bits\ios_base.h:41,
                 from c:\mingw\include\c++\8.1.0\ios:42,
                 from c:\mingw\include\c++\8.1.0\ostream:38,
                 from c:\mingw\include\c++\8.1.0\iostream:39,
                 from filesystem_test.cpp:1:
c:\mingw\include\c++\8.1.0\bits\basic_string.h:6056:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)'
     operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
     ^~~~~~~~
c:\mingw\include\c++\8.1.0\bits\basic_string.h:6056:5: note:   template argument deduction/substitution failed:
In file included from c:\mingw\include\c++\8.1.0\filesystem:37,
                 from filesystem_test.cpp:2:
c:\mingw\include\c++\8.1.0\bits\fs_path.h:237:60: note:   'std::filesystem::__cxx11::path' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>'
    || (__p.has_root_name() && __p.root_name() != root_name()))
                                                            ^
In file included from c:\mingw\include\c++\8.1.0\string:52,
                 from c:\mingw\include\c++\8.1.0\bits\locale_classes.h:40,
                 from c:\mingw\include\c++\8.1.0\bits\ios_base.h:41,
                 from c:\mingw\include\c++\8.1.0\ios:42,
                 from c:\mingw\include\c++\8.1.0\ostream:38,
                 from c:\mingw\include\c++\8.1.0\iostream:39,
                 from filesystem_test.cpp:1:
c:\mingw\include\c++\8.1.0\bits\basic_string.h:6069:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const _CharT*, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)'
     operator!=(const _CharT* __lhs,
     ^~~~~~~~
c:\mingw\include\c++\8.1.0\bits\basic_string.h:6069:5: note:   template argument deduction/substitution failed:
In file included from c:\mingw\include\c++\8.1.0\filesystem:37,
                 from filesystem_test.cpp:2:
c:\mingw\include\c++\8.1.0\bits\fs_path.h:237:60: note:   mismatched types 'const _CharT*' and 'std::filesystem::__cxx11::path'
    || (__p.has_root_name() && __p.root_name() != root_name()))
                                                            ^
In file included from c:\mingw\include\c++\8.1.0\string:52,
                 from c:\mingw\include\c++\8.1.0\bits\locale_classes.h:40,
                 from c:\mingw\include\c++\8.1.0\bits\ios_base.h:41,
                 from c:\mingw\include\c++\8.1.0\ios:42,
                 from c:\mingw\include\c++\8.1.0\ostream:38,
                 from c:\mingw\include\c++\8.1.0\iostream:39,
                 from filesystem_test.cpp:1:
c:\mingw\include\c++\8.1.0\bits\basic_string.h:6081:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, const _CharT*)'
     operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
     ^~~~~~~~
<snip>

请注意,我必须剪掉错误消息的末尾以减少该问题的字符数。我已将完整的错误消息放在这里:https://pastebin.com/pnfMnMs7 https://pastebin.com/pnfMnMs7

编辑:根据加利克的评论,我尝试将编译器命令更改为

g++ -std=c++17 filesystem_test.cpp -lstdc++fs

但是我似乎得到了与以前完全相同的错误


尝试最新的msys2 http://www.msys2.org/而不是 nuwen 发行版:

  1. 吃豆人-Syu

  2. pacman -S mingw-w64-x86_64-gcc

  3. gcc -v

    $ 海湾合作委员会 -v 使用内置规格。 COLLECT_GCC=C:\msys64\mingw64\bin\gcc.exe COLLECT_LTO_WRAPPER=C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/lto-wrapper.exe 目标:x86_64-w64-mingw32 配置为:../gcc-8.2.0/configure --prefix=/mingw64 --with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 - -target=x86_64-w64-mingw32 --with-native-system-header-dir=/mingw64/x86_64-w64-mingw32/include --libexecdir=/mingw64/lib --enable-bootstrap --with-arch=x86 -64 --with-tune=generic --enable-languages=ada,c,lto,c++,objc,obj-c++,fortran --enable-shared --enable-static --enable-libatomic --enable-threads =posix --enable-graphite --enable-完全动态字符串 --enable-libstdcxx-filesystem-ts=yes --enable-libstdcxx-time=yes --disable-libstdcxx-pch --disable-libstdcxx-debug --disable-isl-version-check --enable-lto --enable-libgomp --disable-multilib --enable-checking=release --disable-rpath --disable-win32-registry --disable-nls --禁用werror --disable-symvers --with-libiconv --with-system-zlib --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl= /mingw64 --with-pkgversion='Rev1,由 MSYS2 项目构建' --with-bugurl=https://sourceforge.net/projects/msys2 https://sourceforge.net/projects/msys2--with-gnu-as --with-gnu-ld 线程模型:posix gcc 版本 8.2.0(Rev1,由 MSYS2 项目构建)

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

在 Windows 10 上使用 nuwen MinGW 的 C++17 文件系统 的相关文章

  • 根据属性的类型使用文本框或复选框

    如果我有这样的结构 public class Parent public string Name get set public List
  • 通过引用传递 [C++]、[Qt]

    我写了这样的东西 class Storage public Storage QString key const int value const void add item QString int private QMap
  • 如何在 Cassandra 中存储无符号整数?

    我通过 Datastax 驱动程序在 Cassandra 中存储一些数据 并且需要存储无符号 16 位和 32 位整数 对于无符号 16 位整数 我可以轻松地将它们存储为有符号 32 位整数 并根据需要进行转换 然而 对于无符号 64 位整
  • C++11 删除重写方法

    Preface 这是一个关于最佳实践的问题 涉及 C 11 中引入的删除运算符的新含义 当应用于覆盖继承父类的虚拟方法的子类时 背景 根据标准 引用的第一个用例是明确禁止调用某些类型的函数 否则转换将是隐式的 例如最新版本第 8 4 3 节
  • 人脸 API DetectAsync 错误

    我想创建一个简单的程序来使用 Microsoft Azure Face API 和 Visual Studio 2015 检测人脸 遵循 https social technet microsoft com wiki contents ar
  • C# 列表通用扩展方法与非通用扩展方法

    这是一个简单的问题 我希望 集合类中有通用和非通用方法 例如List
  • C# - 当代表执行异步任务时,我仍然需要 System.Threading 吗?

    由于我可以使用委托执行异步操作 我怀疑在我的应用程序中使用 System Threading 的机会很小 是否存在我无法避免 System Threading 的基本情况 只是我正处于学习阶段 例子 class Program public
  • 为什么这个字符串用AesCryptoServiceProvider第二次解密时不相等?

    我在 C VS2012 NET 4 5 中的文本加密和解密方面遇到问题 具体来说 当我加密并随后解密字符串时 输出与输入不同 然而 奇怪的是 如果我复制加密的输出并将其硬编码为字符串文字 解密就会起作用 以下代码示例说明了该问题 我究竟做错
  • x:将 ViewModel 方法绑定到 DataTemplate 内的事件

    我基本上问同样的问题这个人 https stackoverflow com questions 10752448 binding to viewmodels property from a template 但在较新的背景下x Bind V
  • C# xml序列化必填字段

    我需要将一些字段标记为需要写入 XML 文件 但没有成功 我有一个包含约 30 个属性的配置类 这就是为什么我不能像这样封装所有属性 public string SomeProp get return someProp set if som
  • 为什么 isnormal() 说一个值是正常的,而实际上不是?

    include
  • C 函数 time() 如何处理秒的小数部分?

    The time 函数将返回自 1970 年以来的秒数 我想知道它如何对返回的秒数进行舍入 例如 对于100 4s 它会返回100还是101 有明确的定义吗 ISO C标准没有说太多 它只说time 回报 该实现对当前日历时间的最佳近似 结
  • 为什么C++代码执行速度比java慢?

    我最近用 Java 编写了一个计算密集型算法 然后将其翻译为 C 令我惊讶的是 C 的执行速度要慢得多 我现在已经编写了一个更短的 Java 测试程序和一个相应的 C 程序 见下文 我的原始代码具有大量数组访问功能 测试代码也是如此 C 的
  • C++ 中的参考文献

    我偶尔会在 StackOverflow 上看到代码 询问一些涉及函数的重载歧义 例如 void foo int param 我的问题是 为什么会出现这种情况 或者更确切地说 你什么时候会有 对参考的参考 这与普通的旧参考有何不同 我从未在现
  • DotNetZip:如何提取文件,但忽略zip文件中的路径?

    尝试将文件提取到给定文件夹 忽略 zip 文件中的路径 但似乎没有办法 考虑到其中实现的所有其他好东西 这似乎是一个相当基本的要求 我缺少什么 代码是 using Ionic Zip ZipFile zf Ionic Zip ZipFile
  • MySQL Connector C/C API - 使用特殊字符进行查询

    我是一个 C 程序 我有一个接受域名参数的函数 void db domains query char name 使用 mysql query 我测试数据库中是否存在域名 如果不是这种情况 我插入新域名 char query 400 spri
  • 指针和内存范围

    我已经用 C 语言编程有一段时间了 但对 C 语言还是很陌生 有时我对 C 处理内存的方式感到困惑 考虑以下有效的 C 代码片段 const char string void where is this pointer variable l
  • 类型或命名空间“MyNamespace”不存在等

    我有通常的类型或命名空间名称不存在错误 除了我引用了程序集 using 语句没有显示为不正确 并且我引用的类是公共的 事实上 我在不同的解决方案中引用并使用相同的程序集来执行相同的操作 并且效果很好 顺便说一句 这是VS2010 有人有什么
  • Mono 应用程序在非阻塞套接字发送时冻结

    我在 debian 9 上的 mono 下运行一个服务器应用程序 大约有 1000 2000 个客户端连接 并且应用程序经常冻结 CPU 使用率达到 100 我执行 kill QUIT pid 来获取线程堆栈转储 但它总是卡在这个位置
  • 如何确定 CultureInfo 实例是否支持拉丁字符

    是否可以确定是否CultureInfo http msdn microsoft com en us library system globalization cultureinfo aspx我正在使用的实例是否基于拉丁字符集 我相信你可以使

随机推荐

  • 如何使用 Raphael.JS 根据鼠标移动绘制一条线

    我试图随着鼠标在纸上移动画一条线 我只知道如何使用画线path 但想知道是否有人有想法来画一条线mousemove 请帮我解决这个问题 这是使用 raphael 的此类示例的链接 与拉斐尔一起绘画 图片来源 Jonas http irunm
  • 本地域与本地主机的性能

    TCP 连接之间是否存在性能差异 本地主机 127 0 0 1 解析到本地计算机的域 或者更具体地说 后面的连接是通过环回设备还是通过实际网络 我问的原因是我正在考虑更改许多 PHP 应用程序中的数据库设置 以便它们使用完整的域而不是本地主
  • 如何在telnet客户端实现tab补全

    我有一个为 telnet 客户端打开连接的服务器 例如 例如 我运行服务器 server在另一个窗口中 我将 telnet 客户端作为 telnet localhost 9999 运行 当我运行 telnet 客户端时 我将收到新的 CLI
  • 转到 mod 供应商而不更新到最新版本

    我试图弄清楚是否可以在没有 go 工具更新我的 go mod 文件的情况下运行 go modvendor 我特别go get package subpackage commit并提交我的go mod使用正确的版本 然后我跑go mod ve
  • 获取 CLPlacemark 的正确缩放区域

    我在用着MKLocalSearch搜索某些地方 例如城市或城市中的街道 并将其显示在MKMapView 我像这样显示地标 let loc placemark location CLLocation of CLPlacemark var ma
  • 根目录中的新 git 存储库包含子目录中的现有存储库

    我正在开发一个目前不受任何修订控制的大型代码库 是的 确实如此 我一直在一个深层目录中开发一个组件 并创建了一个隐蔽的 git 存储库来跟踪我的更改 我现在想将所有代码添加到源代码管理中 并为整个目录树创建一个存储库 我希望新的外部存储库包
  • 使用 Web Audio Api 播放 Stream 中的点击声音

    我有一个奇怪的问题 我正在使用网络音频播放来自服务器的流 我通过以下方式做到这一点 var d2 new DataView evt data var data new Float32Array d2 byteLength Float32Ar
  • 如何使用 iTextSharp 缩放 PDF 页面,同时保持方向?

    如何在 itextsharp 中保持旋转的同时缩放 pdf 页面 我有以下内容 但我失去了旋转 public static void ScaleToLetter string inPDF string outPDF PdfReader re
  • 如何在不连续重置的情况下将esp8266从深度睡眠中唤醒

    我正在使用 esp8266 构建 IR 到 wifi 桥接器 基本上 我正在构建一个连接到红外遥控器内的 esp8266 的红外接收器 以通过 wifi 将接收到的红外远程按键转发到服务器 我使用的是 Wemos D1 Mini 我已经让
  • 如何在IE10中使用css线性渐变?

    在 IE10 中 我试图创建一个 css 线性渐变 从页面顶部到页面底部 这就是我到目前为止所拥有的
  • XML 解析错误:XML 或文本声明不在 php 中实体的开头

    您好 我正在 php 中生成 xml 文件 但出现错误 XML 解析错误 XML 或文本声明不在实体的开头 我的代码是
  • 某些设备在下班后收到 Gcm 通知

    我正在尝试使用 gcm 通知 我的服务器代码工作正常 并且我获得了成功作为确认 问题是通知发送正确 1 在大多数设备中 通知是立即收到的 在谷歌 Nexus 索尼手机上测试 2 其他设备也在几个小时后收到通知 是的 hours 在 Karb
  • Swift:IAP 更新交易未在 .Purchased 上调用

    我的代码有问题 updateTransactions 函数仅在交易进行时调用一次 交易完成后不再调用 func buyProduct product SKProduct let payment SKPayment product produ
  • Python PyQt - QTableWidget、JSON 和 emitSignal 导致空白单元格

    我将 PyQt 用于一个简单的应用程序 该应用程序从包含 JSON 格式字符串的日志文件中读取数据 并将它们很好地输出到表中 一切都按预期工作 除非我尝试从 加载 函数发出信号 该信号由主窗口拾取 位于一个设计为用新信息重新排列表的槽中 如
  • Lucene TermQuery 和 QueryParser

    我有 2 个 lucene 查询 1 Term term new Term Properties LUCENE APPARTMENT ADDRESS address Query termQuery new TermQuery term To
  • Flutter showDialog 未在 PopupMenuItem 点击上显示

    我在用着PopupMenuButton在我的应用程序中 我想要showDialog在点击一个PopupMenuItem My PopupMenuItem PopupMenuItem child Text Show dialog onTap
  • setState 方法导致 Reactjs 函数中的结果无限循环

    该代码显示数组中的用户记录 我还创建了一个updateCount 功能对内容显示的用户进行计数 我可以看到计数结果alerted并在控制台中 现在我想显示计数结果 为此 我初始化setState 内的方法updateCount功能 upda
  • PHP 和 Java 中的 SHA256

    我正在将一些 Java 代码移植到 PHP 代码 在Java中我有一个哈希SHA256代码如下 public static String hashSHA256 String input throws NoSuchAlgorithmExcep
  • 从 Action 指令创建 DynamicMethod

    我正在使用 DynamicMethod 并旨在执行以下操作 我有一个 Action 从中可以使用字节形式获取 IL 代码GetILAsByteArray 从这个字节我想创建一个动态方法并执行 这是我正在尝试做的事情的一个例子 class P
  • 在 Windows 10 上使用 nuwen MinGW 的 C++17 文件系统

    我想尝试 C 17 中的新文件系统库 因此尝试复制来自 cppreference com 的 std filesystem current path 示例 https en cppreference com w cpp filesystem