Author Topic: Enet and CodeBlocks  (Read 10264 times)

Offline oster

  • Single posting newcomer
  • *
  • Posts: 5
Enet and CodeBlocks
« on: August 10, 2013, 08:24:33 pm »
Well im trying to get enet http://enet.bespin.org/to work with codeblocks and im new to this ide (i used visual studio c++ 2008) and i have no idea where to start, to get this to work. Here is the install directions Im also running on a windows machine
Code
Installation

ENet should be trivially simple to integrate with most applications.

First, make sure you download the latest source distribution here Source Distribution.
Unix-like Operating Systems

If you are using an ENet release, then you should simply be able to build it by doing the following:

./configure && make && make install

If you obtained the package from github, you must have automake and autoconf available to generate the build system first by doing the following command before using the above mentioned build procedure:

autoreconf -vfi
Solaris and BSD

When building ENet under Solaris, you must specify the -lsocket and -lnsl parameters to your compiler to ensure that the sockets library is linked in.
Microsoft Windows

You may simply use the included "enet.lib" or "enet64.lib" static libraries. However, if you wish to build the library yourself, then the following instructions apply:

There is an included MSVC 6 project (enet.dsp) which you may use to build a suitable library file. Alternatively, you may simply drag all the ENet source files into your main project.

You will have to link to the Winsock2 libraries, so make sure to add ws2_32.lib and winmm.lib to your library list (Project Settings | Link | Object/library modules).

Load the included enet.dsp. MSVC may ask you to convert it if you are on a newer version of MSVC - just allow the conversion and save the resulting project as "enet" or similar. After you build this project, it will output an "enet.lib" file to either the "Debug/" or "Release/" directory, depending on which configuration you have selected to build. By default, it should produce "Debug/enet.lib".

You may then copy the resulting "enet.lib" file and the header files found in the "include/" directory to your other projects and add it to their library lists. Make sure to also link against "ws2_32.lib" and "winmm.lib" as described above.
DLL

If you wish to build ENet as a DLL you must first define ENET_DLL within the project (Project Settings | C/C++ | Preprocessor | Preprocessor definitions) or, more invasively, simply define ENET_DLL at the top of enet.h.

I have also read this post http://forums.codeblocks.org/index.php?topic=5933.0 but still dont know what to do.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Enet and CodeBlocks
« Reply #2 on: August 11, 2013, 04:20:07 pm »
Quote
If you are using an ENet release, then you should simply be able to build it by doing the following:
./configure && make && make install

Well, do that, in MSYS.

Then add a global user variable if you want to make adding search paths easier (or don't do that if you don't want), and add the library to projects using enet.

Not really a Code::Blocks specific problem as far as I can tell.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline oster

  • Single posting newcomer
  • *
  • Posts: 5
Re: Enet and CodeBlocks
« Reply #3 on: August 11, 2013, 06:10:07 pm »
Quote
Well, do that, in MSYS.

What is MSYS?

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: Enet and CodeBlocks
« Reply #4 on: August 11, 2013, 06:25:54 pm »
Quote
Well, do that, in MSYS.

What is MSYS?

http://www.mingw.org/wiki/MSYS

Also, not a CB question.

I suggest reading the rules.
http://forums.codeblocks.org/index.php/topic,9996.0.html
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline oster

  • Single posting newcomer
  • *
  • Posts: 5
Re: Enet and CodeBlocks
« Reply #5 on: August 11, 2013, 09:49:37 pm »
EDIT
well i did the ./configure && make && make install
But how did that help me it just made two folders that i can see .deps and .libs and tossed in some random files. i dont know how to use it still. Do i add the include folder to the project and .libs folder it made?
« Last Edit: August 12, 2013, 05:59:03 pm by oster »

georger

  • Guest
Re: Enet and CodeBlocks
« Reply #6 on: August 12, 2013, 11:06:15 pm »
EDIT
well i did the ./configure && make && make install
But how did that help me it just made two folders that i can see .deps and .libs and tossed in some random files. i dont know how to use it still. Do i add the include folder to the project and .libs folder it made?
Your question is not really C::B related. That said, I'll help.

