mongooseを使用してC++プロジェクトをビルドしようとしましたが、リンカーエラーが発生しています。Visual Studioでmongooseを使用してC++プロジェクトを構築する方法2015
私は既存のSO同様の症状を説明する質問に対する回答を使用しようとした:私は、次のリンカーエラーを取得維持
//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
外部Cリンケージを使用
What is an undefined reference/unresolved external symbol error and how do I fix it?
#include
によってCヘッダ
mongoose.h
の場所は、プロパティ> VC++>インクルードディレクトリで提供されます。
「extern」C「{...}」を省略/除外しても明らかな効果はありません。
ご迷惑をおかけして申し訳ございません。
適切なリンカーフラグを指定しましたか? – fuz
検索ディレクトリをリンカーに提供しましたか? –
明らかに、この問題は、未定義シンボルのdupよりもむしろ、マングースライブラリ(libの代わりにプロジェクトに追加するライブラリcコード)の特定の使用法に関連しています。 – Christophe