robotconscience / ofxLibwebsockets

[Deprecated] openFrameworks wrapper of libwebsockets for WebSocket client and server functionality
Other
171 stars 68 forks source link

Build issues w/ VS2010 #1

Closed gazoakley closed 11 years ago

gazoakley commented 11 years ago

Hi,

I'm having problems building any of the examples or any projects created from the Project Generator that use ofxLibwebsockets. I'm always getting the following error:

1>------ Build started: Project: openframeworksLib, Configuration: Debug Win32 ------
1>  openframeworksLib.vcxproj -> C:\Users\goakley\Downloads\of_v0072_vs2010_release\libs\openFrameworksCompiled\project\vs2010\..\..\lib\vs2010\openframeworksLibDebug.lib
2>------ Build started: Project: example-server-echo, Configuration: Debug Win32 ------
2>  Server.cpp
2>c:\program files (x86)\microsoft visual studio 10.0\vc\include\ctime(18): error C2039: 'clock_t' : is not a member of '`global namespace''
2>c:\program files (x86)\microsoft visual studio 10.0\vc\include\ctime(18): error C2873: 'clock_t' : symbol cannot be used in a using-declaration
2>c:\program files (x86)\microsoft visual studio 10.0\vc\include\ctime(19): error C2039: 'tm' : is not a member of '`global namespace''
2>c:\program files (x86)\microsoft visual studio 10.0\vc\include\ctime(19): error C2873: 'tm' : symbol cannot be used in a using-declaration
2>c:\program files (x86)\microsoft visual studio 10.0\vc\include\ctime(20): error C2039: 'asctime' : is not a member of '`global namespace''
2>c:\program files (x86)\microsoft visual studio 10.0\vc\include\ctime(20): error C2873: 'asctime' : symbol cannot be used in a using-declaration
2>c:\program files (x86)\microsoft visual studio 10.0\vc\include\ctime(20): error C2039: 'clock' : is not a member of '`global namespace''
2>c:\program files (x86)\microsoft visual studio 10.0\vc\include\ctime(20): error C2873: 'clock' : symbol cannot be used in a using-declaration
2>c:\program files (x86)\microsoft visual studio 10.0\vc\include\ctime(20): error C2039: 'ctime' : is not a member of '`global namespace''
2>c:\program files (x86)\microsoft visual studio 10.0\vc\include\ctime(20): error C2873: 'ctime' : symbol cannot be used in a using-declaration
2>c:\program files (x86)\microsoft visual studio 10.0\vc\include\ctime(21): error C2039: 'difftime' : is not a member of '`global namespace''
2>c:\program files (x86)\microsoft visual studio 10.0\vc\include\ctime(21): error C2873: 'difftime' : symbol cannot be used in a using-declaration
2>c:\program files (x86)\microsoft visual studio 10.0\vc\include\ctime(21): error C2039: 'gmtime' : is not a member of '`global namespace''
2>c:\program files (x86)\microsoft visual studio 10.0\vc\include\ctime(21): error C2873: 'gmtime' : symbol cannot be used in a using-declaration
2>c:\program files (x86)\microsoft visual studio 10.0\vc\include\ctime(21): error C2039: 'localtime' : is not a member of '`global namespace''
2>c:\program files (x86)\microsoft visual studio 10.0\vc\include\ctime(21): error C2873: 'localtime' : symbol cannot be used in a using-declaration
2>c:\program files (x86)\microsoft visual studio 10.0\vc\include\ctime(22): error C2039: 'mktime' : is not a member of '`global namespace''
2>c:\program files (x86)\microsoft visual studio 10.0\vc\include\ctime(22): error C2873: 'mktime' : symbol cannot be used in a using-declaration
2>c:\program files (x86)\microsoft visual studio 10.0\vc\include\ctime(22): error C2039: 'strftime' : is not a member of '`global namespace''
2>c:\program files (x86)\microsoft visual studio 10.0\vc\include\ctime(22): error C2873: 'strftime' : symbol cannot be used in a using-declaration
2>c:\program files (x86)\microsoft visual studio 10.0\vc\include\ctime(22): error C2039: 'time' : is not a member of '`global namespace''
2>c:\program files (x86)\microsoft visual studio 10.0\vc\include\ctime(22): error C2873: 'time' : symbol cannot be used in a using-declaration

openFrameworks itself builds without any errors


