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

質問編集履歴

3

問題解決に必要なコードの追加

2021/11/24 14:26

投稿

marchan
marchan

スコア4

title CHANGED
File without changes
body CHANGED
@@ -58,6 +58,71 @@
58
58
  return 0;
59
59
  }
60
60
  ```
61
+
62
+ launch.json
63
+ ```
64
+ {
65
+ // IntelliSense を使用して利用可能な属性を学べます。
66
+ // 既存の属性の説明をホバーして表示します。
67
+ // 詳細情報は次を確認してください: https://go.microsoft.com/fwlink/?linkid=830387
68
+ "version": "0.2.0",
69
+ "configurations": [
70
+ {
71
+ "name": "gcc.exe - アクティブ ファイルのビルドとデバッグ",
72
+ "type": "cppdbg",
73
+ //"type": "gdb",
74
+ "request": "launch",
75
+ "program": "${fileDirname}\${fileBasenameNoExtension}.exe",
76
+ "args": [],
77
+ "stopAtEntry": false,
78
+ "cwd": "${fileDirname}",
79
+ "environment": [],
80
+ "externalConsole": false,
81
+ "MIMode": "gdb",
82
+ "miDebuggerPath": "C:\Strawberry\c\bin\gdb.exe",
83
+ "setupCommands": [
84
+ {
85
+ "description": "gdb の再フォーマットを有効にする",
86
+ "text": "-enable-pretty-printing",
87
+ "ignoreFailures": true
88
+ }
89
+ ],
90
+ "preLaunchTask": "C/C++: gcc.exe アクティブなファイルのビルド"
91
+ }
92
+ ]
93
+ }
94
+ ```
95
+ tasks.json
96
+ ```
97
+ {
98
+ "tasks": [
99
+ {
100
+ "type": "cppbuild",
101
+ "label": "C/C++: gcc.exe アクティブなファイルのビルド",
102
+ "command": "C:\Strawberry\c\bin\gcc.exe",
103
+ "args": [
104
+ "-fdiagnostics-color=always",
105
+ "-g",
106
+ "${file}",
107
+ "-o",
108
+ "${fileDirname}\${fileBasenameNoExtension}.exe"
109
+ ],
110
+ "options": {
111
+ "cwd": "${fileDirname}"
112
+ },
113
+ "problemMatcher": [
114
+ "$gcc"
115
+ ],
116
+ "group": {
117
+ "kind": "build",
118
+ "isDefault": true
119
+ },
120
+ "detail": "デバッガーによって生成されたタスク。"
121
+ }
122
+ ],
123
+ "version": "2.0.0"
124
+ }
125
+ ```
61
126
  ### 試したこと
62
127
  Windows Power Shellによる(VScodeの機能を介さない)コンパイル
63
128
  ```

2

試したことにVScodeでRunしたときに出てくるエラーメッセージを追加

2021/11/24 14:26

投稿

marchan
marchan

スコア4

title CHANGED
File without changes
body CHANGED
@@ -71,4 +71,13 @@
71
71
  { 3, 1 },
72
72
  { 4, 5 }
73
73
  }
74
+ ```
75
+ VScodeでRunしたときに出てくるエラーメッセージ
76
+ ```
77
+ (.text+0x65): undefined reference to `put_hyo'
78
+ collect2.exe: error: ld returned 1 exit status
79
+
80
+ [Done] exited with code=1 in 1.435 seconds
81
+
82
+
74
83
  ```

1

実行結果の追加

2021/11/24 13:36

投稿

marchan
marchan

スコア4

title CHANGED
File without changes
body CHANGED
@@ -57,4 +57,18 @@
57
57
  put_hyo(5,2,(int*)h);
58
58
  return 0;
59
59
  }
60
+ ```
61
+ ### 試したこと
62
+ Windows Power Shellによる(VScodeの機能を介さない)コンパイル
63
+ ```
64
+ > gcc hoge_main.c hoge03.c -c
65
+ > gcc hoge_main.o hoge03.o -o hogehoge
66
+ > .\hogehoge
67
+ {
68
+ { 0, 1 },
69
+ { 0, 1 },
70
+ { 2, 1 },
71
+ { 3, 1 },
72
+ { 4, 5 }
73
+ }
60
74
  ```