Jump to content
  • Advertisement
Sign in to follow this  
overeasy

Lua and Dev-C++

This topic is 3004 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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:

Share this post


Link to post
Share on other sites
thank you! it compiled. i can't actually test it yet though because i'm using HGE and there is no command line output.

Share this post


Link to post
Share on other sites
Good, now you should delete Dev-C++ off your drive and install something that doesn't suck.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!