Code::Blocks and Enet
Bob Keane

Gaaaaah, I'm losing my mind over this. I'm trying to set up enet in Code::Blocks and having problems. I followed the instructions on the Enet website, ie ./configure &&make &&make install and everything seemed to work. When trying to run the sample programs, I found I had a linker problem. After some searching, I found <a href="https://forums.codeblocks.org/index.php?topic=18235.0">this on the Code::Blocks forums suggesting to open the enet_dll.cpb project and run build to create the libraries. I tried but got an error in the unix.c file, "error: conflicting types for 'socklen_t'; have 'int'". I've used the files in the enet_dll project as downloaded, no editing. Are the instructions in the Code::Blocks post specific to the OP's situation, or should I be changing the Enet files to make it work? Thanks.

<update> After some searching, I found the library files in a hidden folder. For anyone looking for the libraries in Linux, the path is .../Documents/enet-1.3.17/.libs, assuming the enet file is under the Documents folder. However, I still can't compile.

Edgar Reynaldo

Bob - relax!

Use cmake-gui instead of autobarf. Always prefer cmake to autotools. Unless they just work, but even then....

I tweaked my CMakeLists.txt a little for Enet to produce a shared and static version and an install target. You can find it attached. Just overwrite the existing CMakeLists.txt file and run as normally. It will install the libraries in ${CMAKE_INSTALL_PREFIX} for you when you run make install.

Bob Keane

I've been playing with it a little. It looks like dynamic linking works on Linux and possibly Windows but not static linking. I found these instructions on GiHub:

$ mkdir build
$ cd build
$ cmake .. -DENET_STATIC=1 -DCMAKE_BUILD_TYPE=Release
$ cmake --build .

but I haven't tried it yet. I'll try it on Linux but not sure if CMake is installed on my Windows laptop. Or how to use it. Will post with results. Thanks.

Edit: I tried the GiHub commands to build the static library, with a few tweaks. Here are the results:

[bobkeane@fedora enet-1.3.17]$ make -ENET_STATIC=1 -CMAKE_BUILD_TYPE=Release
make: *** MAKE_BUILD_TYPE=Release: No such file or directory. Stop.
[bobkeane@fedora enet-1.3.17]$ make -ENET_STATIC=1 -CMAKE_BUILD_TYPE=Debug
make: *** MAKE_BUILD_TYPE=Debug: No such file or directory. Stop. I'm getting close.

Edgar Reynaldo

You're mixing cmake and make commands. And your cmake variables are missing -D in front of them.

mkdir build
cd build
cmake-gui ..
make
make install

Use the CMakeLists.txt I provided. You don't need to set anything except CMAKE_INSTALL_PREFIX for your install directory.

Bob Keane

I Downloaded your file and installed CMake. It works now, thanks Edgar.

Edgar Reynaldo
Thread #618684. Printed from Allegro.cc