01_data_struct_hashtable

文章提供了一个使用C语言实现的哈希表结构,包括创建、插入、搜索、删除和销毁哈希表的功能。测试代码展示了如何向哈希表中添加元素,查找特定键的值,以及删除键值对。

1.hashtable的定义

2.hashtable的测试代码

#include <stdio.h>
#include <stdlib.h>
#include "main.h"

#define TABLE_SIZE 10

typedef struct Node {
    int key;
    int value;
    struct Node* next;
} Node;

typedef struct {
    Node* head;
} HashTable;

HashTable* createHashTable() {
    HashTable* hashtable = (HashTable*)malloc(sizeof(HashTable) * TABLE_SIZE);
    for (int i = 0; i < TABLE_SIZE; i++) {
        hashtable[i].head = NULL;
    }
    return hashtable;
}

int hashFunction(int key) {
    return key % TABLE_SIZE;
}

void insert(HashTable* hashtable, int key, int value) {
    int index = hashFunction(key);
    Node* newNode = (Node*)malloc(sizeof(Node));
    newNode->key = key;
    newNode->value = value;
    newNode->next = NULL;

    if (hashtable[index].head == NULL) {
        hashtable[index].head = newNode;
    }
    else {
        Node* currentNode = hashtable[index].head;
        while (currentNode->next != NULL) {
            currentNode = currentNode->next;
        }
        currentNode->next = newNode;
    }
}

int search(HashTable* hashtable, int key) {
    int index = hashFunction(key);
    Node* currentNode = hashtable[index].head;

    while (currentNode != NULL) {
        if (currentNode->key == key) {
            return currentNode->value;
        }
        currentNode = currentNode->next;
    }

    return -1; // 返回-1表示未找到对应的值
}

void delete(HashTable* hashtable, int key) {
    int index = hashFunction(key);
    Node* currentNode = hashtable[index].head;
    Node* prevNode = NULL;

    while (currentNode != NULL) {
        if (currentNode->key == key) {
            if (prevNode == NULL) {
                hashtable[index].head = currentNode->next;
            }
            else {
                prevNode->next = currentNode->next;
            }
            free(currentNode);
            return;
        }
        prevNode = currentNode;
        currentNode = currentNode->next;
    }
}

void display(HashTable* hashtable) {
    for (int i = 0; i < TABLE_SIZE; i++) {
        printf("Index %d: ", i);
        Node* currentNode = hashtable[i].head;
        while (currentNode != NULL) {
            printf("(%d, %d) ", currentNode->key, currentNode->value);
            currentNode = currentNode->next;
        }
        printf("\n");
    }
}

void destroyHashTable(HashTable* hashtable) {
    for (int i = 0; i < TABLE_SIZE; i++) {
        Node* currentNode = hashtable[i].head;
        while (currentNode != NULL) {
            Node* tempNode = currentNode;
            currentNode = currentNode->next;
            free(tempNode);
        }
    }
    free(hashtable);
}

int hash_table_test() {
    HashTable* hashtable = createHashTable();

    insert(hashtable, 1, 10);
    insert(hashtable, 2, 20);
    insert(hashtable, 11, 30);
    insert(hashtable, 21, 40);
    insert(hashtable, 12, 50);

    printf("Initial hash table:\n");
    display(hashtable);

    int keyToSearch = 11;
    int searchResult = search(hashtable, keyToSearch);
    if (searchResult != -1) {
        printf("Value found for key %d: %d\n", keyToSearch, searchResult);
    }
    else {
        printf("Value not found for key %d\n", keyToSearch);
    }

    int keyToDelete = 2;
    delete(hashtable, keyToDelete);
    printf("Hash table after deletion of key %d:\n", keyToDelete);
    display(hashtable);

    destroyHashTable(hashtable);

    return 0;
}

3.程序运行结果如下图:

 

