解决C++ unordered_map“nvalid use of incomplete type ‘struct std::hash“ 问题

2023-11-19

问题

G++使用unordered_map时候,编译报错:invalid use of incomplete type ‘struct std::hash<,。。。,放在G++6.5交叉编译环境是OK的,但是放在ubuntu14.04报错。

解决&代码

既然G++早期版本不能自动生成枚举类型的hash模板类,那么手动添加template<> struct std::hash<...。

添加如下代码 #if ....#endif区域代码,即可解决问题。

#include <unordered_map>
#include <utility>
#include <cstdint>
#include <iostream>
#include <functional>

namespace test{
  enum COLOR{ WHITE, BLAC };
}

#if 0  // 如果没有这里,G++4.8.4和G++5.4.0会报错
namespace std {
template<>
struct hash<test::COLOR> {
   typedef test::COLOR argument_type;
   typedef size_t result_type;

   result_type operator () (const argument_type& x) const {
      using type = typename std::underlying_type<argument_type>::type;
      return std::hash<type>()(static_cast<type>(x));
   }
};
}
#endif

namespace test{
class mytest{
 public:
  std::unordered_map<COLOR, int> id_map_;
};
}

int main(){
    test::mytest t;
    return 0;
}

结论

发现是G++的问题,ubuntu14.04默认是g++4.8.4,ubuntu16.04是g++5.4。

参考:https://stackoverflow.com/questions/48294401/error-invalid-use-of-incomplete-type-struct-stdhash

ubuntu14.04

g++ (Ubuntu 4.8.4-2ubuntu1~14.04.4) 4.8.4
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

ubuntu16.04

