1 (edited by Dune 2010-08-15 16:08:35)

Topic: [HELP] Including new libraries into a Teeworlds project

Hello,

I'm trying to include new libraries into a Teeeworlds project based on the last 0.5 trunk source code, but it's apparently not working. I'm using the bam 0.4.0.
I tried to modify the bam.lua, creating new subfolders in other/, making everything like the SDL, but I've still got LNK errors - what means the .lib files have not been successfully included.

Could anyone help ?

Thank you in advance,
Dunedune.

Not Luck, Just Magic.

2 (edited by erd 2010-08-15 22:40:32)

Re: [HELP] Including new libraries into a Teeworlds project

What libraries do you want to use? I guess you will need to pass the corresponding linker options, take a look at bam.lua, function "build" (~ line 130).

settings.link.flags:Add("your linker options here")

3

Re: [HELP] Including new libraries into a Teeworlds project

Problem isn't with linking options, but with telling the bam to compile the library and include it in the project.
Like for the SDL, I've got include files (.h), .lib, and a DLL (.dll).

Not Luck, Just Magic.

4 (edited by Sushi Tee 2010-08-16 10:44:15)

Re: [HELP] Including new libraries into a Teeworlds project

first be sure to copy the dll files into the teeworlds folder while compiling since the game will need it:

if family == "windows" then
    table.insert(client_depends, CopyToDirectory(".", "other\\sdl\\vc2005libs\\SDL.dll"))
    table.insert(server_depends, CopyToDirectory(".", "other\\your_stuff\\libs\\your.dll"))
end

than be sure to add the include folder, the lib path and the .lib u are using for compiling for compiling:

elseif family == "windows" then
        settings.link.libs:Add("gdi32")
        settings.link.libs:Add("user32")
        settings.link.libs:Add("ws2_32")
        settings.link.libs:Add("ole32")
        settings.link.libs:Add("shell32")
        settings.cc.includes:Add("other/your_stuff/include")
        settings.link.libpath:Add("other/your_stuff/libs")
        settings.link.libs:Add("your_lib")
    end

it should work like this... at least it does for me wink

uptee - a simple web interface for hosting and maintaining teeworlds servers
teerace - a website gathering results of trusted Race-mod servers providing global ranking and statistics
*gV* rox ^^

5

Re: [HELP] Including new libraries into a Teeworlds project

Use the deveopment version of bam, not version 0.4.

6 (edited by Dune 2010-08-16 21:08:38)

Re: [HELP] Including new libraries into a Teeworlds project

Sushi Tee wrote:

first be sure to copy the dll files into the teeworlds folder while compiling since the game will need it:

if family == "windows" then
    table.insert(client_depends, CopyToDirectory(".", "other\\sdl\\vc2005libs\\SDL.dll"))
    table.insert(server_depends, CopyToDirectory(".", "other\\your_stuff\\libs\\your.dll"))
end

It's not a problem with DLLs, the compilation is failing.
I'll check later if I did what you told me with the libs.

Use the deveopment version of bam, not version 0.4.

It's the last bam version... and it's working fine with the current trunk version.

Edit: No, it's still not compiling.

Not Luck, Just Magic.

7

Re: [HELP] Including new libraries into a Teeworlds project

maybe u have the wrong libs?

e.g. u cant compile a 32bit release with 64 bit libs wink

uptee - a simple web interface for hosting and maintaining teeworlds servers
teerace - a website gathering results of trusted Race-mod servers providing global ranking and statistics
*gV* rox ^^

8

Re: [HELP] Including new libraries into a Teeworlds project

.obj : error LNK2019: unresolved external symbol _irc_cmd_msg referenced
 in function "void __cdecl event_join(struct irc_session_s *,char const *,char c
onst *,char const * *,unsigned int)" (?event_join@@YAXPAUirc_session_s@@PBD1PAPB
DI@Z)

Always the same problem... I'm including the headers of the library that tells the bam those functions are existing but the bam each ends of compilation without finding the body of those functions.
And the libs are all right (I did not put the static one).

Not Luck, Just Magic.

9

Re: [HELP] Including new libraries into a Teeworlds project

hmm it looks like it loads the libs... if i remember right it would say when it cant find the libs instead of outputting such an error... u can try it by deleting the lib wink
Anyways this means that the function is not defined in the lib... so your header files doesnt fit your lib oO
If u dont need this function try deleting it from the header... im pretty sure it will not work though big_smile

