質問編集履歴
5
誤字を修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#質問内容
|
2
|
-
文章をコピー出来なかったので画像ですいません。以下の画像ですがなぜ「malloc.c : 2329: sysmalloc: Assertion」
|
2
|
+
文章をコピー出来なかったので画像ですいません。以下の画像ですがなぜ「malloc.c : 2329: sysmalloc: Assertion」エラーが発生するのでしょうか? 提示コードですがEntryクラスのコンストラクタのChangeScene()関数でstd::make_unique<Edit>();コードで発生しているのですがそのEditクラスは問題ありませんでした。つまりstd::make_unique<Edit>();が原因なのですがなぜエラーが出るのでしょうか?
|
3
3
|
※C++ 14を使っています。
|
4
4
|
```
|
5
5
|
std::make_unique<Edit>();
|
4
文章を修正しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
#質問内容
|
2
|
-
文章をコピー出来なかったので画像ですいません。以下の画像ですがなぜ「malloc.c : 2329: sysmalloc: Assertion」リンクエラーが発生するのでしょうか? 提示コードですがEntryクラスのコンストラクタのChangeScene()関数でstd::
|
2
|
+
文章をコピー出来なかったので画像ですいません。以下の画像ですがなぜ「malloc.c : 2329: sysmalloc: Assertion」リンクエラーが発生するのでしょうか? 提示コードですがEntryクラスのコンストラクタのChangeScene()関数でstd::make_unique<Edit>();コードで発生しているのですがそのEditクラスは問題ありませんでした。つまりstd::make_unique<Edit>();が原因なのですがなぜリンクエラーが出るのでしょうか?
|
3
3
|
※C++ 14を使っています。
|
4
4
|
```
|
5
|
-
std::
|
5
|
+
std::make_unique<Edit>();
|
6
6
|
```
|
7
7
|
|
8
8
|
|
3
文書を追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -313,4 +313,34 @@
|
|
313
313
|
}
|
314
314
|
|
315
315
|
|
316
|
+
```
|
317
|
+
|
318
|
+
```
|
319
|
+
#ifndef __ENTRY_HPP_
|
320
|
+
#define __ENTRY_HPP_
|
321
|
+
|
322
|
+
|
323
|
+
#include <iostream>
|
324
|
+
#include "Scene.hpp"
|
325
|
+
#include <memory>
|
326
|
+
|
327
|
+
class Edit;
|
328
|
+
class Entry : public Scene
|
329
|
+
{
|
330
|
+
public:
|
331
|
+
Entry(); //コンストラクタ
|
332
|
+
~Entry(); //デストラクタ
|
333
|
+
|
334
|
+
void Update(); //計算
|
335
|
+
void Renderer()const; //描画
|
336
|
+
void ChangeScene(); //シーン推移
|
337
|
+
private:
|
338
|
+
|
339
|
+
std::unique_ptr<Edit> edit;
|
340
|
+
|
341
|
+
Scene::SceneType nowScene; //現在のシーン
|
342
|
+
|
343
|
+
|
344
|
+
};
|
345
|
+
#endif
|
316
346
|
```
|
2
文章を修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#質問内容
|
2
|
-
文章をコピー出来なかったので画像ですいません。以下の画像ですがなぜ「malloc.c : 2329: sysmalloc: Assertion」
|
2
|
+
文章をコピー出来なかったので画像ですいません。以下の画像ですがなぜ「malloc.c : 2329: sysmalloc: Assertion」リンクエラーが発生するのでしょうか? 提示コードですがEntryクラスのコンストラクタのChangeScene()関数でstd::make_quniue<Edit>();コードで発生しているのですがそのEditクラスは問題ありませんでした。つまりstd::make_quniue<Edit>();が原因なのですがなぜリンクエラーが出るのでしょうか?
|
3
3
|
※C++ 14を使っています。
|
4
4
|
```
|
5
5
|
std::make_quniue<Edit>();
|
@@ -208,4 +208,109 @@
|
|
208
208
|
clean:
|
209
209
|
rm -f ./obj/*.o *.out ./obj/*.d *.a $(PRG)
|
210
210
|
|
211
|
+
```
|
212
|
+
|
213
|
+
|
214
|
+
```
|
215
|
+
#include <stdlib.h>
|
216
|
+
#include <iostream>
|
217
|
+
//#include <memory>
|
218
|
+
|
219
|
+
#include "../header/Edit.hpp"
|
220
|
+
#include "../lib/ncurses/include/curses.h"
|
221
|
+
|
222
|
+
// ######################## コンストラクタ ########################
|
223
|
+
Edit::Edit() : Scene()
|
224
|
+
{
|
225
|
+
|
226
|
+
mousePosition.x = 0;
|
227
|
+
mousePosition.y = 0;
|
228
|
+
|
229
|
+
int t = 1;
|
230
|
+
for(int i = 0; i < 8; i++)
|
231
|
+
{
|
232
|
+
for(int j = 0; j<8; j++)
|
233
|
+
{
|
234
|
+
init_pair(t, i, j);
|
235
|
+
t++;
|
236
|
+
}
|
237
|
+
}
|
238
|
+
|
239
|
+
|
240
|
+
// screen = std::make_unique<Screen>(); //前景
|
241
|
+
|
242
|
+
|
243
|
+
|
244
|
+
//changeScene = Scene::SceneType::Edit; //現在のシーン
|
245
|
+
}
|
246
|
+
|
247
|
+
// ######################## Keyboard Input ########################
|
248
|
+
void Edit::KeyInput()
|
249
|
+
{
|
250
|
+
|
251
|
+
int key = getch();
|
252
|
+
|
253
|
+
//ESCで終了
|
254
|
+
if(key == 27)
|
255
|
+
{
|
256
|
+
// changeScene = Scene::SceneType::Exit;
|
257
|
+
}
|
258
|
+
}
|
259
|
+
|
260
|
+
// ######################## Update ########################
|
261
|
+
void Edit::Update()
|
262
|
+
{
|
263
|
+
MouseInput();
|
264
|
+
KeyInput();
|
265
|
+
}
|
266
|
+
|
267
|
+
// ######################## Renderer ########################
|
268
|
+
void Edit::Renderer()const
|
269
|
+
{
|
270
|
+
|
271
|
+
}
|
272
|
+
|
273
|
+
|
274
|
+
// ######################## Mouse Input ########################
|
275
|
+
void Edit::MouseInput()
|
276
|
+
{
|
277
|
+
|
278
|
+
//マウスイベント
|
279
|
+
if(getmouse(&event) == OK)
|
280
|
+
{
|
281
|
+
//マウス座標
|
282
|
+
if(event.bstate & REPORT_MOUSE_POSITION)
|
283
|
+
{
|
284
|
+
mousePosition.x = event.x;
|
285
|
+
mousePosition.y = event.y;
|
286
|
+
}
|
287
|
+
|
288
|
+
//Left click
|
289
|
+
if(event.bstate & BUTTON1_PRESSED)
|
290
|
+
{
|
291
|
+
|
292
|
+
}
|
293
|
+
|
294
|
+
//Right click
|
295
|
+
if(event.bstate & BUTTON3_PRESSED)
|
296
|
+
{
|
297
|
+
|
298
|
+
}
|
299
|
+
}
|
300
|
+
erase();
|
301
|
+
move(mousePosition.y,mousePosition.x);
|
302
|
+
|
303
|
+
//screen->Renderer();
|
304
|
+
|
305
|
+
refresh();
|
306
|
+
}
|
307
|
+
|
308
|
+
|
309
|
+
//デストラクタ
|
310
|
+
Edit::~Edit()
|
311
|
+
{
|
312
|
+
|
313
|
+
}
|
314
|
+
|
315
|
+
|
211
316
|
```
|
1
文章を修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -6,6 +6,23 @@
|
|
6
6
|
```
|
7
7
|
|
8
8
|
|
9
|
+
```
|
10
|
+
$ make
|
11
|
+
g++ -c -MMD -MP source/Edit.cpp -o obj/Edit.o
|
12
|
+
In file included from /usr/include/c++/9/memory:80,
|
13
|
+
from source/../header/Edit.hpp:5,
|
14
|
+
from source/Edit.cpp:5:
|
15
|
+
/usr/include/c++/9/bits/unique_ptr.h: In instantiation of ‘void std::default_delete<_Tp>::operator()(_Tp*) const [with _Tp = Screen]’:
|
16
|
+
/usr/include/c++/9/bits/unique_ptr.h:292:17: required from ‘std::unique_ptr<_Tp, _Dp>::~unique_ptr() [with _Tp = Screen; _Dp = std::default_delete<Screen>]’
|
17
|
+
source/Edit.cpp:9:22: required from here
|
18
|
+
/usr/include/c++/9/bits/unique_ptr.h:79:16: error: invalid application of ‘sizeof’ to incomplete type ‘Screen’
|
19
|
+
79 | static_assert(sizeof(_Tp)>0,
|
20
|
+
| ^~~~~~~~~~~
|
21
|
+
make: *** [Makefile:11: obj/Edit.o] エラー 1
|
22
|
+
|
23
|
+
```
|
24
|
+
|
25
|
+
|
9
26
|

|
10
27
|
|
11
28
|
|