After further investigation, I found an empty time.h file in ofxLibwebsockets\libs\libwebsockets\include\win32port\win32helpers\sys. Deleting it and excluding it from the project seems to allow the .cpp files to build successfully, although there are then a bunch of linker errors:

1>------ Build started: Project: example-server-echo, Configuration: Debug Win32 ------
1>  testApp.cpp
1>  main.cpp
1>  Server.cpp
1>  Reactor.cpp
1>  Protocol.cpp
1>  Connection.cpp
1>  Client.cpp
1>c:\users\goakley\downloads\of_v0072_vs2010_release\libs\openframeworks\graphics\ofpixels.h(155): warning C4003: not enough actual parameters for macro 'max'
1>c:\users\goakley\downloads\of_v0072_vs2010_release\libs\openframeworks\graphics\ofpixels.h(156): warning C4003: not enough actual parameters for macro 'max'
1>  jsoncpp.cpp
1>  Generating Code...
1>c:\users\goakley\downloads\of_v0072_vs2010_release\addons\ofxlibwebsockets\libs\ofxlibwebsockets\include\ofxlibwebsockets\util.h(229): warning C4715: 'ofxLibwebsockets::getCallbackReason' : not all control paths return a value
1>c:\users\goakley\downloads\of_v0072_vs2010_release\addons\ofxlibwebsockets\libs\ofxlibwebsockets\include\ofxlibwebsockets\util.h(229): warning C4715: 'ofxLibwebsockets::getCallbackReason' : not all control paths return a value
1>  websock-w32.c
1>  gettimeofday.c
1>c:\users\goakley\downloads\of_v0072_vs2010_release\addons\ofxlibwebsockets\libs\libwebsockets\include\win32port\win32helpers\gettimeofday.c(43): warning C4996: '__timezone': This function or variable may be unsafe. Consider using _get_timezone instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>          c:\program files (x86)\microsoft visual studio 10.0\vc\include\time.h(139) : see declaration of '__timezone'
1>c:\users\goakley\downloads\of_v0072_vs2010_release\addons\ofxlibwebsockets\libs\libwebsockets\include\win32port\win32helpers\gettimeofday.c(44): warning C4996: '__daylight': This function or variable may be unsafe. Consider using _get_daylight instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>          c:\program files (x86)\microsoft visual studio 10.0\vc\include\time.h(131) : see declaration of '__daylight'
1>  getopt_long.c
1>  getopt.c
1>  Generating Code...
1>     Creating library bin\example-server-echo_debug.lib and object bin\example-server-echo_debug.exp
1>MSVCRTD.lib(cinitexe.obj) : warning LNK4098: defaultlib 'msvcrt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
1>Client.obj : error LNK2019: unresolved external symbol _libwebsocket_client_connect referenced in function "public: bool __thiscall ofxLibwebsockets::Client::connect(struct ofxLibwebsockets::ClientOptions)" (?connect@Client@ofxLibwebsockets@@QAE_NUClientOptions@2@@Z)
1>Client.obj : error LNK2019: unresolved external symbol _libwebsocket_create_context referenced in function "public: bool __thiscall ofxLibwebsockets::Client::connect(struct ofxLibwebsockets::ClientOptions)" (?connect@Client@ofxLibwebsockets@@QAE_NUClientOptions@2@@Z)
1>Server.obj : error LNK2001: unresolved external symbol _libwebsocket_create_context
1>Client.obj : error LNK2001: unresolved external symbol _libwebsocket_internal_extensions
1>Server.obj : error LNK2001: unresolved external symbol _libwebsocket_internal_extensions
1>Client.obj : error LNK2019: unresolved external symbol _libwebsockets_get_protocol referenced in function "int __cdecl ofxLibwebsockets::lws_client_callback(struct libwebsocket_context *,struct libwebsocket *,enum libwebsocket_callback_reasons,void *,void *,unsigned int)" (?lws_client_callback@ofxLibwebsockets@@YAHPAUlibwebsocket_context@@PAUlibwebsocket@@W4libwebsocket_callback_reasons@@PAX3I@Z)
1>Server.obj : error LNK2001: unresolved external symbol _libwebsockets_get_protocol
1>Client.obj : error LNK2019: unresolved external symbol _libwebsocket_context_destroy referenced in function "public: void __thiscall ofxLibwebsockets::Client::close(void)" (?close@Client@ofxLibwebsockets@@QAEXXZ)
1>Reactor.obj : error LNK2001: unresolved external symbol _libwebsocket_context_destroy
1>Client.obj : error LNK2019: unresolved external symbol _libwebsocket_close_and_free_session referenced in function "public: void __thiscall ofxLibwebsockets::Client::close(void)" (?close@Client@ofxLibwebsockets@@QAEXXZ)
1>Reactor.obj : error LNK2001: unresolved external symbol _libwebsocket_close_and_free_session
1>Client.obj : error LNK2019: unresolved external symbol _libwebsocket_service referenced in function "private: virtual void __thiscall ofxLibwebsockets::Client::threadedFunction(void)" (?threadedFunction@Client@ofxLibwebsockets@@EAEXXZ)
1>Server.obj : error LNK2001: unresolved external symbol _libwebsocket_service
1>Connection.obj : error LNK2019: unresolved external symbol _libwebsockets_get_peer_addresses referenced in function "public: void __thiscall ofxLibwebsockets::Connection::setupAddress(void)" (?setupAddress@Connection@ofxLibwebsockets@@QAEXXZ)
1>Reactor.obj : error LNK2001: unresolved external symbol _libwebsockets_get_peer_addresses
1>Connection.obj : error LNK2019: unresolved external symbol _libwebsocket_get_socket_fd referenced in function "public: void __thiscall ofxLibwebsockets::Connection::setupAddress(void)" (?setupAddress@Connection@ofxLibwebsockets@@QAEXXZ)
1>Connection.obj : error LNK2019: unresolved external symbol _libwebsocket_write referenced in function "public: void __thiscall ofxLibwebsockets::Connection::send(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?send@Connection@ofxLibwebsockets@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Connection.obj : error LNK2019: unresolved external symbol _lws_b64_encode_string referenced in function "public: void __thiscall ofxLibwebsockets::Connection::sendBinary(unsigned char *,unsigned int)" (?sendBinary@Connection@ofxLibwebsockets@@QAEXPAEI@Z)
1>Connection.obj : error LNK2019: unresolved external symbol _lws_b64_decode_string referenced in function "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const __thiscall ofxLibwebsockets::Connection::recv(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?recv@Connection@ofxLibwebsockets@@QAE?BV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV34@@Z)
1>Protocol.obj : error LNK2019: unresolved external symbol _libwebsockets_broadcast referenced in function "public: void __thiscall ofxLibwebsockets::Protocol::broadcast(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?broadcast@Protocol@ofxLibwebsockets@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>Reactor.obj : error LNK2019: unresolved external symbol _libwebsockets_serve_http_file referenced in function "public: unsigned int __thiscall ofxLibwebsockets::Reactor::_http(struct libwebsocket *,char const * const)" (?_http@Reactor@ofxLibwebsockets@@QAEIPAUlibwebsocket@@QBD@Z)
1>bin\example-server-echo_debug.exe : fatal error LNK1120: 14 unresolved externals
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========

