Jump to content

  • Log In with Google      Sign In   
  • Create Account


Help with SFML


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
7 replies to this topic

#1 lja   Members   -  Reputation: 103

Like
0Likes
Like

Posted 23 May 2013 - 07:09 AM

Hi,

 

I'm currently trying to learn how to use the CSFML 2.0 in VS 2010, but I'm getting a lot of warnings and errors that I really don't understand. For example, one error I get is an undeclared identifier, yet I've declared that particular variable at the top of the file.

 

I've been using this http://perso.epitech.eu/~rozo_a/CSFML/doc/html/ to help me learn how to use CSFML, but I think that this tutorial is for the older 1.6 version.

 

I've attached both the source code and the error list. 

 

I'm probably doing something really stupid wacko.png

 

Thanks for any help!

Attached Files



Sponsor:

#2 JTippetts   Moderators   -  Reputation: 8264

Like
1Likes
Like

Posted 23 May 2013 - 07:28 AM

Everywhere that you have things like sfRenderWindow, you need to add the double colon namespace indirection operator, ie sf::RenderWindow. sf denotes the namespace that everything lives in, and should not just be prefixed to the identifier like that.

 

Edit: Eh, forget that. Didn't realize there even was a C port of SFML until this very instant...


Edited by JTippetts, 23 May 2013 - 07:29 AM.


#3 Grimshaw   Members   -  Reputation: 619

Like
0Likes
Like

Posted 23 May 2013 - 07:41 AM

sfVideoMode mode = {800, 600, 32};

 

Are you sure you can do that in C? I never used CSFML but its weird if sfVideoMode is implemented as a raw array.


Indie Game Developer - Daeva Theory Studios

 

Twitter - Facebook

 

Next

Terra - rise of mankind

 

Previous

SFML Game Development (Book)


#4 lja   Members   -  Reputation: 103

Like
0Likes
Like

Posted 23 May 2013 - 07:59 AM

sfVideoMode mode = {800, 600, 32};

 

Are you sure you can do that in C? I never used CSFML but its weird if sfVideoMode is implemented as a raw array.

 

I'm not sure, that's how it is done on that tutorial page but then again I've followed that and it doesn't work. I'm not sure how else you set the resolution and depth.



#5 Brother Bob   Moderators   -  Reputation: 7923

Like
2Likes
Like

Posted 23 May 2013 - 08:03 AM

sfVideoMode mode = {800, 600, 32};

 

Are you sure you can do that in C? I never used CSFML but its weird if sfVideoMode is implemented as a raw array.

 

I'm not sure, that's how it is done on that tutorial page but then again I've followed that and it doesn't work. I'm not sure how else you set the resolution and depth.

sfVideoMode is a structure, and that is simply the way you initialize the fields of a structure. It's perfectly fine.



#6 lja   Members   -  Reputation: 103

Like
0Likes
Like

Posted 23 May 2013 - 08:58 AM

So what is causing the undeclared variable error?



#7 Brother Bob   Moderators   -  Reputation: 7923

Like
2Likes
Like

Posted 23 May 2013 - 09:04 AM

In C, you must define your variables at the beginning of a scope before any other code. Your main function has a call to the puts-function, and you must define all your variables before that point.



#8 lja   Members   -  Reputation: 103

Like
0Likes
Like

Posted 23 May 2013 - 09:15 AM

In C, you must define your variables at the beginning of a scope before any other code. Your main function has a call to the puts-function, and you must define all your variables before that point.

 

Oops! Thank you for pointing that out!






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS