[ENet-discuss] ENet-discuss Digest, Vol 121, Issue 8
Thorbjørn Lindeijer
bjorn at lindeijer.nl
Mon Jul 22 00:37:58 PDT 2013
On Sat, Jul 20, 2013 at 11:50 PM, Blah900 <blah900z at gmail.com> wrote:
> Sorry let me try to be more specific.
>
> I am using Qt creator and copied the enet.lib and enet64.lib into my
> workspace directory. Then I copied the include headers into my workspace
> directory as well.
>
> Then in the Qt Creator I tried both LIBS += -lenet64 and LIBS += -lenet to
> link the library. Then I included into the project the enet headers. Then I
> built it using Qmake and then tried to run it.
Whether this works or not depends on which compiler you are using. It
has to be compatible with the library you're trying to link. So are
you using Visual Studio or MinGW?
> However the error I get is the following:
> LNK2019: unresolved external symbol enet_initialize referenced in
> function....
Is that the only error? Are there no reports about it not being able
to link to enet, for example? To avoid this you can simply add the
full path to the library to the LIBS variable, as follows:
LIBS += path/to/zlib.lib (relative to your .pro file or make it absolute)
> I think it linked in that if I ctrl+click the enet_initialize() I get moved
> to the corresponding function inside the library.
Whether you can Ctrl+click or not has nothing to do with the linking process.
Finally, note that the enet license does not require you to use
dynamic linking, so alternatively you can just include the enet
sources into your project. That's what I did with my Qt project, which
you could use as an example:
https://github.com/mana/manamobile/blob/master/src/enet/enet.pri
Regards,
Bjørn
More information about the ENet-discuss
mailing list