[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Using Lua in a C(++) program
- From: Johannes Hager <hager.j@...>
- Date: Wed, 11 Jun 2003 10:44:49 +0200
Hi,
That was it, now works. Thank you!
> I'm guessing you didn't encapsulate the Lua header file(s) in extern "C".
>
> Ben
>
> ----- Original Message -----
> From: Johannes Hager <hager.j@gmx.de>
> Date: Tuesday, June 10, 2003 4:40 pm
> Subject: Re: Using Lua in a C(++) program
>
> > Now i have this problem in C++:
> >
> > /tmp/cc71gCXy.o(.text+0x11): In function `main':
> > : undefined reference to `lua_open()'
> >
> > /tmp/cc71gCXy.o(.text+0x1f): In function `main':
> > : undefined reference to `lua_close(lua_State*)'
> >
> > collect2: ld returned 1 exit status
> >
> > Have someone a gues? I have linked it witch -llua, and the same as c
> > works fine.
> >
> > > I'm not sure your c++ problem is based on Lua.
> > > The line you reported earlier:
> > >
> > > /tmp/ccV9wgqi.o(.eh_frame+0x11): undefined reference to
> > > `__gxx_personality_v0'
> > >
> > > comes from mingw32/gcc when it tries to compile stuff as c++ but
> > > doesn't find the necessary runtime libraries when linking it.. I faced
> > > this when my source had CAPITAL names (unintentional though it was).
> > > The .C suffix confuses mingw to think it's c++.
> > >
> > > So first thing:
> > > - Make sure all your C files are *.c and all -real- c++ files *.cpp.
> > > NEVER use capital c. :)
> > >
> > > If that's not the cure:
> > > - Lua itself should compile either as c, or c++ (there really is some
> > > difference, under the hood). So i don't think it's that.
> > >
> > > - If you're still missing the c++ runtime libs, there's probably some
> > > link flag or something you need to set. Look with
> > > "__gxx_personality_v0" via Google, perhaps?
> > >
> > > Yours,
> > > -ak
> > >
> > >
> > > Johannes Hager kirjoittaa keskiviikkona, 11. kesäkuuta 2003, kello
> > >
> > > 01:55:
> > > > Hi,
> > > >
> > > > Fine it works. But can anyone tell me how to use lua in a C++
> > > > project. By the
> > > > way their was the problem. I have used the gcc but named my file
> > > > *.cpp, how
> > > > stupid.
> > > >
> > > >> You need to add -lm to the compile (that's the math library)