'Undefined Reference To' errors with static library

This is a very confusing issue for me. I've been learning to use SDL2 and I was unhappy with its GUI support, so I reached out to find another library to help me. I found guichan, which has SDL2 support but is outdated. This lead me to guisan ( https://github.com/kallisti5/guisan ) which is just a more updated version of guichan.

There is little documentation on setting up guisan (none), I assume most is to be implied. However, I've never done a thing as such and cannot figure out the problem. I've been searching for over three weeks, googling and spending hours a day working- I even tried to contact the developer of guisan with no response.

I'm using Code::Blocks on Windows 7, and what I've done is taken the guisan files (include folder and src folder) and made a Static Library project in C::B, built it into the libguisan.a file and put that in my linker settings (spending over an hour using different combinations of linker settings). No matter what I do, I get 'undefined reference to *' errors, shown below. I've been hesitant to post because there are lots of other people with this issue, however I still haven't managed to solve it.

The guisan github lists scons as a build requirement (guisan includes SConstruct and SConscript files), which I've gotten and tried to use- gives me different errors, also shown below.

Code::Blocks errors, given when trying to compile the example SDL program included with guisan:


||=== Build: Release in guisan (compiler: GNU GCC Compiler) ===|
obj\Release\main.o:main.cpp|| undefined reference to `_imp___ZTVN3gcn14SDLImageLoaderE'|
obj\Release\main.o:main.cpp|| undefined reference to `_imp___ZN3gcn5Image14setImageLoaderEPNS_11ImageLoaderE'|
obj\Release\main.o:main.cpp|| undefined reference to `_imp___ZN3gcn11SDLGraphicsC1Ev'|
obj\Release\main.o:main.cpp|| undefined reference to `_imp___ZN3gcn8SDLInputC1Ev'|
obj\Release\main.o:main.cpp|| undefined reference to `_imp___ZN3gcn9ContainerC1Ev'|
obj\Release\main.o:main.cpp|| undefined reference to `_imp___ZN3gcn9RectangleC1Eiiii'|
obj\Release\main.o:main.cpp|| undefined reference to `_imp___ZN3gcn6Widget12setDimensionERKNS_9RectangleE'|
obj\Release\main.o:main.cpp|| undefined reference to `_imp___ZN3gcn3GuiC1Ev'|
obj\Release\main.o:main.cpp|| undefined reference to `_imp___ZN3gcn9ImageFontC1ERKSsS2_'|
obj\Release\main.o:main.cpp|| undefined reference to `_imp___ZN3gcn6Widget13setGlobalFontEPNS_4FontE'|
obj\Release\main.o:main.cpp|| undefined reference to `_imp___ZN3gcn5LabelC1ERKSs'|
obj\Release\main.o:main.cpp|| undefined reference to `_imp___ZN3gcn6Widget11setPositionEii'|
obj\Release\main.o:main.cpp|| undefined reference to `_imp___ZNK3gcn9Exception10getMessageEv'|
obj\Release\main.o:main.cpp:(.text$_ZN3gcn11ImageLoaderD1Ev[__ZN3gcn11ImageLoaderD1Ev]+0xfffff131)||undefined reference to `_imp___ZTVN3gcn11ImageLoaderE'|
||=== Build failed: 14 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|


Console error output given by scons when trying to run it in a folder containing guisan's 'include' and 'src' directories, as well as the 'SConstruct' file:


Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\guisan-master>scons.py
scons: Reading SConscript files ...
Checking for pkg-config... yes
Checking for gl... no
Checking for sdl2... no
=========================================
 Guisan build

 SDL 2.0 support.............. 0
 OpenGL support............... 0
-----------------------------------------
 Installation target

 Prefix....................... /usr/local
 Includes..................... /usr/local/include
 Libraries.................... /usr/local/lib

=========================================
KeyError: 'LIBS':
  File "C:\guisan-master\SConstruct", line 51:
    SConscript('src/SConscript')
  File "C:\guisan-master\scons-local-2.3.4\SCons\Script\SConscript.py", line 614
:
    return method(*args, **kw)
  File "C:\guisan-master\scons-local-2.3.4\SCons\Script\SConscript.py", line 551
:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\guisan-master\scons-local-2.3.4\SCons\Script\SConscript.py", line 260
:
    exec _file_ in call_stack[-1].globals
  File "C:\guisan-master\src\SConscript", line 117:
    for lib in guisan["LIBS"]:
  File "C:\guisan-master\scons-local-2.3.4\SCons\Environment.py", line 413:
    return self._dict[key]

C:\guisan-master>
Last edited on
It may also be important to note I'm using GNU version 4.8.1-4.
Topic archived. No new replies allowed.