g++ (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

 

最后,ubuntu14.04下报错全部信息放在最后:


In file included from /usr/include/c++/4.8/bits/hashtable.h:35:0,
                 from /usr/include/c++/4.8/unordered_map:47,
                 from unorderedmap.cpp:1:
/usr/include/c++/4.8/bits/hashtable_policy.h: In instantiation of ‘struct std::__detail::_Hash_code_base<test::COLOR, std::pair<const test::COLOR, int>, std::__detail::_Select1st, std::hash<test::COLOR>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, true>’:
/usr/include/c++/4.8/bits/hashtable_policy.h:1402:10:   required from ‘struct std::__detail::_Hashtable_base<test::COLOR, std::pair<const test::COLOR, int>, std::__detail::_Select1st, std::equal_to<test::COLOR>, std::hash<test::COLOR>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Hashtable_traits<true, false, true> >’
/usr/include/c++/4.8/bits/hashtable.h:174:11:   required from ‘class std::_Hashtable<test::COLOR, std::pair<const test::COLOR, int>, std::allocator<std::pair<const test::COLOR, int> >, std::__detail::_Select1st, std::equal_to<test::COLOR>, std::hash<test::COLOR>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >’
/usr/include/c++/4.8/bits/unordered_map.h:100:18:   required from ‘class std::unordered_map<test::COLOR, int>’
unorderedmap.cpp:31:34:   required from here
/usr/include/c++/4.8/bits/hashtable_policy.h:1070:12: error: invalid use of incomplete type ‘struct std::hash<test::COLOR>’
     struct _Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2,
            ^
In file included from /usr/include/c++/4.8/bits/basic_string.h:3033:0,
                 from /usr/include/c++/4.8/string:52,
                 from /usr/include/c++/4.8/stdexcept:39,
                 from /usr/include/c++/4.8/array:38,
                 from /usr/include/c++/4.8/tuple:39,
                 from /usr/include/c++/4.8/unordered_map:41,
                 from unorderedmap.cpp:1:
/usr/include/c++/4.8/bits/functional_hash.h:58:12: error: declaration of ‘struct std::hash<test::COLOR>’
     struct hash;
            ^
In file included from /usr/include/c++/4.8/bits/hashtable.h:35:0,
                 from /usr/include/c++/4.8/unordered_map:47,
                 from unorderedmap.cpp:1:
/usr/include/c++/4.8/bits/hashtable_policy.h:1070:12: error: invalid use of incomplete type ‘struct std::hash<test::COLOR>’
     struct _Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2,
            ^
In file included from /usr/include/c++/4.8/bits/basic_string.h:3033:0,
                 from /usr/include/c++/4.8/string:52,
                 from /usr/include/c++/4.8/stdexcept:39,
                 from /usr/include/c++/4.8/array:38,
                 from /usr/include/c++/4.8/tuple:39,
                 from /usr/include/c++/4.8/unordered_map:41,
                 from unorderedmap.cpp:1:
/usr/include/c++/4.8/bits/functional_hash.h:58:12: error: declaration of ‘struct std::hash<test::COLOR>’
     struct hash;
            ^
In file included from /usr/include/c++/4.8/bits/hashtable.h:35:0,
                 from /usr/include/c++/4.8/unordered_map:47,
                 from unorderedmap.cpp:1:
/usr/include/c++/4.8/bits/hashtable_policy.h:1082:53: error: invalid use of incomplete type ‘struct std::hash<test::COLOR>’
       using __ebo_h1 = _Hashtable_ebo_helper<1, _H1>;
                                                     ^
In file included from /usr/include/c++/4.8/bits/basic_string.h:3033:0,
                 from /usr/include/c++/4.8/string:52,
                 from /usr/include/c++/4.8/stdexcept:39,
                 from /usr/include/c++/4.8/array:38,
                 from /usr/include/c++/4.8/tuple:39,
                 from /usr/include/c++/4.8/unordered_map:41,
                 from unorderedmap.cpp:1:
/usr/include/c++/4.8/bits/functional_hash.h:58:12: error: declaration of ‘struct std::hash<test::COLOR>’
     struct hash;
            ^
In file included from /usr/include/c++/4.8/bits/hashtable.h:35:0,
                 from /usr/include/c++/4.8/unordered_map:47,
                 from unorderedmap.cpp:1:
/usr/include/c++/4.8/bits/hashtable_policy.h:1082:53: error: invalid use of incomplete type ‘struct std::hash<test::COLOR>’
       using __ebo_h1 = _Hashtable_ebo_helper<1, _H1>;
                                                     ^
In file included from /usr/include/c++/4.8/bits/basic_string.h:3033:0,
                 from /usr/include/c++/4.8/string:52,
                 from /usr/include/c++/4.8/stdexcept:39,
                 from /usr/include/c++/4.8/array:38,
                 from /usr/include/c++/4.8/tuple:39,
                 from /usr/include/c++/4.8/unordered_map:41,
                 from unorderedmap.cpp:1:
/usr/include/c++/4.8/bits/functional_hash.h:58:12: error: declaration of ‘struct std::hash<test::COLOR>’
     struct hash;
            ^
unorderedmap.cpp: In constructor ‘std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::size_type, const hasher&, const key_equal&, const allocator_type&) [with _Key = test::COLOR; _Tp = int; _Hash = std::hash<test::COLOR>; _Pred = std::equal_to<test::COLOR>; _Alloc = std::allocator<std::pair<const test::COLOR, int> >; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::size_type = long unsigned int; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hasher = std::hash<test::COLOR>; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::key_equal = std::equal_to<test::COLOR>; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::allocator_type = std::allocator<std::pair<const test::COLOR, int> >]’:
unorderedmap.cpp:29:7: error: invalid use of incomplete type ‘std::unordered_map<test::COLOR, int>::hasher {aka struct std::hash<test::COLOR>}’
 class mytest{
       ^
In file included from /usr/include/c++/4.8/bits/basic_string.h:3033:0,
                 from /usr/include/c++/4.8/string:52,
                 from /usr/include/c++/4.8/stdexcept:39,
                 from /usr/include/c++/4.8/array:38,
                 from /usr/include/c++/4.8/tuple:39,
                 from /usr/include/c++/4.8/unordered_map:41,
                 from unorderedmap.cpp:1:
/usr/include/c++/4.8/bits/functional_hash.h:58:12: error: declaration of ‘std::unordered_map<test::COLOR, int>::hasher {aka struct std::hash<test::COLOR>}’
     struct hash;
            ^
unorderedmap.cpp:29:7: note:   when instantiating default argument for call to std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::size_type, const hasher&, const key_equal&, const allocator_type&) [with _Key = test::COLOR; _Tp = int; _Hash = std::hash<test::COLOR>; _Pred = std::equal_to<test::COLOR>; _Alloc = std::allocator<std::pair<const test::COLOR, int> >; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::size_type = long unsigned int; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hasher = std::hash<test::COLOR>; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::key_equal = std::equal_to<test::COLOR>; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::allocator_type = std::allocator<std::pair<const test::COLOR, int> >]
 class mytest{
       ^
unorderedmap.cpp: In function ‘int main()’:
unorderedmap.cpp:36:18: note: synthesized method ‘test::mytest::mytest()’ first required here
     test::mytest t ;
                  ^
In file included from /usr/include/c++/4.8/bits/hashtable.h:35:0,
                 from /usr/include/c++/4.8/unordered_map:47,
                 from unorderedmap.cpp:1:
/usr/include/c++/4.8/bits/hashtable_policy.h: In instantiation of ‘std::__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, std::__detail::_Default_ranged_hash, true>::_Hash_code_base(const _ExtractKey&, const _H1&, const _H2&, const std::__detail::_Default_ranged_hash&) [with _Key = test::COLOR; _Value = std::pair<const test::COLOR, int>; _ExtractKey = std::__detail::_Select1st; _H1 = std::hash<test::COLOR>; _H2 = std::__detail::_Mod_range_hashing]’:
/usr/include/c++/4.8/bits/hashtable_policy.h:1463:65:   required from ‘std::__detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _H1, _H2, _Hash, _Traits>::_Hashtable_base(const _ExtractKey&, const _H1&, const _H2&, const _Hash&, const _Equal&) [with _Key = test::COLOR; _Value = std::pair<const test::COLOR, int>; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<test::COLOR>; _H1 = std::hash<test::COLOR>; _H2 = std::__detail::_Mod_range_hashing; _Hash = std::__detail::_Default_ranged_hash; _Traits = std::__detail::_Hashtable_traits<true, false, true>]’
/usr/include/c++/4.8/bits/hashtable.h:828:24:   required from ‘std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::_Hashtable(std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::size_type, const _H1&, const _H2&, const _Hash&, const _Equal&, const _ExtractKey&, const allocator_type&) [with _Key = test::COLOR; _Value = std::pair<const test::COLOR, int>; _Alloc = std::allocator<std::pair<const test::COLOR, int> >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<test::COLOR>; _H1 = std::hash<test::COLOR>; _H2 = std::__detail::_Mod_range_hashing; _Hash = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, false, true>; std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::size_type = long unsigned int; std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::allocator_type = std::allocator<std::pair<const test::COLOR, int> >]’
/usr/include/c++/4.8/bits/hashtable.h:397:26:   required from ‘std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::_Hashtable(std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::size_type, const _H1&, const key_equal&, const allocator_type&) [with _Key = test::COLOR; _Value = std::pair<const test::COLOR, int>; _Alloc = std::allocator<std::pair<const test::COLOR, int> >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<test::COLOR>; _H1 = std::hash<test::COLOR>; _H2 = std::__detail::_Mod_range_hashing; _Hash = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, false, true>; std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::size_type = long unsigned int; std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::key_equal = std::equal_to<test::COLOR>; std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::allocator_type = std::allocator<std::pair<const test::COLOR, int> >]’
/usr/include/c++/4.8/bits/unordered_map.h:142:35:   required from ‘std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::size_type, const hasher&, const key_equal&, const allocator_type&) [with _Key = test::COLOR; _Tp = int; _Hash = std::hash<test::COLOR>; _Pred = std::equal_to<test::COLOR>; _Alloc = std::allocator<std::pair<const test::COLOR, int> >; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::size_type = long unsigned int; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hasher = std::hash<test::COLOR>; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::key_equal = std::equal_to<test::COLOR>; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::allocator_type = std::allocator<std::pair<const test::COLOR, int> >]’
unorderedmap.cpp:29:7:   required from here
/usr/include/c++/4.8/bits/hashtable_policy.h:1099:63: error: invalid use of incomplete type ‘struct std::hash<test::COLOR>’
       : __ebo_extract_key(__ex), __ebo_h1(__h1), __ebo_h2(__h2) { }
                                                               ^
