Lua and Dev-C++

Started by
24 comments, last by jbadams 13 years, 11 months ago
Hello all. I'm having trouble setting up Lua with Dev-C++ I saw that with the HGE game engine there are different library extensions for different compilers, and from what I understand, Dev-C++ has some strange native compiler. So how do I compile the Lua libraries for Dev-C++? I just this week started using C++ and external libraries. My last project was in Java from the ground up. EDIT: I think the problem is the difference between a ".lib" file and a ".a" file
Advertisement
For Dev-C++:

1. Add the Lua sources/header files to your project (from a Source download, not precompiled). However, do not any files that link a main though, such as lua.c or luac.c.

2. Go to Project->Project Options. Click the Files tab. For any .c file, remove the checkbox for Compile as C++.

3. You are ready to use Lua!

I just tested it with Dev-C++ 4.9.9.2 and Lua 5.1.4 and it worked fine.

Here's a simple test program you can use to make sure you got it working right:

#include <cstdlib>#include <iostream>extern "C" {#include "lua/lua.h"#include "lua/lualib.h"#include "lua/lauxlib.h"}using namespace std;int main(int argc, char *argv[]){    lua_State * L = lua_open();    luaL_openlibs(L);    luaL_dostring(L, "print(\"Hello World from Lua!\")");    lua_close(L);    system("PAUSE");    return EXIT_SUCCESS;}


The project folder would look like this:

thank you! it compiled. i can't actually test it yet though because i'm using HGE and there is no command line output.
Good, now you should delete Dev-C++ off your drive and install something that doesn't suck.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
Quote:Original post by Promit
Good, now you should delete Dev-C++ off your drive and install something that doesn't suck.


no microsoft products please. i used eclipse for java but dev-c++ looked like the beginner standard.
and now for some actual lua related questions:

should my xml map parser be in lua or c++?

are there any other libraries that would make the production of a full game easier?

i'm using c++, haaf's game engine, and lua.

do any sort of database languages make sense to use?
i'm not looking to do any networking any time soon (plus every complains that networked games should be built from the ground up FOR networking).
Quote:Original post by overeasy
Quote:Original post by Promit
Good, now you should delete Dev-C++ off your drive and install something that doesn't suck.


no microsoft products please. i used eclipse for java but dev-c++ looked like the beginner standard.

Why not? Visual Studio is the best IDE around for Windows, and you can get the Express Edition for free.
If you really want a cross-platform IDE, there's Code::Blocks. You'll probably want to get a nightly build here, but you could get by with the old 8.02 release.
Eclipse also has C++ support. Not sure how the CDT is nowadays, but it can't possibly be a worse choice than Dev-C++. Though frankly it's a pretty blockheaded idea to use anything other than VS on Windows unless you really can't.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
Quote:Original post by Promit
Eclipse also has C++ support. Not sure how the CDT is nowadays, but it can't possibly be a worse choice than Dev-C++. Though frankly it's a pretty blockheaded idea to use anything other than VS on Windows unless you really can't.


except for refactoring, i don't need the additional functionality. maybe eventually, but i am happy as is. i have lua confirmed working and can proceed with my coding. i'd use visual c++ if i was creating a windows app - instead i'm using a game engine library.

This topic is closed to new replies.

Advertisement