Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Image Arrays?  (Read 3558 times)

0 Members and 2 Guests are viewing this topic.

gryzly123

  • Newbie
  • *
  • Posts: 2
    • View Profile
Image Arrays?
« on: October 07, 2012, 08:35:07 pm »
EDIT: Lol nevermind I happened to do a little more debug and found out it's not the problem with my code, but with the linkers. I deleted 75% of them and everything seems to work fine. I'm sorry for wasting the time of everybody reading this and beg for deleting this humiliation of my person ;)


First of all I'd like to say hello to everybody since this is my first post here. I started learning SFML1.6 three days ago and I've run to a problem I can't overcome.

I would like to have some buttons made from Sprites and dynamically load into them specific Images that would mark their current state.

If I understand well, I have to:
1) Create images
2) Load files to images
3) Create sprites
4) Set sprites' data (size, position etc.)
And finally I could put images to sprites freely. But...

SFML won't let me go past first point. I need the images to be one array,

Image GameLabelMark[37];

GameLabelMark[0].LoadFromFile("img/marker/mark0001.png");
GameLabelMark[1].LoadFromFile("img/marker/mark0002.png");

[...]

GameLabelMark[35].LoadFromFile("img/marker/mark0036.png");
GameLabelMark[36].LoadFromFile("img/marker/mark0037.png");
 


to be specific. But when CodeBlocks starts to compile, I get 38 random errors. The files involved in the log aren't my .cpps, but the ones from linkers (total mindrape to me).

Here's the link to the error log screenshot:
http://imageshack.us/a/img411/4144/errorlog.png

Is there something wrong with my code or are my demands from Image var-type too much?
I'm sorry if there was a thread about this and I couldn't find it or if my english is bad.
I can provide more code if needed, thanks in advance for the responds :)
« Last Edit: October 07, 2012, 08:53:52 pm by gryzly123 »

Qix

  • Full Member
  • ***
  • Posts: 139
  • I am Qix!
    • View Profile
    • Natoga Technologies
Re: Image Arrays?
« Reply #1 on: October 07, 2012, 08:50:23 pm »
Either you don't have include guards or you're including those header files twice. "Already defined" means it's defining those functions twice somewhere in your code (i.e. you're including the header files twice, thus including those function definitions twice; the compiler doesn't like that).

Make sure you're not including headers twice.

However, I would think Laurent had guards in place already O.o

I would also recommend upgrading to 2.0. The process for loading images is pretty much the same.
~ Qix
Creator of Rippl Studio
Code: [Select]
<danharibo> iostream: I don't do enough drugs to think that's a good idea.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Image Arrays?
« Reply #2 on: October 07, 2012, 08:51:38 pm »
You can't link to multiple variants of the SFML libraries (static and dynamic). You must choose one.

Quote
Either you don't have include guards or you're including those header files twice
It's a linker error, so it has nothing to do with his headers.
Laurent Gomila - SFML developer

Qix

  • Full Member
  • ***
  • Posts: 139
  • I am Qix!
    • View Profile
    • Natoga Technologies
Re: Image Arrays?
« Reply #3 on: October 07, 2012, 08:52:26 pm »
Oh derp, I read the error wrong.
~ Qix
Creator of Rippl Studio
Code: [Select]
<danharibo> iostream: I don't do enough drugs to think that's a good idea.

gryzly123

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Image Arrays?
« Reply #4 on: October 07, 2012, 08:56:00 pm »
It's a linker error, so it has nothing to do with his headers.

Yep, the admin is always right. I happened to include too much linkers in C::B. Sorry for the trouble of deleting this thread ;) Also thanks for explaining what these -d and -s variations mean :)

Qix

  • Full Member
  • ***
  • Posts: 139
  • I am Qix!
    • View Profile
    • Natoga Technologies
Re: Image Arrays?
« Reply #5 on: October 07, 2012, 11:34:03 pm »
Yep, the admin is always right.

Not always. Most of the time. And that doesn't mean the rest of the people are wrong. ;)
~ Qix
Creator of Rippl Studio
Code: [Select]
<danharibo> iostream: I don't do enough drugs to think that's a good idea.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Image Arrays?
« Reply #6 on: October 08, 2012, 08:06:52 am »
Quote
Not always.
What??!!! You're banned ;D
Laurent Gomila - SFML developer

Qix

  • Full Member
  • ***
  • Posts: 139
  • I am Qix!
    • View Profile
    • Natoga Technologies
Re: Image Arrays?
« Reply #7 on: October 08, 2012, 11:05:07 am »
Quote
Not always.
What??!!! You're banned ;D

Awh shucks :c ;)
~ Qix
Creator of Rippl Studio
Code: [Select]
<danharibo> iostream: I don't do enough drugs to think that's a good idea.

 

anything