I just downloaded the ENet source distribution (enet-1.3.8.tar.gz) and uncompressed it to a temp folder.
Surprise, there's an enet_dll.cbp C::B project file in it! Let's open it in C::B... Ok, it opened.

Build target is Debug. Let's click Build (Ctrl-F9)... 3 seconds later, I have 3 shiny new files in bin\Debug: libenet.a, libenet.def, and libenet.dll.
Now let's change the target to Release and click Build again... 3 seconds later, let's look at bin\Release, our files are there.

There you have it, static and dynamic libraries ready for linking.

By the way, now you're on your own. I'm still trying to figure out why the mods didn't remove this thread yet...

Offline oster

  • Single posting newcomer
  • *
  • Posts: 5
Re: Enet and CodeBlocks
« Reply #7 on: August 13, 2013, 08:55:33 pm »
EDIT
well i did the ./configure && make && make install
But how did that help me it just made two folders that i can see .deps and .libs and tossed in some random files. i dont know how to use it still. Do i add the include folder to the project and .libs folder it made?
Your question is not really C::B related. That said, I'll help.

I just downloaded the ENet source distribution (enet-1.3.8.tar.gz) and uncompressed it to a temp folder.
Surprise, there's an enet_dll.cbp C::B project file in it! Let's open it in C::B... Ok, it opened.

Build target is Debug. Let's click Build (Ctrl-F9)... 3 seconds later, I have 3 shiny new files in bin\Debug: libenet.a, libenet.def, and libenet.dll.
Now let's change the target to Release and click Build again... 3 seconds later, let's look at bin\Release, our files are there.

There you have it, static and dynamic libraries ready for linking.

By the way, now you're on your own. I'm still trying to figure out why the mods didn't remove this thread yet...

Yes that worked thank you for your time and help. Next time when i have a problem like this i will not post here. But if i do have another question like this is there a good forum maybe on a different site that code help me that use codeblocks?

georger

  • Guest
Re: Enet and CodeBlocks
« Reply #8 on: August 13, 2013, 10:25:47 pm »
Yes that worked thank you for your time and help. Next time when i have a problem like this i will not post here. But if i do have another question like this is there a good forum maybe on a different site that code help me that use codeblocks?
I don't know of any such forum or site.

C++ has a steep learning curve both as a language AND as an ecosystem. If you're really interested in C++, sooner or later you'll have to learn about compiling, linking, makefiles, and configure scripts. Also about tools like CMake and premake. Take a look at chapter 2 of this book for a introduction to the subject.

Next time you have such a question, try to find an answer by yourself - no offense.

Play around with the build options of your project:
- Add the correct libraries in "Linker settings". You'll want to put common link libraries in the root target, and specific the appropriate libraries in the Debug and Release targets;
- Add the appropriate include and lib directories in the "Compiler" and "Linker" tabs in "Search directories".

Your problem is not a C::B problem. C::B offers a simple and powerful interface for organizing, compiling and linking your project, but you are responsible for setting it up.

Once again, you're on your own.

Offline oster

  • Single posting newcomer
  • *
  • Posts: 5
Re: Enet and CodeBlocks
« Reply #9 on: August 14, 2013, 04:33:07 am »

C++ has a steep learning curve both as a language AND as an ecosystem. If you're really interested in C++, sooner or later you'll have to learn about compiling, linking, makefiles, and configure scripts. Also about tools like CMake and premake. Take a look at chapter 2 of this book for a introduction to the subject.

Yes i have been using c++ for 5 years and using Visual Studio 2008 express i had to never compile or recompile a library from source i had to just link to the .lib file and include folders so that was my problem, linking i have worked plenty with make files i have never touched CMake and premake heard of but never used. I will take a look at that link you shared also.

Next time you have such a question, try to find an answer by yourself - no offense.

Non taking since i did and the only thing i found relevant was the link i shared in my first post

Thanks for your help even though i posted a non related c::b question.