[ENet-discuss] Linker errors when NOT compiling as a lib (embedded) [with suggested fix]

fuzzy spoon fuzzyspoon at gmail.com
Wed Nov 24 16:08:41 PST 2010


Updating so it doesn't break debug builds.

#if(ENET_BUILDING_LIB != 1) && !defined(_DEBUG)
#include "enet/list.c"
#endif /* !ENET_BUILDING_LIB */

On Thu, Nov 25, 2010 at 1:30 AM, fuzzy spoon <fuzzyspoon at gmail.com> wrote:

> Nice, thanks for posting too.
>
> To continue on my embedding spree of random linker errors, these ones only
> show up in release builds for me :
>
> host.obj : error LNK2019: unresolved external symbol _enet_list_clear
> referenced in function _enet_host_create
> peer.obj : error LNK2001: unresolved external symbol _enet_list_clear
> protocol.obj : error LNK2001: unresolved external symbol _enet_list_clear
> peer.obj : error LNK2019: unresolved external symbol _enet_list_remove
> referenced in function _enet_peer_receive
> protocol.obj : error LNK2001: unresolved external symbol _enet_list_remove
> peer.obj : error LNK2019: unresolved external symbol _enet_list_insert
> referenced in function _enet_peer_queue_acknowledgement
> protocol.obj : error LNK2001: unresolved external symbol _enet_list_insert
> peer.obj : error LNK2019: unresolved external symbol _enet_list_move
> referenced in function _enet_peer_dispatch_incoming_unreliable_commands
>
> There are multiple ways to fix this, for the people looking for a really
> hackish hotfix,
> Add the following to the top of host.c
>
> #if(ENET_BUILDING_LIB != 1)
> #include "enet/list.c"
> #endif /* !ENET_BUILDING_LIB */
>
>
> This is a dirty fix, i will post a cleaner fix if i can get around to it.
>
>
> On Wed, Nov 24, 2010 at 6:41 PM, Nicholas J Ingrassellino <
> nick at lifebloodnetworks.com> wrote:
>
>>  It is awesome that you posted this. Thank you. In this spirit I will post
>> something I was struggling with.
>>
>> I had an issue using ENet with Allegro with Visual C++ 9. The headers need
>> to be:
>>
>> #define _WINSOCKAPI_
>> #define ALLEGRO_STATICLINK
>> #define ALLEGRO_NO_ASM
>>
>> #include <allegro.h>
>> #include <winalleg.h>
>> #include <enet/enet.h>
>>
>> and the libs needs to be
>>
>> alleg_s_crt.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib ole32.lib
>> dinput.lib ddraw.lib dxguid.lib winmm.lib dsound.lib enet.lib ws2_32.lib
>>
>> Any other order in the headers threw a mess of unresolved external symbols
>> which took me a decent amount of time to figure out. As you can probably
>> tell I am statically linking Allegro. This should also work with Allegro
>> being dynamically linked (obviously with *#define ALLEGRO_STATICLINK*removed).
>>
>> ------------------------------
>>
>> Nicholas J Ingrassellino
>> LifebloodNetworks.com <http://www.lifebloodnetworks.com/> ||
>> nick at lifebloodnetworks.com
>>
>> "The idea that I can be presented with a problem, set out to logically
>> solve it with the tools at hand, and wind up with a program that could not
>> be legally used because someone else followed the same logical steps some
>> years ago and filed for a patent on it is horrifying."
>> - John Carmack on software patents
>>
>> On 11/24/2010 08:43 AM, fuzzy spoon wrote:
>>
>> Steps to reproduce :
>>          Drop code into existing solution.
>>          Make sure you are linking to WS2_32.lib and Winmm.lib
>>          Make sure that you have defined WIN32_LEAN_AND_MEAN
>> Build.
>>
>>  Problem : Linker errors ( timeBeginPeriod etc from winmm.lib, called
>> from enet_initialize).
>>
>>  Fix: Due to WIN32_LEAN_AND_MEAN , mmsystem.h is no longer included in
>> the chain that enet relied on before.
>>
>>  At the top of win32.h, Line 18 (added underneath the other includes).
>>
>>  #ifdef WIN32_LEAN_AND_MEAN
>> #include <mmsystem.h>
>> #endif /* WIN32_LEAN_AND_MEAN */
>>
>>
>>  Hopefully this will save someone some time.
>>
>>
>>  _______________________________________________
>> ENet-discuss mailing listENet-discuss at cubik.orghttp://lists.cubik.org/mailman/listinfo/enet-discuss
>>
>>
>> _______________________________________________
>> ENet-discuss mailing list
>> ENet-discuss at cubik.org
>> http://lists.cubik.org/mailman/listinfo/enet-discuss
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cubik.org/pipermail/enet-discuss/attachments/20101125/4cb4d459/attachment.html>


More information about the ENet-discuss mailing list