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

Author Topic: Basic error  (Read 11032 times)

0 Members and 1 Guest are viewing this topic.

Kyle

  • Newbie
  • *
  • Posts: 13
    • MSN Messenger - kylemotherwell@hotmail.com
    • View Profile
Basic error
« on: September 29, 2009, 07:02:13 pm »
When following the first window tutorials i encountered this error

1>SFML program.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall sf::Window::~Window(void)" (__imp_??1Window@sf@@UAE@XZ) referenced in function _main
1>SFML program.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Window::Display(void)" (__imp_?Display@Window@sf@@QAEXXZ) referenced in function _main
1>SFML program.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Window::Window(class sf::VideoMode,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned long,struct sf::WindowSettings const &)" (__imp_??0Window@sf@@QAE@VVideoMode@1@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@KABUWindowSettings@1@@Z) referenced in function _main
1>SFML program.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::VideoMode::VideoMode(unsigned int,unsigned int,unsigned int)" (__imp_??0VideoMode@sf@@QAE@III@Z) referenced in function _main
1>C:\Documents and Settings\Kairu\Desktop\VC++ misc\cube\SFML program\Debug\SFML program.exe : fatal error LNK1120: 4 unresolved externals

Any ideas?
Maybe you're just sitting around, reading "Guns and Ammo", masturbating in your own feces, do you just stop and go, "Wow! It is amazing how fucking crazy I really am!"?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Basic error
« Reply #1 on: September 29, 2009, 07:19:34 pm »
You have to link to sfml-window.lib.
Laurent Gomila - SFML developer

Kyle

  • Newbie
  • *
  • Posts: 13
    • MSN Messenger - kylemotherwell@hotmail.com
    • View Profile
Basic error
« Reply #2 on: September 29, 2009, 07:34:22 pm »
Ah thank you :)
Maybe you're just sitting around, reading "Guns and Ammo", masturbating in your own feces, do you just stop and go, "Wow! It is amazing how fucking crazy I really am!"?

Kyle

  • Newbie
  • *
  • Posts: 13
    • MSN Messenger - kylemotherwell@hotmail.com
    • View Profile
Basic error
« Reply #3 on: September 29, 2009, 08:35:12 pm »
I got more errors, i think i have not followed the instructions correctly xD

Quote
1>SFML program.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall sf::RenderWindow::~RenderWindow(void)" (__imp_??1RenderWindow@sf@@UAE@XZ) referenced in function _main
1>SFML program.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::RenderTarget::Clear(class sf::Color const &)" (__imp_?Clear@RenderTarget@sf@@QAEXABVColor@2@@Z) referenced in function _main
1>SFML program.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Color::Color(unsigned char,unsigned char,unsigned char,unsigned char)" (__imp_??0Color@sf@@QAE@EEEE@Z) referenced in function _main
1>SFML program.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::RenderWindow::RenderWindow(class sf::VideoMode,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned long,struct sf::WindowSettings const &)" (__imp_??0RenderWindow@sf@@QAE@VVideoMode@1@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@KABUWindowSettings@1@@Z) referenced in function _main
1>C:\Documents and Settings\Kairu\Desktop\VC++ misc\cube\SFML program\Debug\SFML program.exe : fatal error LNK1120: 4 unresolved externals


Here is code:

Code: [Select]
#include "stdafx.h"
#include <SFML/System.hpp>

#include <iostream>
#include <SFML/Graphics.hpp>

using namespace sf;
using namespace std;
int main()
{
    // Create the main rendering window
sf::RenderWindow App(sf::VideoMode(800, 600, 32), "SFML Graphics");
   
    // Start game loop
    while (App.IsOpened())
    {
        // Process events
        sf::Event Event;
        while (App.GetEvent(Event))
        {
            // Close window : exit
            if (Event.Type == sf::Event::Closed)
                App.Close();
        }

        // Clear the screen (fill it with black color)
        App.Clear();

        // Display window contents on screen
        App.Display();
    }

    return EXIT_SUCCESS;
}
Maybe you're just sitting around, reading "Guns and Ammo", masturbating in your own feces, do you just stop and go, "Wow! It is amazing how fucking crazy I really am!"?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Basic error
« Reply #4 on: September 29, 2009, 09:21:18 pm »
You haven't linked to sfml-graphics.lib.

The rule is simple: if you include <SFML/Xxx.hpp> then you have to link to sfml-xxx.lib. SFML is split into modules, you have to adjust the compiler/linker options for each module that you use.
Laurent Gomila - SFML developer

Kyle

  • Newbie
  • *
  • Posts: 13
    • MSN Messenger - kylemotherwell@hotmail.com
    • View Profile
