views:

203

answers:

4

I'm looking for a simple script language which I can compile easily by just putting the .h files under an include folder and the .c/.cpp files under a source directory. Something without any Makefile. Must be written in C/C++ rather C++.

+1  A: 

Try premake4. A lot easier to work with than plain Makefiles, and is quite portable indeed.

Kornel Kisielewicz
A: 

I am sure I understand the context of your question since a script implies that it is interpreted yet you want to compile it...would CH Compiler do?

Hope this helps, Best regards, Tom.

tommieb75
I suspect the OP means "with which" not "which", as in the script helps perform the compilation.
Jefromi
...or since "lua" was the accepted answer, I guess the real meaning was a scripting language to embed into my application, and one which doesn't take any effort to integrate until the build pipeline?
Jefromi
+3  A: 

Lua is a simple lightweight scripting language that can be easily embedded into your application. It is written in C (I don't really understand what you mean by "Must be written in C/C++ rather C++").

You can simply add all files from the src directory except for lua.c and luac.c into your project and it should work.

Note that if you're including from a C++ file, you have to wrap includes in extern "C" block. The following compiles and links for me.

extern "C" {
#include <lua.h>
#include <lauxlib.h>
}

int main()
{
    lua_State* L = lua_open();
}
avakar
I added lua.c and luac.c and it has compiled, is it okay? I mean, should I use it and it won't have any problems?
Tamir
Well, `lua.c` and `luac.c` both have `main` function, so I'm not sure how you linked it. They are command-line programs that execute lua scripts. You don't need them to embed lua into your application.
avakar
I yet did not link the library to my application.But yeah okay, I saw the entry point, I will just delete those files.
Tamir
Argh, now it wouldn't link properly..I wrote:lua_State* L = lua_open();and the next error has popped:c:/Users/Tam/Desktop/LogicOS/source/logic_os.cpp:71: undefined reference to `luaL_newstate()'Its the same for all methods, maybe I should drop some parts that are using the C's IO function, or just change them to work with the DS toolchain.
Tamir
That function is in `lauxlib.c`. Are you sure you're linking it too?
avakar
You will find the references to stdio.h in print.c and liolib.c . It is not hard to remove the io library and hacking the print function is pretty easy.
Nick
Hmm, I think my problem was the clash between .c functions to .cpp.. Some people have told me that it might cause linking problems.. Just one thing, if I add extern "C" will it affect linking somehow?
Tamir
Oh nevermind, got it compiled.The command line forgot to report about some problems with some methods, fixed and re-compiled lua, and it finally fixed!
Tamir
A: 

Okay so LUA doesn't work, I need something which I can just call a simple method and it will handle a script file. Without any load from file methods in it, or atleast something which doesn't use the stdio.h.

Tamir
This is not an answer to your question, and should be an edit to the question.
David Thornley