[ENet-discuss] Enet Installation and C++

Paul Collier paching at gmail.com
Sun Jun 12 15:49:57 PDT 2005


Hey,

I've had this problem before too. It's really annoying, ne?
Try moving -lenet to the end of your build command, that worked for me.

Hope this helps,
-Paul


On 6/12/05, Charlie Sibbach <hubuki.kai at gmail.com> wrote:
> Hey all,
> 
> Well, I'm stumped. I thought it was simply my inexperience with UNIX,
> but after my guru friend spent a few hours and couldn't get it working
> either, I have to turn to the list.
> Here's the problem. After downloading the source, and following the
> build instructions in the README, I got Enet installed on my Mandriva
> Linux installation. Next, I create a basic hello world program to make
> sure it's getting linked in correctly. That program is this:
> 
> #include <iostream>
> #include <enet.h>
> using namespace std;
> 
> int main() {
>         enet_initialize();
>         cout << "Hello, cocksucker!" << endl;
>         enet_deinitialize();
>         return 0;
>         }
> 
> I compile it thus:
> g++ -I/usr/local/include/enet -L/usr/local/lib hello.cpp
> 
> This program produces about a hundred errors. Such as:
> In file included from
> /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/cwchar:51,
>                  from
> /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/bits/postypes.h:46,
>                  from
> /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/iosfwd:50,
>                  from
> /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/ios:44,
>                  from
> /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/ostream:45,
>                  from
> /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/iostream:45,
>                  from hello.cpp:1:
> /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/ctime:66:
> error: `::clock_t' has not been declared
> /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/ctime:67:
> error: `::time_t' has not been declared
> /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/ctime:68:
> error: `::tm' has not been declared
> /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/ctime:70:
> error: `::clock' has not been declared
> /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/ctime:71:
> error: `::difftime' has not been declared
> /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/ctime:72:
> error: `::mktime' has not been declared
> /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/ctime:73:
> error: `::time' has not been declared
> /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/ctime:74:
> error: `::asctime' has not been declared
> /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/ctime:75:
> error: `::ctime' has not been declared
> /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/ctime:76:
> error: `::gmtime' has not been declared
> /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/ctime:77:
> error: `::localtime' has not been declared
> /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/ctime:78:
> error: `::strftime' has not been declared
> 
> If I convert it to a straight C file and just use gcc with this invocation:
> gcc -I/usr/local/include/enet -L/usr/local/lib -lenet hello.c
> 
>  I still get errors, but this time from the linker:
> /home/masamune/tmp/ccGMkZMM.o(.text+0x1d): In function `main':
> : undefined reference to `enet_initialize'
> /home/masamune/tmp/ccGMkZMM.o(.text+0x32): In function `main':
> : undefined reference to `enet_deinitialize'
> collect2: ld returned 1 exit status
> 
> If you're still there, the question of the day is what gives? My
> friend and I spent at least two hours playing with configuration
> scripts, variables and other stuff I don't yet understand; and this is
> the best we could do. We want to use Enet in a C++ project, and all
> the headers seem to have adequate protections for this, so I don't
> think that's the problem. Is it possibly a Mandrake/Mandriva issue?
> 
> Any and all advice here is much appreciated!
> --
> ~Charlie
> 
> _______________________________________________
> ENet-discuss mailing list
> ENet-discuss at cubik.org
> http://lists.cubik.org/mailman/listinfo/enet-discuss
>



More information about the ENet-discuss mailing list