[英]error: member access into incomplete type 'WINDOW' (aka '_win_st')
我在訪問 _maxx 時遇到問題,它說:./ScoreBoard.hpp:20:38: 錯誤:成員訪問不完整類型“WINDOW”(又名“_win_st”) mvwprintw(score_win, 0, score_win->_maxx - 10, "% 11llu", 分數); ^ /L ...
[英]error: member access into incomplete type 'WINDOW' (aka '_win_st')
我在訪問 _maxx 時遇到問題,它說:./ScoreBoard.hpp:20:38: 錯誤:成員訪問不完整類型“WINDOW”(又名“_win_st”) mvwprintw(score_win, 0, score_win->_maxx - 10, "% 11llu", 分數); ^ /L ...
[英]Problems printing out a string
這是我的代碼: 當我嘗試打印此人的詳細信息時,它只會打印出空白代碼。 Output: 我不知道為什么它打印出空白而不是人的價值觀我試着輸入: puts(personDataBase.personList[ 0 ].id); 相反,它正在工作,但我想主要使用代碼。 ...
[英]de-referencing pointer using with &->
我有簡單的嵌套結構: 它打印 10,但是這里如何取消引用指針,ptr->obj 與 &->obj == *obj 相同嗎? ...
[英]What is the use of i in `printf("%d\n",(a->ptr)[i]);`?
嘿伙計們,我目前正在學習 DSA,在 ADT 中我有一個問題:這是一個創建自定義數組並獲取數組的輸入並存儲它並打印它的代碼,但我想問那是什么[i]在printf("%d\n",(a->ptr)[i]); 那是我在這段代碼中沒有得到的東西 ...
[英]Overloading ostream << operator for a class with private key member
我正在嘗試為class List重載 ostream << 運算符 據我所知(重載 ostream 函數)必須寫在 class 之外。 所以,我這樣做了: 但當然,這不起作用,因為成員Node head是private 。 在這種情況下,除了將Node *head變為public之外,還 ...
[英]Does multiple struct (Nested structure) exist in C?
我想知道是否有辦法在 C 中聲明多個結構。 例如,我做了這個: 我希望每個 TeamCup 有 4 支球隊。 但是當涉及到輸入過程時,在我的循環中,這里的變量是未定義的: ...
[英]error when using pointers, dynamically allocating ,struct
我的代碼不運行,我該如何修復它我想我不明白我在使用指針、動態分配、結構時出錯的地方 一元'*'的無效類型參數(有'int')C中的錯誤這是圖像在此處輸入圖像描述 ...
[英]Is there a consistent way to force errors on incorrect list or vector indexing
我對其他編程語言的期望是(1:4)[3:5]和list(asdf = 4, qwerty = 5)$asdg都應該引發異常。 相反,第一個默默地返回c(3, 4, NA) ,第二個默默地返回NULL (就像 or list(asdf = 4, qwerty = 5)[[asdg]] )。 雖然這種 ...
[英]Class private member wont change in function
我不知道為什么不保存私有變量結果。 我怎樣才能讓它工作。 然后我開始編譯它工作正常,私有結果正在改變,但隨后我重新打開 function,結果回到 0,我希望它成為最后一個結果。 示例:我輸入 4 我輸入 7 總和為 11 保存的結果為 11 然后我按 1 到 go 開始,結果再次為 0,但我希望 ...
[英]avoid member access for shared base state
假設我有一個作為抽象接口的基礎 class 和兩個派生類,它們從基礎 class 繼承某個 state。 我想更改我在運行時使用的派生 class,但我想保留共享的 state。 我的處理程序代碼,我有一個智能指針,它在運行時根據 class 類型更改行為,因此共享 state 構造函數。 我打算更 ...
[英]Const class object with a pointer member
讓我們有一個示例程序: 我知道為什么會出現錯誤 - 創建 const Example object 時, pointer實際上是 const 指針,而不是指向 const 的指針。 因此,當將&var分配給object.pointer時,這是不正確的,但將var分配給*object.poin ...
[英]error: request for member data in something not a structure or union despite using arrow operator
我面臨一個錯誤:請求成員數據不是結構或聯合。 我將結構global_vals中的結構receiver_data的地址傳遞給另一個文件中的 function。 init_func function 接收地址作為指針。 我使用了箭頭運算符,因為它是一個指針,但我似乎無法訪問該結構。 memory 地 ...
[英]C++ - friend operator cannot access private data members
我正在嘗試為 class 重載運算符:#include <iostream> using namespace std; class Complex{ float re, im; public: Complex(float x = 0, float y = 0) : re ...
[英]Accessing elements of a nested structures
當我執行以下代碼時,我收到此行的錯誤消息scanf("%s",A.(T+i)->CNE) 錯誤消息: expected identifier before '(' token| 我能知道是什么問題嗎? 提前致謝。 ...
[英]Accessing elements of std::vector<std::map<int, unsigned char>>grid gives error “Expression must have a class type”
我已經搜索了很遠,但找不到答案。 為什么我無法訪問元素? 它給了我錯誤:“表達式必須具有 class 類型”。 我不知道這是什么意思。 有人可以給我一個解決方案嗎? ...
[英]How do I access from template class A a struct declared as private field in template B class in c++?
有以下 c++ 原始代碼:template<typename T> class A { private: // here I want to access B::SomeStruct to create SomeStruct field in class A }; templa ...
[英]Why overloaded de-reference operator doesn't work the same way as the arrow operator?
再次閱讀 C++ 引物 5 ed。 由 lipmann 現在我已經閱讀了有關成員訪問運算符重載的信息。 一切對我來說都很清楚,除了: 我了解到的是箭頭運算符可以重載,並且必須是成員 function。 And if I see an expression like in main c->f ...
[英]Why can I call this static method using the class name but not using a class instance?
class Program { static void Main(string[] args) { var p = new Program(); p.Main(args);//instance reference error,use type name ...
[英]C/C++ macro parameter containing dot (member access operator)
如何在包含點(成員訪問運算符)的 C/C++ 宏參數中使用? 例子:#define M(obj,y) obj.y##x struct S { struct {int x;} c; int x; }; S s; s.c.x = 1; s.x = 2; M(s,) // works, 2 (res ...
[英]Some questions about functions with a class type
所以我正在使用 C++ 並嘗試使用類。 我正在嘗試創建一個具有類類型的函數。 這是代碼: 類的實例函數可以訪問它的成員函數和對象嗎? 另外,它應該返回什么? 我是否必須創建一個單獨的動作實例才能返回? 它可能與action move有關嗎?謝謝! ...