In file included from /usr/include/c++/4.8/bits/basic_string.h:3033:0,
                 from /usr/include/c++/4.8/string:52,
                 from /usr/include/c++/4.8/stdexcept:39,
                 from /usr/include/c++/4.8/array:38,
                 from /usr/include/c++/4.8/tuple:39,
                 from /usr/include/c++/4.8/unordered_map:41,
                 from unorderedmap.cpp:1:
/usr/include/c++/4.8/bits/functional_hash.h:58:12: error: declaration of ‘struct std::hash<test::COLOR>’
     struct hash;
            ^
In file included from /usr/include/c++/4.8/bits/hashtable.h:35:0,
                 from /usr/include/c++/4.8/unordered_map:47,
                 from unorderedmap.cpp:1:
/usr/include/c++/4.8/bits/hashtable_policy.h:1099:63: error: invalid use of incomplete type ‘struct std::hash<test::COLOR>’
       : __ebo_extract_key(__ex), __ebo_h1(__h1), __ebo_h2(__h2) { }
                                                               ^
In file included from /usr/include/c++/4.8/bits/basic_string.h:3033:0,
                 from /usr/include/c++/4.8/string:52,
                 from /usr/include/c++/4.8/stdexcept:39,
                 from /usr/include/c++/4.8/array:38,
                 from /usr/include/c++/4.8/tuple:39,
                 from /usr/include/c++/4.8/unordered_map:41,
                 from unorderedmap.cpp:1:
