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

Author Topic: Can't find how to include the "lib" and "incl  (Read 9943 times)

0 Members and 1 Guest are viewing this topic.

Engborg

  • Newbie
  • *
  • Posts: 17
    • View Profile
Can't find how to include the "lib" and "incl
« on: January 02, 2011, 12:56:26 am »
Can't find how to include the "lib" and "include" in Visual C++ 2010 express.
Really want to start learning this so would appreciate some help.

Thanks in advance!

Walker

  • Full Member
  • ***
  • Posts: 181
    • View Profile
Can't find how to include the "lib" and "incl
« Reply #1 on: January 02, 2011, 07:37:34 am »
I'm not really sure what the problem is. Are you having trouble because VC++ Directories has moved? The simplest way to work around this is to use the project's configuration - Project>Properties>VC++ Directories. Then it's the same as the set up tutorial, but you will have to do it with every project you create.

Personally I prefer to put libs and headers in the compilers standard path/s - This is also covered in the setup tutorial and is similar enough to use regardless of your VC++ version.

Engborg

  • Newbie
  • *
  • Posts: 17
    • View Profile
Can't find how to include the "lib" and "incl
« Reply #2 on: January 02, 2011, 02:42:08 pm »
I think i got thoose to work but now when i compile i get a butt load of "error LNK2019: unresolved external symbol...".

Thx for your reply btw!

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
Can't find how to include the "lib" and "incl
« Reply #3 on: January 02, 2011, 02:48:34 pm »
Look at the tutorial its all written there.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Engborg

  • Newbie
  • *
  • Posts: 17
    • View Profile
Can't find how to include the "lib" and "incl
« Reply #4 on: January 02, 2011, 03:07:22 pm »
I've donw the tutorial several times, and watch others on you tube but nothing seems to work..
just keep getting the "error LNK2019: unresolved external symbol..." error.

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
Can't find how to include the "lib" and "incl
« Reply #5 on: January 02, 2011, 03:27:07 pm »
Really? Also defined that you use dynamic library? If you are using SFML2 then you have to do the same with static. I might be wrong in the order though...
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Engborg

  • Newbie
  • *
  • Posts: 17
    • View Profile
Can't find how to include the "lib" and "incl
« Reply #6 on: January 02, 2011, 03:30:11 pm »
I'm using the 1.6 version. Yes i have defined that i'm using the "SFML_DYNAMIC".

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
Can't find how to include the "lib" and "incl
« Reply #7 on: January 02, 2011, 03:31:16 pm »
What is the unresolved symbol then?
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Can't find how to include the "lib" and "incl
« Reply #8 on: January 02, 2011, 03:31:24 pm »
Please give detailed information: which libraries did you link, in which order, what unresolved symbols do you have, etc. ;)
Laurent Gomila - SFML developer

Engborg

  • Newbie
  • *
  • Posts: 17
    • View Profile
Can't find how to include the "lib" and "incl
« Reply #9 on: January 02, 2011, 03:50:31 pm »
i have theese linked : "sfml-system-s-d.lib;sfml-graphics-d.lib;sfml-window-d.lib"


here's the errors:
Code: [Select]
1>  main.cpp
1>main.obj : error LNK2019: unresolved external symbol __imp__glEnd@0 referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol __imp__glVertex3f@12 referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol __imp__glBegin@4 referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol __imp__glRotatef@16 referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: float __thiscall sf::Clock::GetElapsedTime(void)const " (__imp_?GetElapsedTime@Clock@sf@@QBEMXZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol __imp__glTranslatef@12 referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol __imp__glClear@4 referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol __imp__glViewport@16 referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol _gluPerspective@32 referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol __imp__glLoadIdentity@0 referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol __imp__glMatrixMode@4 referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol __imp__glDepthMask@4 referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol __imp__glEnable@4 referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol __imp__glClearColor@16 referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol __imp__glClearDepth@8 referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Clock::Clock(void)" (__imp_??0Clock@sf@@QAE@XZ) referenced in function _main


and here's the code i'm trying to compile:
Code: [Select]

////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Window.hpp>