Basic error
« Reply #5 on: September 29, 2009, 09:26:14 pm »
First-chance exception at 0x43003d00 in SFML program.exe: 0xC0000005: Access violation reading location 0x43003d00.
A buffer overrun has occurred in SFML program.exe which has corrupted the program's internal state. Press Break to debug the program or Continue to terminate the program.

For more details please see Help topic 'How to debug Buffer Overrun Issues'.


it points to this piece of code:
  App.Clear(sf::Color(200, 0, 0));
Maybe you're just sitting around, reading "Guns and Ammo", masturbating in your own feces, do you just stop and go, "Wow! It is amazing how fucking crazy I really am!"?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Basic error
« Reply #6 on: September 29, 2009, 09:27:45 pm »
Link to the debug libraries (suffix "-d") when you compile in debug mode.

Hey, this one is written in the tutorials ;)
Laurent Gomila - SFML developer

Kyle

  • Newbie
  • *
  • Posts: 13
    • MSN Messenger - kylemotherwell@hotmail.com
    • View Profile
Basic error
« Reply #7 on: September 29, 2009, 09:35:21 pm »
Sorry, but your tutorials are very good but sometimes i become a bit confused, Is there some were i can look up more on Events?
Maybe you're just sitting around, reading "Guns and Ammo", masturbating in your own feces, do you just stop and go, "Wow! It is amazing how fucking crazy I really am!"?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Basic error
« Reply #8 on: September 29, 2009, 09:42:30 pm »
Quote
Sorry, but your tutorials are very good but sometimes i become a bit confused

That's why this piece of information is written in the "getting started tutorial", with the word "important" in bold/blue font to start the paragraph.

Quote
Is there some were i can look up more on Events?

In the "Handling events" tutorial :roll:
And in the API documentation, of course.
Laurent Gomila - SFML developer

Kyle

  • Newbie
  • *
  • Posts: 13
    • MSN Messenger - kylemotherwell@hotmail.com
    • View Profile
Basic error
« Reply #9 on: September 29, 2009, 09:48:57 pm »
Microsoft Visual Studio C Runtime Library has detected a fatal error in SFML program.exe.

Press Break to debug the program or Continue to terminate the program.
Maybe you're just sitting around, reading "Guns and Ammo", masturbating in your own feces, do you just stop and go, "Wow! It is amazing how fucking crazy I really am!"?

Kyle

  • Newbie
  • *
  • Posts: 13
    • MSN Messenger - kylemotherwell@hotmail.com
    • View Profile
Basic error
« Reply #10 on: September 29, 2009, 10:19:15 pm »
Is it another obvious reason it is not working that i am missing xD
Maybe you're just sitting around, reading "Guns and Ammo", masturbating in your own feces, do you just stop and go, "Wow! It is amazing how fucking crazy I really am!"?

phear-

  • Jr. Member
  • **
  • Posts: 64
    • MSN Messenger - LOApokalypse@hotmail.com
    • View Profile
    • http://gtproductions.org
Basic error
« Reply #11 on: September 29, 2009, 10:24:55 pm »
Do you even know C++? If not I would highly recommend you read some books or tutorials on it.
Eugene Alfonso
GTP | Twitter

Kyle

  • Newbie
  • *
  • Posts: 13
    • MSN Messenger - kylemotherwell@hotmail.com
    • View Profile
Basic error
« Reply #12 on: September 29, 2009, 10:27:46 pm »
Ok now, i can see where this is going, yes i do.
Maybe you're just sitting around, reading "Guns and Ammo", masturbating in your own feces, do you just stop and go, "Wow! It is amazing how fucking crazy I really am!"?

phear-

  • Jr. Member
  • **
  • Posts: 64
    • MSN Messenger - LOApokalypse@hotmail.com
    • View Profile
    • http://gtproductions.org
Basic error
« Reply #13 on: September 29, 2009, 10:37:39 pm »
The reason I ask is because you use:

Code: [Select]

using namespace sf;


but then later on in your code you use
Code: [Select]

sf::
Eugene Alfonso
GTP | Twitter

Kyle

  • Newbie
  • *
  • Posts: 13
    • MSN Messenger - kylemotherwell@hotmail.com
    • View Profile
Basic error
« Reply #14 on: September 29, 2009, 10:40:40 pm »
Yea, i was wondering if i was not understanding correctly, and i was told why it was like that.

Why does the error i have now point to this line?

while (App.GetEvent(Event))

EDIT:
oh sorry i thought you were referring to one of my earlier topics, no i do that because i was testing something  and forgot to remove it xD
Maybe you're just sitting around, reading "Guns and Ammo", masturbating in your own feces, do you just stop and go, "Wow! It is amazing how fucking crazy I really am!"?