#include <stdio.h> #include <string.h> #include <stdlib.h> #define MAX 10 #define NULL_KEY -1 typedef struct node { int *elem_p; int num; }hashtable_t; hashtable_t *create_hashtable() { printf("create_hashtable+\n"); hashtable_t *hash = NULL; hash = (hashtable_t *)malloc(sizeof(hashtable_t)); if(hash == NULL) { return NULL; } hash->elem_p = (int *)malloc(sizeof(int) * MAX); if(hash->elem_p == NULL) { free(hash); return NULL; } memset(hash->elem_p, NULL_KEY, sizeof(hashtable_t) * MAX); hash->num = 0; printf("create_hashtable-\n"); return hash; } int is_full_hashtable(hashtable_t *hash) { return hash->num == MAX ? 1 : 0; } void insert_data_hash(hashtable_t *hash, int value) { if(is_full_hashtable(hash)) { printf("hash table is full!\n"); return ; } int key = 0; key = value % MAX; while(hash->elem_p[key] != NULL_KEY) { key = (key + 1) % MAX; } hash->elem_p[key] = value; hash->num++; return ; } void print_hash_table(hashtable_t *hash) { for(int i = 0; i < MAX; i++) { printf("%d ", hash->elem_p[i]); } printf("\n"); return ; } void search_hash_table(hashtable_t *hash, int value) { //int key = vaule % MAX; for(int i = 0; i < MAX; i++) { if(hash->elem_p[i] == value) { printf("%d\n", i); } } } int main() { hashtable_t *hash = NULL; int data[MAX] = {13,29,27,28,26,30,38,16,14,19}; int value = 0; hash = create_hashtable(); for(int i = 0; i < MAX; i++) { insert_data_hash(hash, data[i]); } print_hash_table(hash); printf("please input you want to find value: "); scanf("%d",&value); search_hash_table(hash, value); free(hash->elem_p); free(hash); return 0; } 上面代码在执行main函数scanf后会出现段错误,请问问题出现在了哪里?
12-05
^ /usr/include/c++/5/bits/unordered_map.h:111:46: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<raw_data_precision> >, std::__detail::__is_noexcept_hash<raw_data_precision, std::hash<raw_data_precision> > > >’ typedef typename _Hashtable::key_equal key_equal; ^ /usr/include/c++/5/bits/unordered_map.h:112:51: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<raw_data_precision> >, std::__detail::__is_noexcept_hash<raw_data_precision, std::hash<raw_data_precision> > > >’ typedef typename _Hashtable::allocator_type allocator_type; ^ /usr/include/c++/5/bits/unordered_map.h:117:45: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<raw_data_precision> >, std::__detail::__is_noexcept_hash<raw_data_precision, std::hash<raw_data_precision> > > >’ typedef typename _Hashtable::pointer pointer; ^ /usr/include/c++/5/bits/unordered_map.h:118:50: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<raw_data_precision> >, std::__detail::__is_noexcept_hash<raw_data_precision, std::hash<raw_data_precision> > > >’ typedef typename _Hashtable::const_pointer const_pointer; ^ /usr/include/c++/5/bits/unordered_map.h:119:47: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<raw_data_precision> >, std::__detail::__is_noexcept_hash<raw_data_precision, std::hash<raw_data_precision> > > >’ typedef typename _Hashtable::reference reference; ^ /usr/include/c++/5/bits/unordered_map.h:120:52: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<raw_data_precision> >, std::__detail::__is_noexcept_hash<raw_data_precision, std::hash<raw_data_precision> > > >’ typedef typename _Hashtable::const_reference const_reference; ^ /usr/include/c++/5/bits/unordered_map.h:121:46: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<raw_data_precision> >, std::__detail::__is_noexcept_hash<raw_data_precision, std::hash<raw_data_precision> > > >’ typedef typename _Hashtable::iterator iterator; ^ /usr/include/c++/5/bits/unordered_map.h:122:51: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<raw_data_precision> >, std::__detail::__is_noexcept_hash<raw_data_precision, std::hash<raw_data_precision> > > >’ typedef typename _Hashtable::const_iterator const_iterator; ^ /usr/include/c++/5/bits/unordered_map.h:123:51: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<raw_data_precision> >, std::__detail::__is_noexcept_hash<raw_data_precision, std::hash<raw_data_precision> > > >’ typedef typename _Hashtable::local_iterator local_iterator; ^ /usr/include/c++/5/bits/unordered_map.h:124:57: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<raw_data_precision> >, std::__detail::__is_noexcept_hash<raw_data_precision, std::hash<raw_data_precision> > > >’ typedef typename _Hashtable::const_local_iterator const_local_iterator; ^ /usr/include/c++/5/bits/unordered_map.h:125:47: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<raw_data_precision> >, std::__detail::__is_noexcept_hash<raw_data_precision, std::hash<raw_data_precision> > > >’ typedef typename _Hashtable::size_type size_type; ^ /usr/include/c++/5/bits/unordered_map.h:126:52: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<raw_data_precision> >, std::__detail::__is_noexcept_hash<raw_data_precision, std::hash<raw_data_precision> > > >’ typedef typename _Hashtable::difference_type difference_type; ^ /usr/include/c++/5/bits/unordered_map.h:280:7: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<raw_data_precision> >, std::__detail::__is_noexcept_hash<raw_data_precision, std::hash<raw_data_precision> > > >’ operator=(initializer_list<value_type> __l) ^ /usr/include/c++/5/bits/unordered_map.h:379:2: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<raw_data_precision> >, std::__detail::__is_noexcept_hash<raw_data_precision, std::hash<raw_data_precision> > > >’ emplace(_Args&&... __args) ^ /usr/include/c++/5/bits/unordered_map.h:432:7: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<raw_data_precision> >, std::__detail::__is_noexcept_hash<raw_data_precision, std::hash<raw_data_precision> > > >’ insert(const value_type& __x) ^ /usr/include/c++/5/bits/unordered_map.h:439:2: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<raw_data_precision> >, std::__detail::__is_noexcept_hash<raw_data_precision, std::hash<raw_data_precision> > > >’ insert(_Pair&& __x) ^ /usr/include/c++/5/bits/unordered_map.h:499:7: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<raw_data_precision> >, std::__detail::__is_noexcept_hash<raw_data_precision, std::hash<raw_data_precision> > > >’ insert(initializer_list<value_type> __l) ^ /usr/include/c++/5/bits/unordered_map.h:645:7: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<raw_data_precision> >, std::__detail::__is_noexcept_hash<raw_data_precision, std::hash<raw_data_precision> > > >’ equal_range(const key_type& __x) ^ /usr/include/c++/5/bits/unordered_map.h:649:7: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<raw_data_precision> >, std::__detail::__is_noexcept_hash<raw_data_precision, std::hash<raw_data_precision> > > >’ equal_range(const key_type& __x) const ^ In file included from /home/tp/Project/AOV-课题/软件sdk/Iford_IMD00V5.1.1/Iford_IMD00V5.1.1/SourceCode/sdk/verify/sample_code/libraries/amigos/amigos_base/amigos_module_base.h:29:0, from /home/tp/Project/AOV-课题/软件sdk/Iford_IMD00V5.1.1/Iford_IMD00V5.1.1/SourceCode/sdk/verify/sample_code/libraries/amigos/amigos_base/amigos_module_init.h:19, from /home/tp/Project/AOV-课题/软件sdk/Iford_IMD00V5.1.1/Iford_IMD00V5.1.1/SourceCode/sdk/verify/sample_code/libraries/amigos_ext/modules/amigos_module_sync.cpp:19: /home/tp/Project/AOV-课题/软件sdk/Iford_IMD00V5.1.1/Iford_IMD00V5.1.1/SourceCode/sdk/verify/sample_code/libraries/amigos/amigos_base/amigos_module_base.h: In static member function ‘static std::__cxx11::string ss_enum_cast<raw_data_precision>::to_str(const raw_data_precision&)’: /home/tp/Project/AOV-课题/软件sdk/Iford_IMD00V5.1.1/Iford_IMD00V5.1.1/SourceCode/sdk/verify/sample_code/libraries/amigos/amigos_base/amigos_module_base.h:88:1: error: too many initializers for ‘const std::unordered_map<raw_data_precision, std::__cxx11::basic_string<char> >’ }); ^ /home/tp/Project/AOV-课题/软件sdk/Iford_IMD00V5.1.1/Iford_IMD00V5.1.1/SourceCode/sdk/verify/sample_code/../common/ss_util/ss_enum_cast.hpp:38:73: note: in definition of macro ‘SS_ENUM_CAST_STR’ static const std::unordered_map<_EnumType, std::string> m = __VA_ARGS__; \ ^ /home/tp/Project/AOV-课题/软件sdk/Iford_IMD00V5.1.1/Iford_IMD00V5.1.1/SourceCode/sdk/verify/sample_code/../common/ss_util/ss_enum_cast.hpp:40:25: error: ‘const class std::unordered_map<raw_data_precision, std::__cxx11::basic_string<char> >’ has no member named ‘find’ auto it = m.find(e); \ ^ /home/tp/Project/AOV-课题/软件sdk/Iford_IMD00V5.1.1/Iford_IMD00V5.1.1/SourceCode/sdk/verify/sample_code/libraries/amigos/amigos_base/amigos_module_base.h:81:1: note: in expansion of macro ‘SS_ENUM_CAST_STR’ SS_ENUM_CAST_STR(raw_data_precision , { ^ /home/tp/Project/AOV-课题/软件sdk/Iford_IMD00V5.1.1/Iford_IMD00V5.1.1/SourceCode/sdk/verify/sample_code/../common/ss_util/ss_enum_cast.hpp:41:28: error: ‘const class std::unordered_map<raw_data_precision, std::__cxx11::basic_string<char> >’ has no member named ‘end’ return it != m.end() ? it->second : "Unknown"; \ ^ /home/tp/Project/AOV-课题/软件sdk/Iford_IMD00V5.1.1/Iford_IMD00V5.1.1/SourceCode/sdk/verify/sample_code/libraries/amigos/amigos_base/amigos_module_base.h:81:1: note: in expansion of macro ‘SS_ENUM_CAST_STR’ SS_ENUM_CAST_STR(raw_data_precision , { ^ In file included from /usr/include/c++/5/bits/hashtable.h:35:0, from /usr/include/c++/5/unordered_map:47, from /home/tp/Project/AOV-课题/软件sdk/Iford_IMD00V5.1.1/Iford_IMD00V5.1.1/SourceCode/sdk/verify/sample_code/libraries/amigos/amigos_base/amigos_module_base.h:25, from /home/tp/Project/AOV-课题/软件sdk/Iford_IMD00V5.1.1/Iford_IMD00V5.1.1/SourceCode/sdk/verify/sample_code/libraries/amigos/amigos_base/amigos_module_init.h:19, from /home/tp/Project/AOV-课题/软件sdk/Iford_IMD00V5.1.1/Iford_IMD00V5.1.1/SourceCode/sdk/verify/sample_code/libraries/amigos_ext/modules/amigos_module_sync.cpp:19: /usr/include/c++/5/bits/hashtable_policy.h: In instantiation of ‘struct std::__detail::__is_noexcept_hash<raw_video_fmt, std::hash<raw_video_fmt> >’: /usr/include/c++/5/type_traits:137:12: required from ‘struct std::__and_<std::__is_fast_hash<std::hash<raw_video_fmt> >, std::__detail::__is_noexcept_hash<raw_video_fmt, std::hash<raw_video_fmt> > >’ /usr/include/c++/5/type_traits:148:38: required from ‘struct std::__not_<std::__and_<std::__is_fast_hash<std::hash<raw_video_fmt> >, std::__detail::__is_noexcept_hash<raw_video_fmt, std::hash<raw_video_fmt> > > >’ /usr/include/c++/5/bits/unordered_map.h:100:66: required from ‘class std::unordered_map<raw_video_fmt, std::__cxx11::basic_string<char> >’ /home/tp/Project/AOV-课题/软件sdk/Iford_IMD00V5.1.1/Iford_IMD00V5.1.1/SourceCode/sdk/verify/sample_code/libraries/amigos/amigos_base/amigos_module_base.h:107:69: required from here /usr/include/c++/5/bits/hashtable_policy.h:85:34: error: no match for call to ‘(const std::hash<raw_video_fmt>) (const raw_video_fmt&)’ noexcept(declval<const _Hash&>()(declval<const _Key&>()))> ^ In file included from /usr/include/c++/5/bits/move.h:57:0, from /usr/include/c++/5/bits/stl_pair.h:59, from /usr/include/c++/5/bits/stl_algobase.h:64, from /usr/include/c++/5/deque:60, from /usr/include/c++/5/queue:60, from /home/tp/Project/AOV-课题/软件sdk/Iford_IMD00V5.1.1/Iford_IMD00V5.1.1/SourceCode/sdk/verify/sample_code/libraries/amigos/amigos_base/amigos_module_base.h:20, from /home/tp/Project/AOV-课题/软件sdk/Iford_IMD00V5.1.1/Iford_IMD00V5.1.1/SourceCode/sdk/verify/sample_code/libraries/amigos/amigos_base/amigos_module_init.h:19, from /home/tp/Project/AOV-课题/软件sdk/Iford_IMD00V5.1.1/Iford_IMD00V5.1.1/SourceCode/sdk/verify/sample_code/libraries/amigos_ext/modules/amigos_module_sync.cpp:19: /usr/include/c++/5/type_traits: In instantiation of ‘struct std::__not_<std::__and_<std::__is_fast_hash<std::hash<raw_video_fmt> >, std::__detail::__is_noexcept_hash<raw_video_fmt, std::hash<raw_video_fmt> > > >’: /usr/include/c++/5/bits/unordered_map.h:100:66: required from ‘class std::unordered_map<raw_video_fmt, std::__cxx11::basic_string<char> >’ /home/tp/Project/AOV-课题/软件sdk/Iford_IMD00V5.1.1/Iford_IMD00V5.1.1/SourceCode/sdk/verify/sample_code/libraries/amigos/amigos_base/amigos_module_base.h:107:69: required from here /usr/include/c++/5/type_traits:148:38: error: ‘value’ is not a member of ‘std::__and_<std::__is_fast_hash<std::hash<raw_video_fmt> >, std::__detail::__is_noexcept_hash<raw_video_fmt, std::hash<raw_video_fmt> > >’ : public integral_constant<bool, !_Pp::value> ^ In file included from /usr/include/c++/5/unordered_map:48:0, from /home/tp/Project/AOV-课题/软件sdk/Iford_IMD00V5.1.1/Iford_IMD00V5.1.1/SourceCode/sdk/verify/sample_code/libraries/amigos/amigos_base/amigos_module_base.h:25, from /home/tp/Project/AOV-课题/软件sdk/Iford_IMD00V5.1.1/Iford_IMD00V5.1.1/SourceCode/sdk/verify/sample_code/libraries/amigos/amigos_base/amigos_module_init.h:19, from /home/tp/Project/AOV-课题/软件sdk/Iford_IMD00V5.1.1/Iford_IMD00V5.1.1/SourceCode/sdk/verify/sample_code/libraries/amigos_ext/modules/amigos_module_sync.cpp:19: /usr/include/c++/5/bits/unordered_map.h: In instantiation of ‘class std::unordered_map<raw_video_fmt, std::__cxx11::basic_string<char> >’: /home/tp/Project/AOV-课题/软件sdk/Iford_IMD00V5.1.1/Iford_IMD00V5.1.1/SourceCode/sdk/verify/sample_code/libraries/amigos/amigos_base/amigos_module_base.h:107:69: required from here /usr/include/c++/5/bits/unordered_map.h:100:66: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<raw_video_fmt> >, std::__detail::__is_noexcept_hash<raw_video_fmt, std::hash<raw_video_fmt> > > >’ typedef __umap_hashtable<_Key, _Tp, _Hash, _Pred, _Alloc> _Hashtable; ^ /usr/include/c++/5/bits/unordered_map.h:107:45: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<raw_video_fmt> >, std::__detail::__is_noexcept_hash<raw_video_fmt, std::hash<raw_video_fmt> > > >’ typedef typename _Hashtable::key_type key_type; ^ /usr/include/c++/5/bits/unordered_map.h:108:47: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<raw_video_fmt> >, std::__detail::__is_noexcept_hash<raw_video_fmt, std::hash<raw_video_fmt> > > >’ typedef typename _Hashtable::value_type value_type; ^ /usr/include/c++/5/bits/unordered_map.h:109:48: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<raw_video_fmt> >, std::__detail::__is_noexcept_hash<raw_video_fmt, std::hash<raw_video_fmt> > > >’ typedef typename _Hashtable::mapped_type mapped_type; ^ /usr/include/c++/5/bits/unordered_map.h:110:43: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<raw_video_fmt> >, std::__detail::__is_noexcept_hash<raw_video_fmt, std::hash<raw_video_fmt> > > >’ typedef typename _Hashtable::hasher hasher; ^ /usr/include/c++/5/bits/unordered_map.h:111:46: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<raw_video_fmt> >, std::__detail::__is_noexcept_hash<raw_video_fmt, std::hash<raw_video_fmt> > > >’ typedef typename _Hashtable::key_equal key_equal; ^ /usr/include/c++/5/bits/unordered_map.h:112:51: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<raw_video_fmt> >, std::__detail::__is_noexcept_hash<raw_video_fmt, std::hash<raw_video_fmt> > > >’ typedef typename _Hashtable::allocator_type allocator_type; ^ /usr/include/c++/5/bits/unordered_map.h:117:45: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<raw_video_fmt> >, std::__detail::__is_noexcept_hash<raw_video_fmt, std::hash<raw_video_fmt> > > >’ typedef typename _Hashtable::pointer pointer; ^ /usr/include/c++/5/bits/unordered_map.h:118:50: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<raw_video_fmt> >, std::__detail::__is_noexcept_hash<raw_video_fmt, std::hash<raw_video_fmt> > > >’ typedef typename _Hashtable::const_pointer const_pointer; ^ /usr/include/c++/5/bits/unordered_map.h:119:47: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<raw_video_fmt> >, std::__detail::__is_noexcept_hash<raw_video_fmt, std::hash<raw_video_fmt> > > >’ typedef typename _Hashtable::reference reference; ^ /usr/include/c++/5/bits/unordered_map.h:120:52: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<raw_video_fmt> >, std::__detail::__is_noexcept_hash<raw_video_fmt, std::hash<raw_video_fmt> > > >’ typedef typename _Hashtable::const_reference const_reference; ^ /usr/include/c++/5/bits/unordered_map.h:121:46: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<raw_video_fmt> >, std::__detail::__is_noexcept_hash<raw_video_fmt, std::hash<raw_video_fmt> > > >’ typedef typename _Hashtable::iterator iterator; ^ /usr/include/c++/5/bits/unordered_map.h:122:51: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<raw_video_fmt> >, std::__detail::__is_noexcept_hash<raw_video_fmt, std::hash<raw_video_fmt> > > >’ typedef typename _Hashtable::const_iterator const_iterator; ^ /usr/include/c++/5/bits/unordered_map.h:123:51: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<raw_video_fmt> >, std::__detail::__is_noexcept_hash<raw_video_fmt, std::hash<raw_video_fmt> > > >’ typedef typename _Hashtable::local_iterator local_iterator; ^ /usr/include/c++/5/bits/unordered_map.h:124:57: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<raw_video_fmt> >, std::__detail::__is_noexcept_hash<raw_video_fmt, std::hash<raw_video_fmt> > > >’ typedef typename _Hashtable::const_local_iterator const_local_iterator; ^ /usr/include/c++/5/bits/unordered_map.h:125:47: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<raw_video_fmt> >, std::__detail::__is_noexcept_hash<raw_video_fmt, std::hash<raw_video_fmt> > > >’ typedef typename _Hashtable::size_type size_type; ^ /usr/include/c++/5/bits/unordered_map.h:126:52: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<raw_video_fmt> >, std::__detail::__is_noexcept_hash<raw_video_fmt, std::hash<raw_video_fmt> > > >’ typedef typename _Hashtable::difference_type difference_type; ^ /usr/include/c++/5/bits/unordered_map.h:280:7: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<raw_video_fmt> >, std::__detail::__is_noexcept_hash<raw_video_fmt, std::hash<raw_video_fmt> > > >’ operator=(initializer_list<value_type> __l) ^ /usr/include/c++/5/bits/unordered_map.h:379:2: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<raw_video_fmt> >, std::__detail::__is_noexcept_hash<raw_video_fmt, std::hash<raw_video_fmt> > > >’ emplace(_Args&&... __args) ^ /usr/include/c++/5/bits/unordered_map.h:432:7: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<raw_video_fmt> >, std::__detail::__is_noexcept_hash<raw_video_fmt, std::hash<raw_video_fmt> > > >’ insert(const value_type& __x) ^ /usr/include/c++/5/bits/unordered_map.h:439:2: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<raw_video_fmt> >, std::__detail::__is_noexcept_hash<raw_video_fmt, std::hash<raw_video_fmt> > > >’ insert(_Pair&& __x) ^ /usr/include/c++/5/bits/unordered_map.h:499:7: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<raw_video_fmt> >, std::__detail::__is_noexcept_hash<raw_video_fmt, std::hash<raw_video_fmt> > > >’ insert(initializer_list<value_type> __l) ^ /usr/include/c++/5/bits/unordered_map.h:645:7: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<raw_video_fmt> >, std::__detail::__is_noexcept_hash<raw_video_fmt, std::hash<raw_video_fmt> > > >’ equal_range(const key_type& __x) ^ /usr/include/c++/5/bits/unordered_map.h:649:7: error: ‘value’ is not a member of ‘std::__not_<std::__and_<std::__is_fast_hash<std::hash<raw_video_fmt> >, std::__detail::__is_noexcept_hash<raw_video_fmt, std::hash<raw_video_fmt> > > >’ equal_range(const key_type& __x) const ^ In file included from /home/tp/Project/AOV-课题/软件sdk/Iford_IMD00V5.1.1/Iford_IMD00V5.1.1/SourceCode/sdk/verify/sample_code/libraries/amigos/amigos_base/amigos_module_init.h:19:0, from /home/tp/Project/AOV-课题/软件sdk/Iford_IMD00V5.1.1/Iford_IMD00V5.1.1/SourceCode/sdk/verify/sample_code/libraries/amigos_ext/modules/amigos_module_sync.cpp:19: /home/tp/Project/AOV-课题/软件sdk/Iford_IMD00V5.1.1/Iford_IMD00V5.1.1/SourceCode/sdk/verify/sample_code/libraries/amigos/amigos_base/amigos_module_base.h: In static member function ‘static std::__cxx11::string ss_enum_cast<raw_video_fmt>::to_str(const raw_video_fmt&)’: /home/tp/Project/AOV-课题/软件sdk/Iford_IMD00V5.1.1/Iford_IMD00V5.1.1/SourceCode/sdk/verify/sample_code/libraries/amigos/amigos_base/amigos_module_base.h:126:9: error: too many initializers for ‘const std::unordered_map<raw_video_fmt, std::__cxx11::basic_string<char> >’ }; ^ /home/tp/Project/AOV-课题/软件sdk/Iford_IMD00V5.1.1/Iford_IMD00V5.1.1/SourceCode/sdk/verify/sample_code/libraries/amigos/amigos_base/amigos_module_base.h:127:21: error: ‘const class std::unordered_map<raw_video_fmt, std::__cxx11::basic_string<char> >’ has no member named ‘find’ auto it = m.find(fmt); ^ /home/tp/Project/AOV-课题/软件sdk/Iford_IMD00V5.1.1/Iford_IMD00V5.1.1/SourceCode/sdk/verify/sample_code/libraries/amigos/amigos_base/amigos_module_base.h:128:24: error: ‘const class std::unordered_map<raw_video_fmt, std::__cxx11::basic_string<char> >’ has no member named ‘end’ return it != m.end() ? it->second : "Unknown"; ^ /home/tp/Project/AOV-课题/软件sdk/Iford_IMD00V5.1.1/Iford_IMD00V5.1.1/SourceCode/sdk/verify/sample_code/build/compile.mk:114: recipe for target '/home/tp/Project/AOV-课题/软件sdk/Iford_IMD00V5.1.1/Iford_IMD00V5.1.1/SourceCode/sdk/verify/sample_code/libraries/amigos_ext/modules/amigos_module_rtsp.user.x86.o' failed make[12]: *** [/home/tp/Project/AOV-课题/软件sdk/Iford_IMD00V5.1.1/Iford_IMD00V5.1.1/SourceCode/sdk/verify/sample_code/libraries/amigos_ext/modules/amigos_module_rtsp.user.x86.o] Error 1 /home/tp/Project/AOV-课题/软件sdk/Iford_IMD00V5.1.1/Iford_IMD00V5.1.1/SourceCode/sdk/verify/sample_code/build/compile.mk:114: recipe for target '/home/tp/Project/AOV-课题/软件sdk/Iford_IMD00V5.1.1/Iford_IMD00V5.1.1/SourceCode/sdk/verify/sample_code/libraries/amigos_ext/modules/amigos_module_env_monitor.user.x86.o' failed make[12]: *** [/home/tp/Project/AOV-课题/软件sdk/Iford_IMD00V5.1.1/Iford_IMD00V5.1.1/SourceCode/sdk/verify/sample_code/libraries/amigos_ext/modules/amigos_module_env_monitor.user.x86.o] Error 1 /home/tp/Project/AOV-课题/软件sdk/Iford_IMD00V5.1.1/Iford_IMD00V5.1.1/SourceCode/sdk/verify/sample_code/build/compile.mk:114: recipe for target '/home/tp/Project/AOV-课题/软件sdk/Iford_IMD00V5.1.1/Iford_IMD00V5.1.1/SourceCode/sdk/verify/sample_code/libraries/amigos_ext/modules/amigos_module_sync.user.x86.o' failed make[12]: *** [/home/tp/Project/AOV-课题/软件sdk/Iford_IMD00V5.1.1/Iford_IMD00V5.1.1/SourceCode/sdk/verify/sample_code/libraries/amigos_ext/modules/amigos_module_sync.user.x86.o] Error 1 make[12]: Leaving directory '/home/tp/Project/AOV-课题/软件sdk/Iford_IMD00V5.1.1/Iford_IMD00V5.1.1/SourceCode/sdk/verify/sample_code' Makefile:182: recipe for target 'libraries/amigos_ext_obj_all' failed make[11]: *** [libraries/amigos_ext_obj_all] Error 2 make[11]: Leaving directory '/home/tp/Project/AOV-课题/软件sdk/Iford_IMD00V5.1.1/Iford_IMD00V5.1.1/SourceCode/sdk/verify/sample_code' Makefile:143: recipe for target 'depend_internal' failed make[10]: *** [depend_internal] Error 2 make[10]: Leaving directory '/home/tp/Project/AOV-课题/软件sdk/Iford_IMD00V5.1.1/Iford_IMD00V5.1.1/SourceCode/sdk/verify/sample_code' Makefile:99: recipe for target 'all' failed make[9]: *** [all] Error 2 make[9]: Leaving directory '/home/tp/Project/AOV-课题/软件sdk/Iford_IMD00V5.1.1/Iford_IMD00V5.1.1/SourceCode/sdk/verify/sample_code' Makefile:167: recipe for target 'applications/mixer/app_amigos/gen_code' failed make[8]: *** [applications/mixer/app_amigos/gen_code] Error 2 make[8]: Leaving directory '/home/tp/Project/AOV-课题/软件sdk/Iford_IMD00V5.1.1/Iford_IMD00V5.1.1/SourceCode/sdk/verify/sample_code' applications/mixer/app_amigos/gen_code/script.mk:41: recipe for target 'script_start' failed make[7]: *** [script_start] Error 2 make[7]: Leaving directory '/home/tp/Project/AOV-课题/软件sdk/Iford_IMD00V5.1.1/Iford_IMD00V5.1.1/SourceCode/sdk/verify/sample_code' Makefile:207: recipe for target 'applications/mixer/app_amigos/gen_code_script_start' failed make[6]: *** [applications/mixer/app_amigos/gen_code_script_start] Error 2 make[6]: Leaving directory '/home/tp/Project/AOV-课题/软件sdk/Iford_IMD00V5.1.1/Iford_IMD00V5.1.1/SourceCode/sdk/verify/sample_code' Makefile:99: recipe for target 'all' failed make[5]: *** [all] Error 2 make[5]: Leaving directory '/home/tp/Project/AOV-课题/软件sdk/Iford_IMD00V5.1.1/Iford_IMD00V5.1.1/SourceCode/sdk/verify/sample_code' makefile:46: recipe for target 'all' failed make[4]: *** [all] Error 2 make[4]: Leaving directory '/home/tp/Project/AOV-课题/软件sdk/Iford_IMD00V5.1.1/Iford_IMD00V5.1.1/SourceCode/sdk/verify' ../sdk/sdk.mk:81: recipe for target 'verify' failed make[3]: *** [verify] Error 2 make[3]: Leaving directory '/home/tp/Project/AOV-课题/软件sdk/Iford_IMD00V5.1.1/Iford_IMD00V5.1.1/SourceCode/project' ../sdk/sdk.mk:49: recipe for target 'sdk' failed make[2]: *** [sdk] Error 2 make[2]: Leaving directory '/home/tp/Project/AOV-课题/软件sdk/Iford_IMD00V5.1.1/Iford_IMD00V5.1.1/SourceCode/project' makefile:279: recipe for target 'release' failed make[1]: *** [release] Error 2 make[1]: Leaving directory '/home/tp/Project/AOV-课题/软件sdk/Iford_IMD00V5.1.1/Iford_IMD00V5.1.1/SourceCode/project' makefile:68: recipe for target 'image' failed make: *** [image] Error 2 问题在哪
09-16
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值