0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

GCCでビルドするときにundefined referenceが出て困った

Posted at

Undefined reference が出た

出たな…とおもって、コード見直してみたり
作られたライブラリファイルみたり、
makefileの指示書き換えてみたけど解決しない

cppとcの混在のせいだった

cppからcの関数を参照しているとき、関数の宣言に

#ifdef __cplusplus
extern "C" {
#endif

//ここに関数の宣言

#ifdef __cplusplus
}
#endif

こんな感じでリンケージを指定して、「これはC言語の定義ですよ」と教えてあげないといけないようだ。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?