/usr/include/c++/4.8/bits/functional_hash.h:58:12: error: declaration of ‘struct std::hash<test::COLOR>’
     struct hash;

 

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

解决C++ unordered_map“nvalid use of incomplete type ‘struct std::hash“ 问题 的相关文章

  • “RouteCollection”不包含“MapMvcAttributeRoutes”的定义

    我尝试使用基于属性的路由 但是当我尝试以下代码片段来激活基于属性的路由时 我收到以下错误消息 RouteCollection 不包含定义 MapMvcAttributeRoutes 这是我的代码 public class RouteConf
  • C中函数指针的递归声明

    我想声明一个返回指向相同类型函数的指针的函数 我想用它来实现如下状态机 typedef event handler t event handler t event t compilation error event handler t st
  • c# - 显示小数点到小数点后 6 位 [重复]

    这个问题在这里已经有答案了 可能的重复 具有 N 个小数位的 Double ToString https stackoverflow com questions 3059759 double tostring with n number o
  • binary_log_types.h:没有这样的文件或目录

    我正在编译一个小型 mysql C 项目并且 遇到以下错误 C Program Files x86 MySQL MySQL Server 5 7 include mysql com h 22 30 fatal error binary lo
  • 使用空函数调用 hana::is_valid 的用途是什么?

    Boost Hana https www boost org doc libs 1 61 0 libs hana doc html index html offers boost hana is valid https www boost
  • 如何通知父线程所有子线程都已终止?

    我有一个控制台应用程序正在移植到 WPF 该应用程序有 3 个工作线程 在将一些输出结果打印到屏幕上之前 这些线程都连接到主线程 我的理解是 如果我尝试在 WPF 应用程序中执行相同的操作 GUI 将被阻止并且不会响应用户 那么如何通知父线
  • 为什么这个 oracle 批量插入不起作用?

    我正在尝试将一些数据批量插入到 oracle 数据库中 我按照文档中的示例进行操作 this DataBaseAccess new OracleConnection connString var dataAdapter new Oracle
  • 函数指针上的未知类型 F TYPE

    include
  • 从套接字读取 C HTTP

    我想知道如何判断是否已从套接字接收到所有数据 这是一个简单的网络代理 现在我正在处理请求部分 所以发送的内容应该以 r n r n 结尾 我不知道请求会持续多久 我在这里读过一些帖子 说我应该检查读取函数是否返回 0 但其他人说0只在客户端
  • 修改正在运行的可执行文件的资源内容

    All 我将应用程序设置存储在资源中 当我的程序首次加载时 我使用 WinAPI 读取指定的资源 然后我解析检索到的字节数据 这对我来说完美无缺 现在假设用户更改了我的应用程序中的设置 他 她检查复选框控件 我想将更新的设置保存到我的资源中
  • 三种 System.Drawing 方法表现出缓慢的绘制或闪烁:解决方案?或其他选择?

    我正在通过 System Drawing 进行一些绘图 但遇到了一些问题 我将数据保存在队列中 并将该数据绘制 绘制 到三个图片框中 此方法填充图片框 然后滚动图形 所以不要在以前的绘图上绘制 并且逐渐看起来更混乱 我找到了两种绘制图表的解
  • 为什么 httpRuntime targetFramework="4.5" 禁止抓取 .ASPXAUTH cookie?

    当我的 web config 具有以下 httpRuntime 时 我的控制器无法获取 cookie ASPXAUTH 它似乎能够获取任何其他 cookie 无论带或不带句点前缀 如果我删除下面的行 它就可以正常工作
  • C 中的链表数组:初始化和插入?

    我需要创建一个链表数组 如图所示 这就是我到目前为止所做的 typedef struct Node int data struct Node next Node int main void Node link 5 for int q 0 q
  • 使用 _Alignas 进行结构成员对齐

    我想知道以下问题 是新的吗 Alignas结盟 C11 中的说明符适用于结构成员吗 我一直假设这么多 但彻底阅读了 N1570 公开草案似乎表明对齐说明符不能 出现在一个说明符限定符列表 这就是我所期望的 如果得到支持的话 我已经读过几遍语
  • C++ 联合数组和变量?

    在C 中没有办法做这样的事情吗 union Scalar x y Scalar v 2 Where x v 0 and y v 1 既然您使用的是 C 而不是 C 并且它们具有相同的类型 为什么不直接将 x 设为对 v 0 的引用 将 y
  • 将多个 Blob 输入传递到 QueueTrigger Azure 函数的最佳方法

    问题 触发后 生成 3 个 XML 文件 完成后将它们通过 ftp 传输到站点 目前的方法 我有一个 HTTP 触发器 Azure 函数 运行时将构造 3 个 XML 文件并将它们保存到 Azure 存储 Blob 容器中 由于有多个输出
  • 返回 ICollection 而不是 List 的真正优势是什么? [复制]

    这个问题在这里已经有答案了 我读过几篇博客文章 提到对于公共 API 我们应该始终返回 ICollection 或 IEnumerable 而不是 List 返回 ICollection 而不是 List 的真正优势是什么 Thanks 复
  • 在Framework 4.6项目中使用.net core DLL

    我已经在 net core 2 0 中构建了一个 DLL 现在我想在使用 net 4 6 1 框架的 WinForms 项目中使用它 我可以引用该 dll 但收到 System IO FileLoadException 表示找不到 Syst
  • 是否可以编写一个在另一个 Windows 应用程序中选择文本时收到通知的 Windows 应用程序?

    我很好奇是否可以编写一个程序来监视我的文本选择 一种可能的用途是编写一个与编辑器 IDE 无关的代码格式化程序 应用程序 服务 P 启动并以某种方式挂接到窗口中 以便在任何窗口中选择文本时收到通知 启动其他一些应用程序 A 用户选择 A 中
  • 替换全局热键

    我有一个位于托盘中的应用程序 我想定义多个热键来触发我的程序中的事件 我从 AaronLS 在这个问题中的出色回答中找到了灵感 使用C 设置全局热键 https stackoverflow com a 27309185 3064934 如果

