提示コードですが///
コメント部内部ですがstd::vector<PullDown_Item> itemList;
変数ですがその構造体の中でその構造体変数を定義したいのですが以下のエラーが出てしまいます。これはそもそも不可能なのでしょうか?
日本語訳「Google 翻訳」
src/../lib/src/PullDown.hpp:23:21: エラー: 'PullDown_Item' はこのスコープで宣言されていません 23 | std::vector<PullDown_Item> itemList; //アイテムリスト | ^~~~~~~~~~~~~ src/../lib/src/PullDown.hpp:23:34: エラー: テンプレート引数 1 が無効です 23 | std::vector<PullDown_Item> itemList; //アイテムリスト | ^ src/../lib/src/PullDown.hpp:23:34: エラー: テンプレート引数 2 が無効です make: *** [Makefile:25: obj/Main.o] エラー 1 shigurechan@shigurechan-System-Product-Name:~/Program/ScriptEditor$
Error 「原文」
shigurechan@shigurechan-System-Product-Name:~/Program/ScriptEditor$ make g++ -c -MMD -MP src/Main.cpp -o obj/Main.o In file included from src/../lib/src/Help.hpp:6, from src/../lib/src/Console.hpp:8, from src/Screen.hpp:6, from src/Main.cpp:2: src/../lib/src/PullDown.hpp:23:21: error: ‘PullDown_Item’ was not declared in this scope 23 | std::vector<PullDown_Item> itemList; //アイテムリスト | ^~~~~~~~~~~~~ src/../lib/src/PullDown.hpp:23:34: error: template argument 1 is invalid 23 | std::vector<PullDown_Item> itemList; //アイテムリスト | ^ src/../lib/src/PullDown.hpp:23:34: error: template argument 2 is invalid make: *** [Makefile:25: obj/Main.o] エラー 1 shigurechan@shigurechan-System-Product-Name:~/Program/ScriptEditor$
Source Code
cpp
1#ifndef ___PULLDOWN_HPP___ 2#define ___PULLDOWN_HPP___ 3#include "Data.hpp" 4#include <ncurses.h> 5#include <glm/glm.hpp> 6#include <vector> 7 8/*##################################################### 9# リストウインドウ 10#######################################################*/ 11namespace Console 12{ 13 14 /*##################################################### 15 # プルダウン アイテム 16 #######################################################*/ 17 typedef struct 18 { 19 std::string title; //タイトル 20 Console::ColorPair dispColor; //表示色 21 Console::ColorPair selectColor; //選択色 22 RenderType renderType; //レンダータイプ 23//////////////////////////////////////////////////////////////////////////// 24 std::vector<PullDown_Item> itemList; //アイテムリスト 25//////////////////////////////////////////////////////////////////////////// 26 }PullDown_Item; 27 28 class PullDown 29 { 30 public: 31 32 PullDown(); //コンストラクタ 33 ~PullDown(); //デストラクタ 34 35 void Render(WINDOW *win,glm::ivec2 pos); //描画 36 37 void Update(); //更新 38 void KeyInput(); //キー入力 39 40 void SetCursorDown(); //カーソル 下げる 41 void SetCursorUp(); //カーソル 上げる 42 43 void Show_Turn(); //下から上に表示 44 void Show(); //上から下に表示 45 void Close(); //閉じる 46 47 void SetSelectColor(ColorCode fg,ColorCode bg); //選択色 設定 48 49 bool getIsShow(); //閉じているかどうか? 50 bool getIsExit(); //終了しているかどうか? 51 52 std::vector<PullDown_Item> itemList; 53 private: 54 55 56 bool isTurnRender = false; 57 bool isExit = false; 58 bool isShow = false; 59 60 Console::ColorPair selectColor; 61 62 glm::ivec2 cursorPosition; 63 64 }; 65} 66#endif 67

回答1件
あなたの回答
tips
プレビュー
下記のような回答は推奨されていません。
このような回答には修正を依頼しましょう。
また依頼した内容が修正された場合は、修正依頼を取り消すようにしましょう。