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

Author Topic: Cannot draw text, linker errors in debug mode, other in rls  (Read 2728 times)

0 Members and 1 Guest are viewing this topic.

alexaz

  • Newbie
  • *
  • Posts: 4
    • View Profile
Cannot draw text, linker errors in debug mode, other in rls
« on: January 16, 2012, 02:38:31 pm »
I cannot happen to draw text in my class. I have the following function:
Code: [Select]

void CTextRenderer::Draw(sf::RenderWindow* window){
std::map<std::string, sf::Text*>::iterator it;
for(it=members.begin(); it != members.end(); it++){
window->Draw(*(it->second));
}
}

If i run this code in debug configuration, i get the following error:
Code: [Select]

CTextRenderer.obj : error LNK2001: unresolved external symbol "public: static class sf::RenderStates const sf::RenderStates::Default" (?Default@RenderStates@sf@@2V12@B)

If i run it in release configuration, i get the following:
Code: [Select]

Unhandled exception at 0x59e04412 in SpaceCraft.exe: 0xC0000005: Access violation reading location 0x00000004.

I'v been banging my head against this and can't figure out what's the problem.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Cannot draw text, linker errors in debug mode, other in rls
« Reply #1 on: January 16, 2012, 02:49:39 pm »
Please make sure that your problem is not one of these:
http://www.sfml-dev.org/forum/viewtopic.php?p=36365#36365

And then read this carefully and give more details:
http://www.sfml-dev.org/forum/viewtopic.php?p=36367#36367
Laurent Gomila - SFML developer

alexaz

  • Newbie
  • *
  • Posts: 4
    • View Profile
Cannot draw text, linker errors in debug mode, other in rls
« Reply #2 on: January 16, 2012, 03:06:01 pm »
The graphics card and OS are Asus GTX470 and Windows 7, but i don't think thats relevant. I'm using the latest static sfml 2.0. I'm not showing all the relevant code, but i think that might be the problem ( sorry ). If i call the CTextRenderer::Draw from main, it will work, however if i call it from another class' instance, the following will happen.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Cannot draw text, linker errors in debug mode, other in rls
« Reply #3 on: January 16, 2012, 03:18:46 pm »
Quote
I'm using the latest static sfml 2.0

Have you defined SFML_STATIC in your preprocessor options?

Quote
I'm not showing all the relevant code, but i think that might be the problem ( sorry ). If i call the CTextRenderer::Draw from main, it will work, however if i call it from another class' instance, the following will happen.

So it seems like we'll need a complete and minimal code that reproduces the problem ;)
http://www.sfml-dev.org/forum/viewtopic.php?p=36368#36368
Laurent Gomila - SFML developer