LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-11-2018, 08:52 AM   #1
abk4523
Member
 
Registered: Jun 2004
Distribution: RH8/Fedora Core 4
Posts: 139

Rep: Reputation: 15
"undeclared" error when compiling enet


I am following this tutorial:

https://www.linuxjournal.com/content...ogramming-enet

and running into an "error: ipeerCount undefined" error when compiling the sever program. The tutorial says the code snippet should send any messages to all clients other than the original client. I'm thinking of adding a routine to the "ENET_EVENT_TYPE_CONNECT:" event to count the number of clients and use it to control the while loop, but would it be the right way? I understand this solution would not skip the original sender, but that is not important at the moment.
 
Old 11-11-2018, 12:19 PM   #2
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,263
Blog Entries: 24

Rep: Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194
You may receive more, better replies if you can frame your question inline and not require others to visit a third-party link simply to understand what you are asking. Asking others to read through an online tutorial simply to understand the question will turn away many who may otherwise be able to help.

You seem to be asking two questions, one about a compile error and another about modifying the application behavior. Please include the complete error message along with any relevant information about what you have done to identify the problem. For example, if the error complains about an undefined variable, have you tried to identify where it is, or should be defined?

For modifications to the existing code, it would be most helpful to others if you would reduce the code to a minimum example which shows how it currently works, and how you want to change it.

Please review the Site FAQ for guidance in posting your questions. Especially, read the link in that page, How To Ask Questions The Smart Way. The more effort you put into understanding your problem and framing your questions, the better others can help!

Last edited by astrogeek; 11-11-2018 at 12:22 PM.
 
Old 11-12-2018, 10:22 AM   #3
KenJackson
Member
 
Registered: Jul 2006
Location: Maryland, USA
Distribution: Fedora and others
Posts: 757

Rep: Reputation: 145Reputation: 145
Quote:
Originally Posted by abk4523 View Post
and running into an "error: ipeerCount undefined" error when compiling the sever program.
I searched that article (CTRL-F in Firefox), and only found "ipeerCount" on one line, in the server code:
Code:
for (i=0; ipeerCount; i++) {
That looks like a typo. It probably should be something like this, though there's no "peerCount" variable declared either:
Code:
for (i=0; i < peerCount; i++) {
Using the search box at http://enet.bespin.org/ reveals there is a peerCount field in struct (or class?) ENetHost, so it should probably be this:
Code:
for (i=0; i < server->peerCount; i++) {
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] X: "loading extension glx" "no screens found" "fatal server error" (w/ nvidia driver) Geremia Slackware 7 12-29-2014 11:00 AM
how to fix error"CURLOPT_USERNAME’ undeclared "in curl ftp programming renuaseri Linux - Newbie 1 06-10-2010 06:35 PM
Why is my only compile error "'Current:' Undeclared" gh0pp3r Programming 2 01-10-2010 11:28 PM
ffmpeg build - "undeclared" errors Jinouchi Linux - Newbie 5 01-23-2009 10:14 AM
LIRC make error "`HID_MAX_USAGES' undeclared here¨ jimdaworm Linux - Software 1 09-26-2006 02:16 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:28 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration