mongooseを使用して C++ プロジェクトをビルドしようとしましたが、リンカー エラーが発生し続けます。
同様の症状を説明する既存の SO 質問への回答を使用しようとしました:未定義の参照/未解決の外部シンボル エラーとは何ですか? どうすれば修正できますか? #include
外部 C リンケージを使用 したC ヘッダー:
//simple_web_server credited to Cesanta Software
#include "stdafx.h"
extern "C" {
#include "mongoose.h"
}
static const char *s_http_port = "8000";
static struct mg_serve_http_opts s_http_server_opts;
static void ev_handler(struct mg_connection *nc, int ev, void *p) {
if (ev == MG_EV_HTTP_REQUEST) {
mg_serve_http(nc, (struct http_message *) p, s_http_server_opts);
}
}
int main(void) {
struct mg_mgr mgr;
struct mg_connection *nc;
mg_mgr_init(&mgr, NULL); // <== this causes linker error
...
次のリンカ エラーが発生し続けます。
1>------ Build started: Project: simple_web_server02, Configuration: Debug Win32 ------
1> simple_web_server02.cpp
1>simple_web_server02.obj : error LNK2019: unresolved external symbol _mg_mgr_init referenced in function _main
の場所は、mongoose.h
指定されたプロパティ > VC++ > インクルード ディレクトリです。
「extern "C" {...}」を省略/含めても明らかな効果はないことにも注意してください。
どんな助けや提案も大歓迎です。