Я пытаюсь скомпилировать включенный пример hello.c из Mongoose под Windows. Я использую командную строку Microsoft Visual и скопировал файлы mongoose.c и mongoose.h в тот же каталог, что и пример hello.c.
Когда я пишу "cl hello.c", я получаю следующий вывод/ошибку:
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
hello.c
Microsoft (R) Incremental Linker Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.
/out:hello.exe
hello.obj
hello.obj : error LNK2019: unresolved external symbol _mg_stop referenced in function _main
hello.obj : error LNK2019: unresolved external symbol _mg_start referenced in function _main
hello.obj : error LNK2019: unresolved external symbol _mg_printf referenced in function _begin_request_handler
hello.obj : error LNK2019: unresolved external symbol _snprintf referenced in function _begin_request_handler
hello.obj : error LNK2019: unresolved external symbol _mg_get_request_info referenced in function _begin_request_handler
hello.exe : fatal error LNK1120: 5 unresolved externals
В примеры включен Makefile, и я пытался использовать Makefile для сборки, но не понимаю, как это сделать. Если я попробую "nmake hello.exe". Я получаю следующий вывод/ошибку:
Microsoft (R) Program Maintenance Utility Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.
cl -W -Wall -I.. -pthread -g hello.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
cl : Command line error D8004 : '/W' requires an argument
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\cl.EXE"' : return code '0x2'
Stop.
EDIT Я также пытался скомпилировать, как указано в руководство пользователя, которое в Windows должно переводиться как «cl hello.c mongoose.c -o hello.exe», но затем я получаю следующее сообщение об ошибке:
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
cl : Command line warning D9035 : option 'o' has been deprecated and will be removed in a future release
hello.c
mongoose.c
Generating Code...
Microsoft (R) Incremental Linker Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.
/out:hello.exe
/out:hello.exe
hello.obj
mongoose.obj
hello.obj : error LNK2019: unresolved external symbol _snprintf referenced in function _begin_request_handler
hello.exe : fatal error LNK1120: 1 unresolved externals
Есть ли у кого-нибудь предложения о том, какие шаги необходимо предпринять, чтобы скомпилировать пример hello.c для Mongoose под Windows?
-W -Wall -I.. -pthread -g
выглядят как аргументы для gcc (за исключением того, что там, вероятно, должно быть '-lpthread'), иcl
, похоже, согласен, глядя на сообщение об ошибке. - person hyde   schedule 20.03.2013