Any ideas?

robotconscience commented 11 years ago

Can you check out the repo now and try again? Just merged in the dev branch, where I rebuilt the VS projects + the libwebsockets lib on windows. Should be good-to-go!

Let me know if you still have issues after using the new branch.

robotconscience commented 11 years ago

P.S. I moved away from the auto-gen projects in the end, as they don't do any of the library linking for you (why you are seeing the build errors).

gazoakley commented 11 years ago

Hi Brett - thanks for the quick reply! :+1:

I can't see any updates to the *.vcxproj files since the original commits in:

https://github.com/labatrockwell/ofxLibwebsockets/blob/dev/example-server-echo/example-server-echo.sln

Looking for the changes in dev here:

https://github.com/labatrockwell/ofxLibwebsockets/tree/dev/example-server-echo

Am I looking in the wrong place?

robotconscience commented 11 years ago

Shoot, you're right, I must not have committed the projects. Give me just a little bit, will push them up shortly. Sorry about that!

robotconscience commented 11 years ago

OK! pull now, should be fixed... I don't have my Windows machine with me, so I just fixed them in a text editor. Fingers crossed I caught the problems!

gazoakley commented 11 years ago

Hi Brett,

Looking much better now - thanks! :+1:

robotconscience commented 11 years ago

Great! Closing this issue for now, please re-open if you have more problems!