LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Enet and gcc compiling (https://www.linuxquestions.org/questions/programming-9/enet-and-gcc-compiling-4175607182/)

abk4523 06-02-2017 10:01 AM

Enet and gcc compiling
 
Sorry I'm lazy. I installed enet 1.3.13 and was trying to compile the host.c file but run into errors:

[bkeane@localhost enet-1.3.13]$ gcc -o host host.c `pkg-config --libs libenet`
Package libenet was not found in the pkg-config search path.
Perhaps you should add the directory containing `libenet.pc'
to the PKG_CONFIG_PATH environment variable

Does anyone know the gcc command to manually link enet and what files I need?

NevemTeve 06-02-2017 10:52 AM

Try this:
Code:

PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"
pkg-config --cflags --libs libenet

Edit: You should find out if you actually installed libenet from source, or installed it from binary package, or didn't install at all.

knudfl 06-02-2017 10:54 AM

If you did
Code:

$ cd enet-1.3.13/ && ./configure && make
# make install

... then you get /usr/local/lib/pkgconfig/libenet.pc

Either copy libenet.pc to /usr/lib/pkgconfig/

Or do ..
Code:

$ export PKG_CONFIG_LIBDIR=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig/ \
&& gcc -o host host.c `pkg-config --libs libenet`


pan64 06-02-2017 10:57 AM

if you have no libenet no gcc command can help you. Probably you need to install enet or enet related development package.

NevemTeve 06-02-2017 11:05 AM

Yeah, I keep forgetting that distributors split packages into 'base' and 'devel' parts (sometime more), eg 'libenet7' and 'libenet-dev'

norobro 06-02-2017 11:16 AM

Quote:

Originally Posted by abk4523 (Post 5718299)
... was trying to compile the host.c file ...

May I ask why you are trying to compile that file individually? It is part of the source code of the library.
https://github.com/lsalzman/enet/blob/master/host.c

abk4523 06-02-2017 12:10 PM

I'm compiling the host.c program to verify the install. Is there a better way?

pan64 06-02-2017 12:17 PM

look: I'm a bit confused, at this moment I have no idea what do you want to achieve.
First: what OS is it? What did you install exactly, and how (you told you installed enet 1.3.13)?
What is in your enet-1.3.13 directory? Why do you think host.c is a program? or What do you mean by that?

astrogeek 06-02-2017 09:10 PM

As others have said, it is really unclear what you are trying to accomplish.

Please try to restate your question and include:

* Your distro and version
* What, exactly you are trying to accomplish - you ultimate goal, not the goal of the gcc command

Pleas also see this page and the links at bottom thereof for guidance in asking a good and complete question, so that members here may better help you.


All times are GMT -5. The time now is 10:42 AM.