Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

debian编译不了 #3

Open
Saturday-morning opened this issue Dec 10, 2022 · 5 comments
Open

debian编译不了 #3

Saturday-morning opened this issue Dec 10, 2022 · 5 comments

Comments

@Saturday-morning
Copy link

Saturday-morning commented Dec 10, 2022

我是Debian11,这是 执行 make 的时候的报错:

In file included from /home/suerya/工程/Sayuri/src/pattern/gammas_dict.cc:1:
/home/suerya/工程/Sayuri/src/pattern/pattern.h:14:13: error: uint64_t’ in namespace ‘std’ does not name a type
   14 | extern std::uint64_t PatternHash[8][4][kMaxPatternArea];
      |             ^~~~~~~~
In file included from /home/suerya/工程/Sayuri/src/pattern/gammas_dict.cc:2:
/home/suerya/工程/Sayuri/src/pattern/gammas_dict.h:9:26: error: std::string’ has not been declared
    9 |     void Initialize(std::string filename);
      |                          ^~~~~~
/home/suerya/工程/Sayuri/src/pattern/gammas_dict.h:11:28: error: std::uint64_t’ has not been declared
   11 |     bool ProbePattern(std::uint64_t hash, float &val) const;
      |                            ^~~~~~~~
/home/suerya/工程/Sayuri/src/pattern/gammas_dict.h:12:28: error: std::uint64_t’ has not been declared
   12 |     bool ProbeFeature(std::uint64_t hash, float &val) const;
      |                            ^~~~~~~~
/home/suerya/工程/Sayuri/src/pattern/gammas_dict.h:15:29: error: std::uint64_t’ has not been declared
   15 |     bool InsertPattern(std::uint64_t hash, float val);
      |                             ^~~~~~~~
/home/suerya/工程/Sayuri/src/pattern/gammas_dict.h:16:29: error: std::uint64_t’ has not been declared
   16 |     bool InsertFeature(std::uint64_t hash, float val);
      |                             ^~~~~~~~
/home/suerya/工程/Sayuri/src/pattern/gammas_dict.h:18:29: error: uint64_t’ is not a member of ‘std’
   18 |     std::unordered_map<std::uint64_t, float> pattern_dict_;
      |                             ^~~~~~~~
/home/suerya/工程/Sayuri/src/pattern/gammas_dict.h:18:29: error: uint64_t’ is not a member of ‘std/home/suerya/工程/Sayuri/src/pattern/gammas_dict.h:18:44: error: template argument 1 is invalid
   18 |     std::unordered_map<std::uint64_t, float> pattern_dict_;
      |                                            ^
/home/suerya/工程/Sayuri/src/pattern/gammas_dict.h:18:44: error: template argument 3 is invalid
/home/suerya/工程/Sayuri/src/pattern/gammas_dict.h:18:44: error: template argument 4 is invalid
/home/suerya/工程/Sayuri/src/pattern/gammas_dict.h:18:44: error: template argument 5 is invalid
/home/suerya/工程/Sayuri/src/pattern/gammas_dict.h:19:29: error: uint64_t’ is not a member of ‘std’
   19 |     std::unordered_map<std::uint64_t, float> feature_dict_;
      |                             ^~~~~~~~
/home/suerya/工程/Sayuri/src/pattern/gammas_dict.h:19:29: error: uint64_t’ is not a member of ‘std/home/suerya/工程/Sayuri/src/pattern/gammas_dict.h:19:44: error: template argument 1 is invalid
   19 |     std::unordered_map<std::uint64_t, float> feature_dict_;
      |                                            ^
