Trouble using UnitTest

78 views
Skip to first unread message

MystX Jones

unread,
Sep 16, 2011, 7:44:40 AM9/16/11
to gwen-discuss
Hi,

I can't seem to get UnitTest to work. I'm working off the SFML sample
using SFML2 and am basically copying code from there to start with.

I get:

UnitTest* pUnit = new UnitTest( pCanvas );:
undefined reference to `UnitTest::UnitTest(Gwen::Controls::Base*)'

I feel like I'm missing a lib or something.. Here's the relevant
includes:

#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>

#include "Gwen/Renderers/SFML.h"
#include "Gwen/Input/SFML.h"

#include "Gwen/Skins/Simple.h"
#include "Gwen/Skins/TexturedBase.h"
#include "Gwen/UnitTest/UnitTest.h"

And I have libGWEN-Renderer-SFML.a, libunittest.a, and
libgwen_static.a all linked.

Any ideas what's going wrong?

MystX Jones

unread,
Sep 17, 2011, 5:01:29 AM9/17/11
to gwen-discuss
Ok so I decided to just build the SFML sample first and play with
that. However I get these errors:

==== Building Sample-SFML (release) ====
Creating obj/Release/Sample-SFML
SFML.cpp
Linking Sample-SFML
/usr/bin/ld: cannot find -lsfml-main
/usr/bin/ld: cannot find -lsfml-window-s
/usr/bin/ld: cannot find -lsfml-graphics-s
/usr/bin/ld: cannot find -lsfml-system-s
/usr/bin/ld: cannot find -lopengl32
collect2: ld returned 1 exit status
make[1]: *** [../../../bin/SFMLSample] Error 1
make: *** [Sample-SFML] Error 2

The SFML-related errors just seem to be because my libs don't have '-
s' on the end.
As for the opengl32 error, I'm on a 64bit machine. Is GWEN 32bit only?
=\

Garry Newman

unread,
Sep 17, 2011, 5:13:11 AM9/17/11
to gwen-d...@googlegroups.com
Hey sorry for the delay getting back to you.

The libraries with -d on the end are static - so don't require any extra dlls. You can just remove the -s if you want.

garry

MystX Jones

unread,
Sep 17, 2011, 5:24:01 AM9/17/11
to gwen-discuss
> The libraries with -d on the end are static
What is this in relation to? Sorry, I'm pretty bad when It comes to
libraries.

I removed the -s off all the libs but still have 2 problems building
the sample:

- sfml-main doesn't seem to exist on my system
- what do with opengl32? change it to opengl?

Garry Newman

unread,
Sep 17, 2011, 5:27:13 AM9/17/11
to gwen-d...@googlegroups.com
Sorry yeah, didn't realise you were on linux. I think you can remove sfml-main. Try opengl - not totally sure. If you let me know what works I'll update the sample so it compiles properly out of the box.

garry

MystX Jones

unread,
Sep 17, 2011, 5:32:42 AM9/17/11
to gwen-discuss
Hmm, removed opengl and sfml-main all together and got:

/Samples/SFML/SFML.cpp:51: undefined reference to
`UnitTest::UnitTest(Gwen::Controls::Base*)'

Garry Newman

unread,
Sep 17, 2011, 5:58:30 AM9/17/11
to gwen-d...@googlegroups.com
You need the unittest library too

garry

MystX Jones

unread,
Sep 17, 2011, 6:06:21 AM9/17/11
to gwen-discuss
Yep, have that too. Still the same error though.

It builds Renderer-SFML, GWEN static and UnitTest fine first and links
them.. But fails to build Sample-SFML

MystX Jones

unread,
Sep 17, 2011, 10:39:10 PM9/17/11
to gwen-discuss
Decided to flag unittest and just try to get a button of something on
my canvas.
However I'm getting this linker error now:

obj/Debug/main.o:(.rodata._ZTIN4Gwen4Skin12TexturedBaseE[typeinfo for
Gwen::Skin::TexturedBase]+0x10) undefined reference to `typeinfo for
Gwen::Skin::Base'

I saw another guy have the same problem here:
http://www.facepunch.com/threads/1048671?p=31961507&viewfull=1#post31961507

Which he apparently fixed by editing skin.h and changing all the
virtual functions. I tried the same, and got the thing to compile, but
the skin doesn't render. All I get is the button text on the canvas
background..

My GWEN related setup code is here: http://pastebin.com/xDw9BFxf


Sorry to waste so much time on this Garry, but I must be close to
getting this to work.
My code is pretty much just copied out of examples, and it doesnt
compile =(

Garry Newman

unread,
Sep 18, 2011, 2:37:08 PM9/18/11
to gwen-d...@googlegroups.com
Heya - I got the SFML sample compiling properly on Linux. I haven't actually got it to run - but I'm assuming that's because I'm running in vbox.

If you update your SVN it should just straight up compile.

garry

MystX Jones

unread,
Sep 25, 2011, 4:49:19 AM9/25/11
to gwen-discuss
Awesome, the sample compiles now =D

I'm still getting the error in my last post whenever I try to include
anything in my program. I've reduced things down and it seems to be
when I add the skin setup stuff that it occurs.
I've seen a few people on Facepunch with the same problem too =\

I'll keep trying..

On Sep 19, 7:37 am, Garry Newman <garrynew...@gmail.com> wrote:
> Heya - I got the SFML sample compiling properly on Linux. I haven't actually
> got it to run - but I'm assuming that's because I'm running in vbox.
>
> If you update your SVN it should just straight up compile.
>
> garry
>
> On Sun, Sep 18, 2011 at 3:39 AM, MystX Jones <my...@chaostheory.co.nz>wrote:
>
>
>
>
>
>
>
> > Decided to flag unittest and just try to get a button of something on
> > my canvas.
> > However I'm getting this linker error now:
>
> > obj/Debug/main.o:(.rodata._ZTIN4Gwen4Skin12TexturedBaseE[typeinfo for> Gwen::Skin::TexturedBase]+0x10)  undefined reference to `typeinfo for
> > Gwen::Skin::Base'
>
> > I saw another guy have the same problem here:
> >http://www.facepunch.com/threads/1048671?p=31961507&viewfull=1#post31...

MystX Jones

unread,
Sep 25, 2011, 5:33:54 AM9/25/11
to gwen-discuss
So I think that guy from Faceunch is on the right track..

To get my game to compile I hate to take any virtual void function in
Gwen/Skin.h that looks like:

virtual void FunctionName(<args>);

and change it to:

virtual void FunctionName(<args>) {}

Then it will COMPILE. But the unittest looks like this: http://i.imgur.com/wEEUd.png

Grrrrrr

MystX Jones

unread,
Oct 31, 2011, 10:25:30 PM10/31/11
to gwen-discuss
Nothing?
I've just tried again with the newest version of gwen, and tried
swapping all of my libs around to link in different orders but I'm
having the same problem.

I might have to threaten to bomb your house soon Garry =P
Reply all
Reply to author
Forward
0 new messages