Allegro.cc - Online Community

Allegro.cc Forums » Off-Topic Ordeals » Code::Blocks and Enet

Credits go to Edgar Reynaldo for helping out!
This thread is locked; no one can reply to it. rss feed Print
Code::Blocks and Enet
Bob Keane
Member #7,342
June 2006

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.

By reading this sig, I, the reader, agree to render my soul to Bob Keane. I, the reader, understand this is a legally binding contract and freely render my soul.
"Love thy neighbor as much as you love yourself means be nice to the people next door. Everyone else can go to hell. Missy Cooper.
The advantage to learning something on your own is that there is no one there to tell you something can't be done.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

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
Member #7,342
June 2006

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.

By reading this sig, I, the reader, agree to render my soul to Bob Keane. I, the reader, understand this is a legally binding contract and freely render my soul.
"Love thy neighbor as much as you love yourself means be nice to the people next door. Everyone else can go to hell. Missy Cooper.
The advantage to learning something on your own is that there is no one there to tell you something can't be done.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

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
Member #7,342
June 2006

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

By reading this sig, I, the reader, agree to render my soul to Bob Keane. I, the reader, understand this is a legally binding contract and freely render my soul.
"Love thy neighbor as much as you love yourself means be nice to the people next door. Everyone else can go to hell. Missy Cooper.
The advantage to learning something on your own is that there is no one there to tell you something can't be done.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Go to: