teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

エラー全部貼り

2021/06/30 02:02

投稿

pokemonta
pokemonta

スコア170

title CHANGED
File without changes
body CHANGED
@@ -1,9 +1,24 @@
1
1
  見よう見まねでスタック構造からデータをput&getするプログラムを作成致しました。
2
2
  しかしながら、データを格納する箇所で以下のエラーが発生します。
3
+ ```error
4
+ stack.c: In function ‘put’:
5
+ stack.c:8:9: warning: implicit declaration of function ‘strcpy’ [-Wimplicit-function-declaration]
3
6
  8 | strcpy(stack[stack_ptr], putdata);
7
+ | ^~~~~~
8
+ stack.c:8:9: warning: incompatible implicit declaration of built-in function ‘strcpy’
9
+ stack.c:3:1: note: include ‘<string.h>’ or provide a declaration of ‘strcpy’
10
+ 2 | #include "./stack.h"
11
+ +++ |+#include <string.h>
12
+ 3 |
13
+ stack.c:8:21: warning: passing argument 1 of ‘strcpy’ makes pointer from integer without a cast [-Wint-conversion]
14
+ 8 | strcpy(stack[stack_ptr], putdata);
4
15
  | ~~~~~^~~~~~~~~~~
5
16
  | |
6
17
  | char
18
+ stack.c:8:21: note: expected ‘char *’ but argument is of type ‘char’
19
+ /usr/bin/ld: /tmp/ccySka8x.o:(.data+0x0): multiple definition of `stack_ptr'; /tmp/cce9NB2v.o:(.data+0x0): first defined here
20
+ collect2: error: ld returned 1 exit status
21
+ ```
7
22
 
8
23
  解消方法をご教示願います。
9
24