lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



If the file your compiling this code in is a '.cpp' - the default for a 
console app in vc5.0 I believe, simply add 

extern "C" { 
 #include "lua.h" 
} 

around your include.  Lua is a c library, with c linkage, hence the 
__cdecl requirement.  With this change your c++ app knows to look for 
a c implementation of lua_open(). 

You can also rename your .cpp to a .c to get the compile to work without 
any changes to your source. (VC differentiates a file's language based 
on the file extension.) Assuming your not using c++ classes in this file.

Regards,
Jim


-----Original Message-----
From: George Papaioannou [mailto:papaioannou@dimitra.gr]
Sent: Thursday, November 02, 2000 7:17 AM
To: Multiple recipients of list
Subject: Visual C++ ver 5 Link Error

When I try to compile a win32 app
with lua embedded in it I get the error message {unresolved external symbol
"void __cdecl lua_open(void)} in Linking stage


All I do is that in win32 console app:

#include "lua.h"

main()
{
  lua_open();
  lua_close();
}

and declaring the lua.lib in the settings/link tab.


what's wrong ?

Can I use the DLL files instead ?

PS: I am new in the Visual C but I have a great experience in Dos/Pascal

Thanx.
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.177 / Virus Database: 86 - Release Date: 7/8/2000