/home/suerya/工程/Sayuri/src/pattern/gammas_dict.h:19:44: error: template argument 3 is invalid
/home/suerya/工程/Sayuri/src/pattern/gammas_dict.h:19:44: error: template argument 4 is invalid
/home/suerya/工程/Sayuri/src/pattern/gammas_dict.h:19:44: error: template argument 5 is invalid
/home/suerya/工程/Sayuri/src/pattern/gammas_dict.cc:15:6: error: no declaration matches ‘void GammasDict::Initialize(std::string)’
   15 | void GammasDict::Initialize(std::string filename) {
      |      ^~~~~~~~~~
In file included from /home/suerya/工程/Sayuri/src/pattern/gammas_dict.cc:2:
/home/suerya/工程/Sayuri/src/pattern/gammas_dict.h:9:10: note: candidate is: ‘void GammasDict::Initialize(int)’
    9 |     void Initialize(std::string filename);
      |          ^~~~~~~~~~
/home/suerya/工程/Sayuri/src/pattern/gammas_dict.h:5:7: note: class GammasDict’ defined here
    5 | class GammasDict {
      |       ^~~~~~~~~~
/home/suerya/工程/Sayuri/src/pattern/gammas_dict.cc:73:6: error: no declaration matches ‘bool GammasDict::ProbePattern(uint64_t, float&) const’
   73 | bool GammasDict::ProbePattern(std::uint64_t hash, float &val) const {
      |      ^~~~~~~~~~
In file included from /home/suerya/工程/Sayuri/src/pattern/gammas_dict.cc:2:
/home/suerya/工程/Sayuri/src/pattern/gammas_dict.h:11:10: note: candidate is: ‘bool GammasDict::ProbePattern(int, float&) const’
   11 |     bool ProbePattern(std::uint64_t hash, float &val) const;
      |          ^~~~~~~~~~~~
/home/suerya/工程/Sayuri/src/pattern/gammas_dict.h:5:7: note: class GammasDict’ defined here
    5 | class GammasDict {
      |       ^~~~~~~~~~
/home/suerya/工程/Sayuri/src/pattern/gammas_dict.cc:82:6: error: no declaration matches ‘bool GammasDict::ProbeFeature(uint64_t, float&) const’
   82 | bool GammasDict::ProbeFeature(std::uint64_t hash, float &val) const {
      |      ^~~~~~~~~~
In file included from /home/suerya/工程/Sayuri/src/pattern/gammas_dict.cc:2:
/home/suerya/工程/Sayuri/src/pattern/gammas_dict.h:12:10: note: candidate is: ‘bool GammasDict::ProbeFeature(int, float&) const’
   12 |     bool ProbeFeature(std::uint64_t hash, float &val) const;
      |          ^~~~~~~~~~~~
/home/suerya/工程/Sayuri/src/pattern/gammas_dict.h:5:7: note: class GammasDict’ defined here
    5 | class GammasDict {
      |       ^~~~~~~~~~
/home/suerya/工程/Sayuri/src/pattern/gammas_dict.cc:91:6: error: no declaration matches ‘bool GammasDict::InsertPattern(uint64_t, float)’
   91 | bool GammasDict::InsertPattern(std::uint64_t hash, float val) {
      |      ^~~~~~~~~~
In file included from /home/suerya/工程/Sayuri/src/pattern/gammas_dict.cc:2:
/home/suerya/工程/Sayuri/src/pattern/gammas_dict.h:15:10: note: candidate is: ‘bool GammasDict::InsertPattern(int, float)’
   15 |     bool InsertPattern(std::uint64_t hash, float val);
      |          ^~~~~~~~~~~~~
/home/suerya/工程/Sayuri/src/pattern/gammas_dict.h:5:7: note: class GammasDict’ defined here
    5 | class GammasDict {
      |       ^~~~~~~~~~
/home/suerya/工程/Sayuri/src/pattern/gammas_dict.cc:100:6: error: no declaration matches ‘bool GammasDict::InsertFeature(uint64_t, float)’
  100 | bool GammasDict::InsertFeature(std::uint64_t hash, float val) {
      |      ^~~~~~~~~~
In file included from /home/suerya/工程/Sayuri/src/pattern/gammas_dict.cc:2:
/home/suerya/工程/Sayuri/src/pattern/gammas_dict.h:16:10: note: candidate is: ‘bool GammasDict::InsertFeature(int, float)’
   16 |     bool InsertFeature(std::uint64_t hash, float val);
      |          ^~~~~~~~~~~~~
/home/suerya/工程/Sayuri/src/pattern/gammas_dict.h:5:7: note: class GammasDict’ defined here
    5 | class GammasDict {

是这个系统不满足什么需求吗?debian和ubuntu之间的什么差距才会导致这个问题发生呢?

@Saturday-morning Saturday-morning changed the title 编译不了 debian编译不了 Dec 10, 2022
@CGLemon
Copy link
Owner

CGLemon commented Dec 10, 2022

不好意思,這是我的問題,由於少了一些 header file ,導致不同版本的 gcc 可能編譯不過。請在 src/pattern/gammas_dict.h 檔案中加入以下的 header file

#pragma once

#include <unordered_map>
#include <string>  // 加入的 header file
#include <cstdint> // 加入的 header file

class GammasDict {
    ......
};

如果成功編譯或是有其它問題的話,請通知我,謝謝!

@Saturday-morning
Copy link
Author

非常感谢你的答复!
现在变成了这样:

In file included from /home/suerya/工程/Sayuri/src/pattern/gammas_dict.cc:1:
/home/suerya/工程/Sayuri/src/pattern/pattern.h:14:13: error: uint64_t’ in namespace ‘std’ does not name a type
   14 | extern std::uint64_t PatternHash[8][4][kMaxPatternArea];
      |             ^~~~~~~~
/home/suerya/工程/Sayuri/src/pattern/gammas_dict.cc: In member function ‘void GammasDict::Initialize(std::string)’:
/home/suerya/工程/Sayuri/src/pattern/gammas_dict.cc:59:38: error: PatternHash’ was not declared in this scope
   59 |                 std::uint64_t hash = PatternHash[0][kInvalid][0];
      |                                      ^~~~~~~~~~~
make[2]: *** [CMakeFiles/Sayuri.dir/build.make:290:CMakeFiles/Sayuri.dir/src/pattern/gammas_dict.cc.o] 错误 1
make[1]: *** [CMakeFiles/Makefile2:95:CMakeFiles/Sayuri.dir/all] 错误 2
make: *** [Makefile:103:all] 错误 2

@CGLemon
Copy link
Owner

CGLemon commented Dec 10, 2022

請在 src/pattern/pattern.h 檔案中加入以下的 header file

#pragma once

#include <array>
#include <cstdint> // 加入的 header file

void PatternHashAndCoordsInit();
int CharToColor(char s);

static constexpr int kMaxPatternDist = 10;
static constexpr int kMaxPatternArea = kMaxPatternDist * kMaxPatternDist;

struct PtCoord { int x, y; };
extern std::array<PtCoord, kMaxPatternArea> kPointCoords;
extern std::array<int, kMaxPatternDist + 2> kPointIndex;
extern std::uint64_t PatternHash[8][4][kMaxPatternArea];

@Saturday-morning
Copy link
Author

编译成功了!!congratulation!

@CGLemon
Copy link
Owner

CGLemon commented Dec 10, 2022

感謝你的幫助!晚點我會推送修正過的版本

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants