• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
jammer312

Compiling error

12 posts in this topic

When I try to compile project(Eclipse on Ubuntu 13.10 x64) it says about 

 

as_thread.o : undefined pointer to symbol «pthread_rwlock_wrlock@@GLIBC_2.2.5»

 

Using static library attached to project,version 2.28.1

Is there any possible fixes for it? I tried to add -pthread flag to both compilation of library and compilation of project, but it hadn't helped.

Sorry if theres already existing post for this problem.

0

Share this post


Link to post
Share on other sites

I believe the correct flag to add to the linker is -lpthread, at least that is what is done in the gnuc makefile.

 

If you can't get it to work you can also turn off multithreading completely by compiling the angelscript library with the preprocessor macro defined AS_NO_THREADS (e.g. with commandline flag -DAS_NO_THREADS)

0

Share this post


Link to post
Share on other sites

I believe the correct flag to add to the linker is -lpthread, at least that is what is done in the gnuc makefile.

 

If you can't get it to work you can also turn off multithreading completely by compiling the angelscript library with the preprocessor macro defined AS_NO_THREADS (e.g. with commandline flag -DAS_NO_THREADS)

Changed project settings, still don't work.

Neither with -lpthread nor -DAS_NO_THREADS nor both

Edited by jammer312
0

Share this post


Link to post
Share on other sites

Does it work if you compile directly with the makefile instead of using the Eclipse IDE?

 

What version of gnuc are you using with Eclipse?

1

Share this post


Link to post
Share on other sites

I compiling lib using 'make' command from sdk/angelscript/projects/gnuc

Then I copy angelscript.a to project. 

If eclipse use default installed g++ then It use :

g++ (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
If not, If you say how to check of gnuc version of eclipse I'll say.
Sorry,I'm novice in C/C++,so I can do something wrong.
About makefile: I thought eclipse building makefile automatially. But I'll try to build something including angelscript.a using makefile and write here results
0

Share this post


Link to post
Share on other sites

Hadn't learned makefiles yet, but when I compile simple c++ file that includes "angelscript.h" with '-L. -langelscript' flags (angelscript.a in directory I compile from) it compiles and launches fine. I think it's problem with eclipse.

0

Share this post


Link to post
Share on other sites

How do you link with the AngelScript library from the Eclipse project? Linking with the pthread library should be done the same way. The only difference is that the pthread library is a standard library that comes with the gnuc compiler, and is most likely installed in your standard OS directory where all ordinary shared libraries are.

0

Share this post


Link to post
Share on other sites

I link AS library by going into project properties -> C/C++ Build -> Settings -> Cross G++ Linker -> Libraries, then write angelscript in -l text field and setting path to project where libangelscript.a placed in -L text field.

0

Share this post


Link to post
Share on other sites
using namespace std;
#include <cstdio>
#include <string>
#include "angelscript.h"
#include "./scriptbuilder.h"

CScriptBuilder builder;
asIScriptEngine *engine;
string modules[1000];
int moduleslength = 0;
void MessageCallback(const asSMessageInfo *msg, void *param)
{
  const char *type = "ERR ";
  if( msg->type == asMSGTYPE_WARNING )
    type = "WARN";
  else if( msg->type == asMSGTYPE_INFORMATION )
    type = "INFO";
  printf("%s (%d, %d) : %s : %s\n", msg->section, msg->row, msg->col, type, msg->message);
}
//utils----------
bool check(int in);
//---------------
bool as_register();
bool as_compile(string path,string modulename);
bool as_init()
{
	engine = asCreateScriptEngine(ANGELSCRIPT_VERSION);
	int r = engine->SetMessageCallback(asFUNCTION(MessageCallback),0,asCALL_CDECL);
	if (r>=0) return false;
//	RegisterStdString(engine);
	if (as_register())
		{
		return false;
		}
	return true;
}

bool as_compile (string path,string modulename)
{
	for(int i = 0;i<moduleslength;i++)
	{
		if(modules[i]==modulename)
		{
			printf("FFFFFUUUUUU. Module name already exist");
			return false;
		}
	}

	// The CScriptBuilder helper is an add-on that loads the file,
	// performs a pre-processing pass if necessary, and then tells
	// the engine to build a script module.
	int r = builder.StartNewModule(engine, modulename.c_str());
	if( r < 0 )
	{
	  // If the code fails here it is usually because there
	  // is no more memory to allocate the module
	  printf("Unrecoverable error while starting a new module.\n");
	  return false;
	}
	r = builder.AddSectionFromFile(path.c_str());
	if( r < 0 )
	{
	  // The builder wasn't able to load the file. Maybe the file
	  // has been removed, or the wrong name was given, or some
	  // preprocessing commands are incorrectly written.
	  printf("Please correct the errors in the script and try again.\n");
	  return false;
	}
	r = builder.BuildModule();
	if( r < 0 )
	{
	  // An error occurred. Instruct the script writer to fix the
	  // compilation errors that were listed in the output stream.
	  printf("Please correct the errors in the script and try again.\n");
	  return false;
	}
	modules[moduleslength]=modulename;
	moduleslength++;
	return true;
}

//Here goes function declaration prototypes stuff
void print(const string &in);
//-----------------------------------------------
bool as_register()
{
	int r = engine->RegisterGlobalFunction("void print(const string &in)",asFUNCTION(print), asCALL_CDECL);
	if (check(r)) return false;
	return true;
}
bool check(int in)
{
	return in >= 0;
}
bool runmodule(string modulename)
{
	// Find the function that is to be called.
	asIScriptModule *mod = engine->GetModule(modulename.c_str());
	asIScriptFunction *func = mod->GetFunctionByDecl("void main()");
	if( func == 0 )
	{
	  // The function couldn't be found. Instruct the script writer
	  // to include the expected function in the script.
	  printf("The script must have the function 'void main()'. Please add it and try again.\n");
	  return false;
	}
	// Create our context, prepare it, and then execute
	asIScriptContext *ctx = engine->CreateContext();
	ctx->Prepare(func);
	int r = ctx->Execute();
	if( r != asEXECUTION_FINISHED )
	{
	  // The execution didn't complete as expected. Determine what happened.
	  if( r == asEXECUTION_EXCEPTION )
	  {
	    // An exception occurred, let the script writer know what happened so it can be corrected.
	    printf("An exception '%s' occurred. Please correct the code and try again.\n", ctx->GetExceptionString());
	  }
	}
	return true;
}

int main()
{
printf("OK");
}


That's code I using.

But when I compile it using :

g++ test.cpp scriptbuilder.cpp scriptbuilder.h  -L. -langelscript -lpthread -o test

It returns :

 

/tmp/ccTRpvvj.o: In function `as_register()':
test.cpp:(.text+0x28d): undefined reference to `print(std::string const&)'
collect2: error: ld returned 1 exit status
 
Can anybody say what I do wrong?
Used code from 'Your first script' and changed it a bit.
Also, theres scriptbuilder.cpp and scriptbuilder.h and angelscript.a in catalog I execute command from
Edited by jammer312
0

Share this post


Link to post
Share on other sites

You haven't implemented the void print(const std::string &)' function that you declare on line 83.

 

Regards,

Andreas

1

Share this post


Link to post
Share on other sites

Thanks, I think it was deleted accidentally. Any thoughts about eclipse linking problem? 

0

Share this post


Link to post
Share on other sites

Unfortunately I don't know anything about Eclipse. If you've already tried adding pthread the same way you add angelscript itself then I have no clue what else to try.

0

Share this post


Link to post
Share on other sites

Ok. I'll learn makefiles then(because it compiles fine with G++ without eclipse)

Thanks for help.

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0