btw... why didnt u use the static one? Static would be better since u dont need a .dll file afterwards wink

uptee - a simple web interface for hosting and maintaining teeworlds servers
teerace - a website gathering results of trusted Race-mod servers providing global ranking and statistics
*gV* rox ^^

10 (edited by Deleted User 2010-08-17 15:26:16)

Re: [HELP] Including new libraries into a Teeworlds project

Sushi Tee wrote:

btw... why didnt u use the static one? Static would be better since u dont need a .dll file afterwards wink

Static ones are compiler dependent and so for teeworlds not practical. I have helped Dune in the IRC and posted the solution. The libircclient.lua will may not work under linux because some values must be changed. Well, it is only a working example for Dune's problem.

11

Re: [HELP] Including new libraries into a Teeworlds project

I have similiar question. thanks for helpfull advices!

" Nobody's understand you as much as your motor bicycle "

12

Re: [HELP] Including new libraries into a Teeworlds project

Sworddragon wrote:
Sushi Tee wrote:

btw... why didnt u use the static one? Static would be better since u dont need a .dll file afterwards wink

Static ones are compiler depent and so for teeworlds not practical. I have helped Dune in the IRC and posted the solution. The libircclient.lua will may not work under linux because some values must be changed. Well, it is only a working example for Dune's problem.

Well i would prefer the lib compiled into the finaly application than have an extra libary file like an .dll or .o
And also u need for dynamic libs extra libs for win or linux...

anyways... good that the problem is solved smile

uptee - a simple web interface for hosting and maintaining teeworlds servers
teerace - a website gathering results of trusted Race-mod servers providing global ranking and statistics
*gV* rox ^^

13 (edited by Deleted User 2010-08-17 19:40:46)

Re: [HELP] Including new libraries into a Teeworlds project

Sushi Tee wrote:

And also u need for dynamic libs extra libs for win or linux...

Makes no difference to static ones because linux needs his own library in this case too (the most linux - distributions have the most important libraries already included like freetype).

For example: Independent of a static or dynamic library on windows, linux uses freetype-config. But on windows you need a static library for every potential compiler environment like Microsoft Visual Studio, MinGW and Cygwin. This makes 3 and maybe more static libraries against a dynamic library. Even the static library of one of these compiler environments is ~double so big than the dynamic one.

Well I havn't anything against static libraries but I prefer dynamic ones smile

14

Re: [HELP] Including new libraries into a Teeworlds project

yes i said "also" xD

well i didnt know that u need a static lib for every compiler... well makes sense but so where is the problem than since u only use VS for tw?

anyways... i guees this topic can be closed?

uptee - a simple web interface for hosting and maintaining teeworlds servers
teerace - a website gathering results of trusted Race-mod servers providing global ranking and statistics
*gV* rox ^^

15 (edited by Dune 2010-08-18 13:23:29)

Re: [HELP] Including new libraries into a Teeworlds project

I did not have enough time to test it (that's why I didn't answer), but thank you very much Sworddragon! smile

Edit: Still not working, I've got the same LNK errors hmm

Not Luck, Just Magic.

16 (edited by Deleted User 2010-08-18 20:27:22)

Re: [HELP] Including new libraries into a Teeworlds project

If you download the full fork from my link and compile it with the newest bam trunk do you get the errors than too? If yes, there is maybe an other problem with your environment. It works for me on Windows XP SP3 with Microsoft Visual Studio 2010.

17

Re: [HELP] Including new libraries into a Teeworlds project

No... you're not getting it.
The source code you gave me is a pure source code, which is not calling any function from that lib. It's normal there isn't any problem.
However, if you try to call one of these functions, the code will compile, but the linking will fail.

Not Luck, Just Magic.

18 (edited by Deleted User 2010-08-22 18:42:25)

Re: [HELP] Including new libraries into a Teeworlds project

Maybe the symbols are not exported in the pre-compiled binaries. Try to compile the library at your own and export the symbols. Microsoft Visual Studio 2008 uses /EXPORT for this for example /EXPORT:irc_cmd_msg.

I'm a beginner in this things and have done this only with Freetype. Maybe there are other problems with your library too.