////////////////////////////////////////////////////////////
/// Entry point of application
///
/// \return Application exit code
///
////////////////////////////////////////////////////////////
int main()
{
    // Create the main window
    sf::Window App(sf::VideoMode(800, 600, 32), "SFML OpenGL");

    // Create a clock for measuring time elapsed
    sf::Clock Clock;

    // Set color and depth clear value
    glClearDepth(1.f);
    glClearColor(0.f, 0.f, 0.f, 0.f);

    // Enable Z-buffer read and write
    glEnable(GL_DEPTH_TEST);
    glDepthMask(GL_TRUE);

    // Setup a perspective projection
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    gluPerspective(90.f, 1.f, 1.f, 500.f);

    // 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();

            // Escape key : exit
            if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
                App.Close();

            // Resize event : adjust viewport
            if (Event.Type == sf::Event::Resized)
                glViewport(0, 0, Event.Size.Width, Event.Size.Height);
        }

        // Set the active window before using OpenGL commands
        // It's useless here because active window is always the same,
        // but don't forget it if you use multiple windows or controls
        App.SetActive();

        // Clear color and depth buffer
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

        // Apply some transformations
        glMatrixMode(GL_MODELVIEW);
        glLoadIdentity();
        glTranslatef(0.f, 0.f, -200.f);
        glRotatef(Clock.GetElapsedTime() * 50, 1.f, 0.f, 0.f);
        glRotatef(Clock.GetElapsedTime() * 30, 0.f, 1.f, 0.f);
        glRotatef(Clock.GetElapsedTime() * 90, 0.f, 0.f, 1.f);

        // Draw a cube
        glBegin(GL_QUADS);

            glVertex3f(-50.f, -50.f, -50.f);
            glVertex3f(-50.f,  50.f, -50.f);
            glVertex3f( 50.f,  50.f, -50.f);
            glVertex3f( 50.f, -50.f, -50.f);

            glVertex3f(-50.f, -50.f, 50.f);
            glVertex3f(-50.f,  50.f, 50.f);
            glVertex3f( 50.f,  50.f, 50.f);
            glVertex3f( 50.f, -50.f, 50.f);

            glVertex3f(-50.f, -50.f, -50.f);
            glVertex3f(-50.f,  50.f, -50.f);
            glVertex3f(-50.f,  50.f,  50.f);
            glVertex3f(-50.f, -50.f,  50.f);

            glVertex3f(50.f, -50.f, -50.f);
            glVertex3f(50.f,  50.f, -50.f);
            glVertex3f(50.f,  50.f,  50.f);
            glVertex3f(50.f, -50.f,  50.f);

            glVertex3f(-50.f, -50.f,  50.f);
            glVertex3f(-50.f, -50.f, -50.f);
            glVertex3f( 50.f, -50.f, -50.f);
            glVertex3f( 50.f, -50.f,  50.f);

            glVertex3f(-50.f, 50.f,  50.f);
            glVertex3f(-50.f, 50.f, -50.f);
            glVertex3f( 50.f, 50.f, -50.f);
            glVertex3f( 50.f, 50.f,  50.f);

        glEnd();

        // Finally, display rendered frame on screen
        App.Display();
    }

    return EXIT_SUCCESS;
}


hope that helps you to help me! (;

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
Can't find how to include the "lib" and "incl
« Reply #10 on: January 02, 2011, 03:55:52 pm »
You can't link the system statically and not the others. That system library still get's the SFML_DYNAMIC define and prepares the headers for a dynamic library.

If you want it like that then you'll have to make some workaround with the preprocessor.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Engborg

  • Newbie
  • *
  • Posts: 17
    • View Profile
Can't find how to include the "lib" and "incl
« Reply #11 on: January 02, 2011, 04:07:37 pm »
I've fixed that now but i still get the same error.
The reason i had it that way was from some youtube tutorial i saw.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Can't find how to include the "lib" and "incl
« Reply #12 on: January 02, 2011, 04:08:12 pm »
You must link the same variant of all libraries (-s, -s-d, -d, or no suffix).

Then, this code uses OpenGL so you need to link it as well (opengl32.lib).
Laurent Gomila - SFML developer

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
Can't find how to include the "lib" and "incl
« Reply #13 on: January 02, 2011, 04:10:38 pm »
I thought SFML included that for you?
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Engborg

  • Newbie
  • *
  • Posts: 17
    • View Profile
Can't find how to include the "lib" and "incl
« Reply #14 on: January 02, 2011, 04:12:22 pm »
I've included that lib now too and it took away most of the errors!
Now I only get:
"1>main.obj : error LNK2019: unresolved external symbol _gluPerspective@32 referenced in function _main"

 

anything