Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8533741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:02:21+00:00 2026-06-11T10:02:21+00:00

While I am new to C++, (I have experience with Java) I am starting

  • 0

While I am new to C++, (I have experience with Java) I am starting a project which requires the use of GNE, or the Game Networking Engine.

In their tutorial, (granted its from 2003) they use this line:

if ( initGNE( NL_IP, atexit ) ) {

in my code, I use the following:

log("Initializing GNE...");

if(initGNE(NL_IP, atexit)) {
    err("GNE failed to initialize!");
    err("Press ENTER to close MoServ...");
    std::cin.get();
    exit(0);
}

log("-> Registering game version...");
setGameInformation(myName(), myVer());
log("-> Initializing console...");
initConsole(false);
setTitle("MoServ");

log("GNE initialized!");

While compiling (with g++ on Linux, via eclipse /w CDT) I get the following errors:

/home/tehtros/Dev/MoServ/Debug/../src/main.cpp:38: undefined reference to `GNE::initGNE(unsigned int, int (*)(void (*)()), int)'
/home/tehtros/Dev/MoServ/Debug/../src/main.cpp:46: undefined reference to `GNE::setGameInformation(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned int)'
/home/tehtros/Dev/MoServ/Debug/../src/main.cpp:48: undefined reference to `GNE::Console::initConsole(bool)'
/home/tehtros/Dev/MoServ/Debug/../src/main.cpp:49: undefined reference to `GNE::Console::setTitle(char const*)'

Note: In the documentation, they DID say that unless you first call GNE::initGNE(), all other GNE functions would have the “undefinied reference” error.


If I change:

if(initGNE(NL_IP, atexit)) {

to:

if(initGNE(NL_IP, atexit())) {

then I get the error:

../src/main.cpp:38:27: error: too few arguments to function ‘int atexit(void (*)())’

While this is nowhere in the documentation, if I change this:

if(initGNE(NL_IP, atexit())) {

even further, to this:

if(initGNE(NL_IP, atexit(shutdownGNE()))) {

then I get this error:

../src/main.cpp:38:40: error: invalid use of void expression

If I remove the parenthesis, like this:

if(initGNE(NL_IP, atexit(shutdownGNE))) {

then I get this error:

../src/main.cpp:38:39: error: invalid conversion from ‘int’ to ‘int (*)(void (*)())’ [-fpermissive]
/usr/local/include/gnelib/ObjectBrokerClient.h:120:15: error:   initializing argument 2 of ‘bool GNE::initGNE(NLenum, int (*)(void (*)()), int)’ [-fpermissive]

As you can see, I’m a little lost. I can’t tell if GNE is broken, if I am just making a small mistake, or if I just have absolutely no clue what I’m doing, and I should just stop trying to program something so big with my little understanding. (then again, I learn by actually doing, not by reading HOW to do.) Could anyone offer any help or support, and clarify what I am doing wrong, if anything?


Edit: I copied and pasted their example directly from their website, without any modifications, and it did not compile.


Solution: I resolved this issue by changing the order of the command. On the command line, I was able to compile like this:

g++ -o test "test.cpp" -lgnelib -lNL

To make this work with eclipse, I added gnelib and NL as libraries, and changed to build command to:

${COMMAND} ${INPUTS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${FLAGS}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T10:02:22+00:00Added an answer on June 11, 2026 at 10:02 am

    I’m not sure why you are playing with the function point argument atexit but clearly it won’t work if initGNE() expects a pointer to a function pass something different instead. In particular, it won’t work to pass the void result of calling atexit.

    The errors in your first example simply result from compiling the program but not linking with the appropriate library: you will need to specify the library where the functions are defined. Have a look, e.g., at the installation tutorial which shows that you need to use -lgnelib.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm quite new to Android but already have some experience with Java itself. Now
I have a BroadcastReceiver that listens for incoming sms messages. While a new sms
I have problem on my blog: http://osify.com while processing add new post with above
I have the following code that opens a new popup window while disabling the
I am new to Hibernate. I have an exception while running an Hibernate-based application.
I have an action, var act = new Action(() => { while (true) {
I am pretty new to the whole Java and OSGi world and I have
I have been searching for a pure Java SSH library to use for a
so I am starting to learn how to develop Android Applications. I have experience
I'm completely new to BlackBerry development, but I'm experienced in Java ME development. While

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.