質問編集履歴
1
エラー全部貼り
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,6 +1,28 @@
|
|
1
1
|
見よう見まねでスタック構造からデータをput&getするプログラムを作成致しました。
|
2
2
|
|
3
3
|
しかしながら、データを格納する箇所で以下のエラーが発生します。
|
4
|
+
|
5
|
+
```error
|
6
|
+
|
7
|
+
stack.c: In function ‘put’:
|
8
|
+
|
9
|
+
stack.c:8:9: warning: implicit declaration of function ‘strcpy’ [-Wimplicit-function-declaration]
|
10
|
+
|
11
|
+
8 | strcpy(stack[stack_ptr], putdata);
|
12
|
+
|
13
|
+
| ^~~~~~
|
14
|
+
|
15
|
+
stack.c:8:9: warning: incompatible implicit declaration of built-in function ‘strcpy’
|
16
|
+
|
17
|
+
stack.c:3:1: note: include ‘<string.h>’ or provide a declaration of ‘strcpy’
|
18
|
+
|
19
|
+
2 | #include "./stack.h"
|
20
|
+
|
21
|
+
+++ |+#include <string.h>
|
22
|
+
|
23
|
+
3 |
|
24
|
+
|
25
|
+
stack.c:8:21: warning: passing argument 1 of ‘strcpy’ makes pointer from integer without a cast [-Wint-conversion]
|
4
26
|
|
5
27
|
8 | strcpy(stack[stack_ptr], putdata);
|
6
28
|
|
@@ -9,6 +31,14 @@
|
|
9
31
|
| |
|
10
32
|
|
11
33
|
| char
|
34
|
+
|
35
|
+
stack.c:8:21: note: expected ‘char *’ but argument is of type ‘char’
|
36
|
+
|
37
|
+
/usr/bin/ld: /tmp/ccySka8x.o:(.data+0x0): multiple definition of `stack_ptr'; /tmp/cce9NB2v.o:(.data+0x0): first defined here
|
38
|
+
|
39
|
+
collect2: error: ld returned 1 exit status
|
40
|
+
|
41
|
+
```
|
12
42
|
|
13
43
|
|
14
44
|
|