You are not logged in.

  • Login

1

Friday, April 1st 2011, 3:32pm

SFML - Fonts Fehler. LNK2019 gleicher wie bei Sprites

Hay! Ich habe jetzt eine Font-Klasse geschrieben, damit ich kein Image nutzen muss.
Jetzt kommt wie bei den Sprites der gleiche Fehler heraus. Doch ich habe doch Pointer und Referenzen genutzt, oder?

C/C++ Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
class DLL_GRAPHIC_API Font
	{
	public:
		void Init(const string Filename, sf::Font &Font, unsigned int Size, const string ttf);
		void Color(sf::String &String, int R, int G, int B);
		void Size(sf::String &String, float Size);
		void Position(sf::String &String, float x, float y);
		void Rotation(sf::String &String, float angle);
		void ttf(sf::String &String, sf::Font &Font);
		void Text(sf::String &String, const string Text);
		void SetStyle(sf::String &String, bool bold, bool italic, bool underlined);
		void Move(sf::String &Sring, float x, float y);
		void Render(sf::String &String, sf::RenderWindow App);
 
	private:
		sf::Font *Fonts;
		sf::String *String;
	};


C/C++ Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
void lwtGraphic::Font::Init(const string Filename, sf::Font &Fonts, unsigned int Size, const string ttf)
{
	if(!Fonts.LoadFromFile(Filename, Size, ttf))
		exit (3);
}
void lwtGraphic::Font::Color(sf::String &String, int R, int G, int B)
{
	String.SetColor(sf::Color(R, G, B));
}
void lwtGraphic::Font::Size(sf::String &String, float Size)
{
	String.SetSize(Size);
}
void lwtGraphic::Font::Position(sf::String &String, float x, float y)
{
	String.SetPosition(x, y);
}
void lwtGraphic::Font::Rotation(sf::String &String, float angle)
{
	String.Rotate(angle);
}
void lwtGraphic::Font::Text(sf::String &String, const string Text)
{
	String.SetText(Text);
}
void lwtGraphic::Font::ttf(sf::String &String, sf::Font &Fonts)
{
	String.SetFont(Fonts);
}
void lwtGraphic::Font::SetStyle(sf::String &String, bool bold, bool italic, bool underlined)
{
	String.SetStyle(sf::String::Regular);
	if(bold==true)
		String.SetStyle(sf::String::Bold);
	if(italic==true)
		String.SetStyle(sf::String::Italic);
	if(underlined==true)
		String.SetStyle(sf::String::Underlined);
}
void lwtGraphic::Font::Move(sf::String &String, float x, float y)
{
	String.Move(x, y);
}
void lwtGraphic::Font::Render(sf::String &String, sf::RenderWindow App)
{
	App.Draw(String);
}


MfG
Check

2

Friday, April 1st 2011, 9:52pm

Quoted


Linkertoolfehler LNK2019:
Verweis auf nicht aufgelöstes externes Symbol 'Symbol' in Funktion 'Funktion'
unresolved external symbol 'symbol' referenced in function 'function'


Vergessen externe Bibliotheken (*.lib) richtig zu velrinken?

//Edit:
Warum definierst du noch private Membervariablen (Fonts, String) wenn du diese nicht benutzt und dazu noch gleich der Memberfunktionsparameter nennst, das kann zu unklarheit führen.
Und pass auf das du die Bezeichner in dekleration und definition gleich benennst!!!!!! ->

Quoted

void Init(const string Filename, sf::Font &Font, unsigned int Size, const string ttf);
...
void lwtGraphic::Font::Init(const string Filename, sf::Font &Fonts, unsigned int Size, const string ttf)



Mfg Rushh0ur

This post has been edited 1 times, last edit by "Rushh0ur" (Apr 1st 2011, 10:00pm)


3

Saturday, April 2nd 2011, 12:48am

Die libs waren bei Linker->Eingabe irgendwie draußen. Wundert mich nur das man es vorher frei kompilieren konnte. :D
Naja, es klappt und ich bin glücklich. :D

MfG
Check

Similar threads

Social bookmarks