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

Author Topic: [SOLVED] help compilation  (Read 9974 times)

0 Members and 1 Guest are viewing this topic.

Ramboofp

  • Newbie
  • *
  • Posts: 9
    • View Profile
[SOLVED] help compilation
« on: August 10, 2007, 08:54:46 pm »
I can t compil under Visual 2008 :(
 
Errors:
Quote
------ Build started: Project: SFMLTEST, Configuration: Debug Win32 ------
Compiling...
SFMLTEST.cpp
Linking...
sfml-system.lib(Clock.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/LTCG' specification
LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
SFMLTEST.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall sfWindow::~sfWindow(void)" (??1sfWindow@@UAE@XZ)
SFMLTEST.obj : error LNK2001: unresolved external symbol "public: void __thiscall sfWindow::Display(void)" (?Display@sfWindow@@QAEXXZ)
SFMLTEST.obj : error LNK2001: unresolved external symbol "public: bool __thiscall sfWindow::SetCurrent(void)const " (?SetCurrent@sfWindow@@QBE_NXZ)
SFMLTEST.obj : error LNK2001: unresolved external symbol "public: bool __thiscall sfWindow::GetEvent(class sfEvent &)" (?GetEvent@sfWindow@@QAE_NAAVsfEvent@@@Z)
SFMLTEST.obj : error LNK2001: unresolved external symbol "public: __thiscall sfWindow::sfWindow(class sfVideoMode,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,bool)" (??0sfWindow@@QAE@VsfVideoMode@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@_N@Z)
SFMLTEST.obj : error LNK2001: unresolved external symbol "public: __thiscall sfVideoMode::sfVideoMode(unsigned int,unsigned int,unsigned int)" (??0sfVideoMode@@QAE@III@Z)
C:\Documents and Settings\Admin\Mes documents\Visual Studio 2008\Projects\SFMLTEST\Debug\SFMLTEST.exe : fatal error LNK1120: 6 unresolved externals
Build log was saved at "file://c:\Documents and Settings\Admin\Mes documents\Visual Studio 2008\Projects\SFMLTEST\SFMLTEST\Debug\BuildLog.htm"
SFMLTEST - 7 error(s), 2 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Code:
Code: [Select]
#include <stdafx.h>
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Window.hpp>
#include <GL/gl.h>
#include <GL/glu.h>


////////////////////////////////////////////////////////////
/// Entry point of application
///
/// \return Application exit code
///
////////////////////////////////////////////////////////////
int main()
{
    // Create the main window
    sfWindow App(sfVideoMode(800, 600, 32), "SFML OpenGL", false);

    // Create a clock for measuring time elapsed
    sfClock 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
    bool Running = true;
    while (Running)
    {
        // Process events
        sfEvent Event;
        while (App.GetEvent(Event))
        {
            // Close window : exit
            if (Event.Type == sfEvent::Close)
                Running = false;

            // Escape key : exit
            if ((Event.Type == sfEvent::KeyPressed) && (Event.Key.Code == sfKey::Escape))
                Running = false;

            // Resize event : adjust viewport
            if (Event.Type == sfEvent::Resize)
                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.SetCurrent();

        // 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;
}

in linker->input i puted sfml-system.lib opengl32.lib glu32.lib

EDIT:Solved by put sfml-main.lib sfml-window.lib sfml-system.lib opengl32.lib glu32.lib

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
[SOLVED] help compilation
« Reply #1 on: August 11, 2007, 09:30:09 am »
Welcome to the SFML forum :)

sfml-main.lib is needed if you create a "Win32 application" project ; it allows you to have a standard main() instead of the non-portable WinMain().

sfml-window.lib is needed because you are using the window package ;)
The rule is simple : if you include <SFML/xxx.hpp> then you need sfml-xxx.lib (and the libs it depends on -- for example sfml-window depends on sfml-system).
Laurent Gomila - SFML developer

 

anything