[問題] 我想要A.c 檔裏面包含 B.c 檔的函式
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
C
問題(Question):
A.c 檔案包含 B.c 檔的函式要怎樣寫?
錯誤結果(Wrong Output):
aram undefined -> compile error
程式碼(Code):(請善用置底文網頁, 記得排版)
A.c
--
#include "b.h"
int main (void) {
aram();
return;
}
--
b.h
--
#ifndef _B_H_
#define _B_H_
void aram (void);
#endif
--
b.c
--
void aram (void) {
prinf ("test");
return;
}
--
--
補充說明(Supplement):
程式碼另外打的,可能有漏請指正。目前對照結果跟我寫的差不多。
大概是這種感覺,就是寫了之後就compiler error 就說a 檔案沒有被定義aram這函式。
那請問要怎樣寫?
--
志願役普遍垃圾不代表每個志願役都是垃圾。
苗栗人智商普遍低落,不代表每個苗栗人智商都很低。
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 60.250.30.118
※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1449726562.A.384.html
→
12/10 14:16, , 1F
12/10 14:16, 1F
→
12/10 14:30, , 2F
12/10 14:30, 2F
→
12/10 14:34, , 3F
12/10 14:34, 3F
→
12/10 14:35, , 4F
12/10 14:35, 4F