[ENet-discuss] Linker errors when NOT compiling as a lib (embedded) [with suggested fix]
Nicholas J Ingrassellino
nick at lifebloodnetworks.com
Wed Nov 24 08:41:35 PST 2010
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 <mailto: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 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/20101124/8580cfa3/attachment.html>
More information about the ENet-discuss
mailing list