[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: Using Lua in a C(++) program
- From: "Nick Trout" <nick@...>
- Date: Thu, 12 Jun 2003 11:52:33 -0700
> From: Enno Rehling
> benjamin sunshine-hill wrote:
>
> > I'm guessing you didn't encapsulate the Lua header file(s)
> in extern
> > "C".
>
> This is such a common problem. Why is it that the lua headers
> don't come
> with the standard "if you include me in C++, I'll help you
> with the extern"
> trick?
>
> #ifdef __cplusplus
> extern"C" {
> #endif
> ... header goes in here
> #ifdef __cplusplus
> }
> #endif
Because it's not an issue with Lua. It's an issue with C++. It's well
documented on the wiki what you have to do. It's no different from
trying to get Lua to compile on a system that has a different compiler
or different number size. Lua is ANSI C - the above is not ANSI C code.
http://lua-users.org/wiki/BuildingLua