Skip to main content
gamedev.net
🔒 Locked

Trouble linking C++ program using Lua

Started by desu_ka 0 replies 900+ views
Original Post
desu_ka
desu_ka
I'm attempting to incorporate Lua into my 2D RPG engine written in C++. To begin, I wrote the following program to test out Lua:
#include <iostream>
#include <lua.hpp>

int main(int argc, char* argv[])
{
	lua_State* L = luaL_newstate();
	luaL_openlibs(L);
	
	lua_close(L);
	return 0;
}

Unfortunately, even this simple program causes linker errors:
Quote:
/usr/lib/gcc/i386-redhat-linux/4.1.0/../../../liblua.a(loadlib.o): In function ll_loadfunc':loadlib.c:(.text+0x8e7): undefined reference to dlsym" :loadlib.c:(.text+0x8f4): undefined reference to dlerror' :loadlib.c:(.text+0x9cc): undefined reference to dlopen' :loadlib.c:(.text+0x9e1): undefined reference to dlerror' /usr/lib/gcc/i386-redhat-linux/4.1.0/../../../liblua.a(loadlib.o): In function gctm':loadlib.c:(.text+0xfee): undefined reference to `dlclose'
It looks to me that the functions I'm using explicitly are actually macros for several implied functions, the implementation of which are missing. I'm running Fedora Core 5 and using the Anjuta IDE. I know this is probably a really obscure problem for anyone besides me to solve, but I'd appreciate any advice. Thanks!
drakostar
drakostar
You need to link to libdl.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.