随机推荐

  • 弱网测试

    首先我们要清楚什么是弱网呢 举一个例子 我们在一个封闭环境中 有时候APP打开的特别慢 或者是一直加载不出来我们想要看到的信息 也就是说这个时候的网速特别的慢 这种状态呢 我们可以理解为弱网 弱网直接造成的影响有丢包 数据无法加载 消息更新
  • Js中async/await的执行顺序详解

    前言 虽然大家知道async await 但是很多人对这个方法中内部怎么执行的还不是很了解 本文是我看了一遍技术博客理解 JavaScript 的 async await 如果对async await不熟悉可以先看下这篇文章 后拓展了一下
  • Tomcat调优常见参数配置

    Tomcat 是一个流行的 Web 应用服务器 以下是一些常见的 Tomcat 配置参数 1 端口配置 HTTP 端口 tomcat 默认使用 8080 端口 可以通过修改 server xml 文件中的 Connector 配置来更改端口
  • QT学习OpenGL序列: Texture

    学习OpenGL文理 1 头文件 ifndef COPENGLWIDGETHELLOTEXTURES H define COPENGLWIDGETHELLOTEXTURES H 控件名称 Hello Textures 注意 STD C Ve
  • Vim中多行删除

    在操作虚拟机的时候 都会出错 当在vim中出现问题的时候 可以在dw普通模式下删除对应的单词 如果在vim中使用多行删除 可以使用dd vim 命令 将行数添加到该命令中 如10dd将从光标底部删除10行 包含光标行在内 删除单行 1 按
  • The Necklace 【UVA - 10054】【欧拉回路详解】

    题目链接1 题目链接2 题目求的是一串珠子 要让它们首尾相互照应才能串起来 并且 最后要连成一个环 使得最后的珠子的尾与第一个珠子的头相互对应 那么 这道题就是道求欧拉回路的题了 我们要先判断这是不是能够构成欧拉回路 这是个无向图 再对于需
  • 密码学原语如何应用?解析密文同态性的妙用

    隐私数据在密文形式下是否依旧可以加减乘除 其背后的同态性原理具体指什么 半同态性和全同态性有什么区别 单密钥和多密钥同态加密有哪些奇妙的应用场景 隐私保护方案设计 往往需要在密文状态下 对隐私数据进行特定的业务操作 以此保障数据的机密性 沿
  • Tomcat单实例安装部署

    自说 Tomcat 服务器是一个免费的开放源代码的Web 应用服务器 属于轻量级应用服务器 主要用于处理动态web数据 部署java环境 上传jdk包 使用xftp上传 解压 tar zxvf u01 jdk 8u333 linux i58
  • 傻傻分不清楚的sort,sorted,reverse,reversed

    前言 在平常编码过程中 列表是经常用的 而常用的方法也基本就是遍历循环进行元素的append 还有很多方法不熟悉 比如有一次遇到一个问题 将一个列表进行反转 拿起百度 得到答案 方法1 列表切片 步长设置为 1 方法2 列表自带方法 lst
  • 软件测试面试经验及面试题目分享

    关于面试 不同的公司千差万别 面试bat 创业公司 外包 难度和轮数差异巨大 但是有个共同点就是都是面试造航母 工作拧螺丝 意思就是说工作起来其实很容易 但是要过面试却很难 包括每天大家学习新技能很大一部分就是为了跳槽加薪 直接一点来说 其
  • 监控程序运行状态,并根据状态启动或重启进程

    监控程序运行状态 并根据状态启动或重启进程 需求 设计思路 实现 需求 根据运行环境要求 我们所做的程序常常会在无人监管的情况下运行几个月之久 所以为了保证程序的正常运行 决定添加一个附属的监控程序 监控程序要求如下 当检测到主程序未启动时
  • @RequestMapping、@PostMapping、@GetMapping的区别

    GetMapping 用于将HTTP GET请求映射到特定处理程序方法的注释 具体来说 GetMapping是一个作为快捷方式的组合注释 RequestMapping method RequestMethod GET PostMapping
  • QT_下拉选项框_Combo Box_使用

    添加选项 第一种 UI界面静态添加 如下 第二种 代码添加 如下 1 在mainwindow h头文件中添加创建用函数 2 定义函数 void MainWindow add combobox void ui gt comboBox gt a
  • JavaCollection集合

    5 Collection集合 5 1 Collection集合概述 是单列集合的顶层接口 它表示一组对象 这些对象也称Collection元素 JDK不提供此接口的直接实现 它提供更具体的子接口 Set 和 List 实现 package
  • 取消计算机系统密钥,BitLocker驱动器被加密怎么恢复密钥 忘了密码取消删除方法...

    由于最近电脑蓝屏 我需要U盘制作启动盘 结果U盘插入到我电脑 我发现此U盘被我以前用BitLocker加密过了 BitLocker密码我也忘记了 我只好去我以前旧电脑去找 BitLocker 驱动器加密恢复密钥 还好我旧电脑以前保存过了 我
  • WordPress(6)网站侧边栏倒计时进度小工具

    提示 文章写完后 目录可以自动生成 如何生成可参考右边的帮助文档 文章目录 效果图 在这里插入图片描述 一 添加位置 二 主题style css文件中添加美化 1 引入库 2 添加自定义的HTML模块 效果图 提示 以下是本篇文章正文内容
  • 重要-作为Android开发者必须了解的Gradle知识

    https www jianshu com p c31513f5f550
  • 【NOI 2015】程序自动分析

    题目 传送门 题目描述 在实现程序自动分析的过程中 常常需要判定一些约束条件是否能被同时满足 考虑一个约束满足问题的简化版本 假设 x 1 x 2
  • windows10和安装linux双系统安装教程(超简单)

    windows10和安装linux双系统安装教程 超简单 一共分三步 第一步了解自己电脑的BIOS 第二步安装windows10系统 第三步在windows10中安装ubuntu系统 第一步了解自己电脑的BIOS UEFI 是新式BIOS
  • 解决C++ unordered_map“nvalid use of incomplete type ‘struct std::hash“ 问题

    问题 G 使用unordered map时候 编译报错 invalid use of incomplete type struct std hash lt 放在G 6 5交叉编译环境是OK的 但是放在ubuntu14 04报错 解决 代码