I'm trying to create a Static Library (.a) based on SFML with Code::Blocks. I've created a simple library to test, but even that isn't working.
Here is the code of the library:
// File Test.h
#ifndef TEST_H
#define TEST_H
class Test
{
public:
Test( );
void Function( );
};
#endif
// File Test.cpp
#include <iostream>
#include <SFML/System.hpp>
#include "Test.h"
Test::Test( )
{
std::cout << "Test::Test( ) " << sf::Randomizer::Random( 0, 10 ) << std::endl;
}
void Test::Function( )
{
std::cout << "Test::Function( ) " << sf::Randomizer::Random( 50, 100 ) << std::endl;
}
I then add libsfml-system-s.a into the library using ar.
ar x libsfml-system-s.a
ar rs libStaticSFMLTest.a *.o
I'm pretty sure it works, since the file size of the library increases, after adding SFML System.
When I try to compile a project using the new library, I get linker errors:
C:\Documents and Settings\Eternal Warrior\My Documents\CodeBlocksProjects\StaticSFMLTest\libStaticSFMLTest.a(Test.o):Test.cpp:(.text+0x2f)||undefined reference to `sf::Randomizer::Random(int, int)'|
I'm sure I'm doing something wrong, but I can't figure out what. Any help is appreciated.