🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Linking error

Started by
2 comments, last by Basiror 17 years, 7 months ago
Hi, I once again found some spare time and finally wanted to get into angelscript however it quits with this error message g++ -o lol main.cpp -L/usr/local/lib/libangelscript.a /tmp/ccvOh1UW.o: In function `main': main.cpp:(.text+0x16): undefined reference to `asCreateScriptEngine' collect2: ld returned 1 exit status

      1 #include <iostream>
      2 #include <string>
      3 #include <angelscript.h>
      4 using namespace std;
      5 int main(int argc, char *argv[])
      6 {
      7         asIScriptEngine * pScriptEngine =asCreateScriptEngine (ANGELSCRIPT_VERSION);
      8         if( pScriptEngine == 0 )
      9         {
     10                 cout << "Failed to create Angel Script engine." << endl;
     11                 return -1;
     12         }
     13         const char *sz="float depp=1;";
     14
     15         cout<< pScriptEngine->AddScriptSection("testmod","script.as",sz,13);
     16         cout << pScriptEngine->Build("testmod");
     17         void *obj=pScriptEngine->GetGlobalVarPointer(pScriptEngine->GetGlobalVarIDByName("testmod","depp"));
     18         float i=-1;
     19         i = *((float*)obj);
     20         cout << i<<endl;
     21         return 0;
     22 }



http://www.8ung.at/basiror/theironcross.html
Advertisement
Obviously the compiler didn't link with the library.

I may be mistaken, but isn't the -L option only for specifying directories where the linker will look for libraries? I think you should do it something like this:

g++ -o lol main.cpp -L/usr/local/lib/ -langelscript

And what does 'lol' mean? It looks funny ;)

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

You are right, -l is for specifying the library, ^^^my fault thx
http://www.8ung.at/basiror/theironcross.html
So I got it work with the generic calling convention.

Just found this thread
http://www.gamedev.net/community/forums/topic.asp?topic_id=313900

I am going to integrate AngelScript into my gamedev library with wrappers for most of the work that would otherwise be done by the programmer.


Maybe we can work together on this, the library shall contain nearly everything required to develop a modern 3d engine.

[Edited by - Basiror on November 5, 2006 2:13:39 PM]
http://www.8ung.at/basiror/theironcross.html

This topic is closed to new replies.

Advertisement