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

Author Topic: Strange error linking statically  (Read 5539 times)

0 Members and 1 Guest are viewing this topic.

Balder

  • Newbie
  • *
  • Posts: 26
    • View Profile
Strange error linking statically
« on: October 22, 2009, 03:00:09 am »
I followed the tutorial and I got to compile the basic window program with Visual Studio Express 2008 (dynamically).

When I change the Additional Dependencys from sfml-main.lib sfml-window.lib sfml-system.lib to sfml-main.lib sfml-windows-s.lib sfml-system-s.lib I get the following compilation errors:

Error   1   error LNK2001: símbolo externo __imp___invalid_parameter_noinfo sin resolver   sfml-window-s.lib
Error   2   error LNK2019: símbolo externo __imp___invalid_parameter_noinfo sin resolver al que se hace referencia en la función "public: bool __thiscall sf::Window::GetEvent(class sf::Event &)" (?GetEvent@Window@sf@@QAE_NAAVEvent@2@@Z)   sfml-window-s.lib
Error   3   error LNK2001: símbolo externo __imp___invalid_parameter_noinfo sin resolver   sfml-window-s.lib
Error   4   error LNK2001: símbolo externo __imp___invalid_parameter_noinfo sin resolver   sfml-window-s.lib
Error   5   error LNK2001: símbolo externo __imp___invalid_parameter_noinfo sin resolver   sfml-window-s.lib
Error   6   fatal error LNK1120: 1 externos sin resolver   C:\Documents and Settings\José Antonio\Mis documentos\Visual Studio 2008\Projects\sfmlWindow\Debug\sfmlWindow.exe   1

I tried many things but still no idea why static compilation is failing!

Can anyone help?  :roll:  Just came from SDL and have no idea!

Balder

  • Newbie
  • *
  • Posts: 26
    • View Profile
Strange error linking statically
« Reply #1 on: October 22, 2009, 03:11:21 am »
Okay, just solved. It was MSVCRT being omitted what caused the application not to compile statically. (shitty warnings hahaha)

However I still have some trouble: with the configuration I depicted before when I execute the app I see a window named with strange characteres and inside lots of flashing colours. I don't think this is the "usual" behaviour of the program is it just had to create a window... (Is the basic window one on the tutorial).

Added -d to sfml-main and still having the problem... Any suggestions?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Strange error linking statically
« Reply #2 on: October 22, 2009, 08:33:23 am »
Quote
Added -d to sfml-main and still having the problem

What about adding -d to other SFML libraries? ;)
Laurent Gomila - SFML developer

Balder

  • Newbie
  • *
  • Posts: 26
    • View Profile
Strange error linking statically
« Reply #3 on: October 22, 2009, 01:06:56 pm »
Already done sorry for omitting that info...

Yeah that repaired the strange characters on the window but still the flashing colours!

Commands: sfml-main.lib sfml-window-s-d.lib sfml-system-s-d.lib

Error:



Compiled code:

Code: [Select]
#include <SFML/Window.hpp>

int main()
{
    // Create the main window
    sf::Window App(sf::VideoMode(800, 600, 32), "SFML Window");

    // Start main loop
    bool Running = true;
    while (Running)
    {
        App.Display();
    }

    return EXIT_SUCCESS;
}

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Strange error linking statically
« Reply #4 on: October 22, 2009, 02:46:19 pm »
There is no error here. You have to clear the screen (and to draw something). Read tutorials and samples to understand how sfml works.
SFML / OS X developer

Balder

  • Newbie
  • *
  • Posts: 26
    • View Profile
Strange error linking statically
« Reply #5 on: October 22, 2009, 07:20:33 pm »
Thanks for the info! I thought that code just had to show a black window but I see I'll have to study this library more in depth as it's very different from SDL. :oops:

Til now I'm enjoying SFML being so object oriented and it's great license. So thanks for the work on this library!

Also, I think this library is better organised than SDL and it gives a better perfomance in most computers.

Just improve stability an polish up. And the most important thing for it to spread: write more doc and tutorials so people knows they're using a well documented library!

See you! :D

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Strange error linking statically
« Reply #6 on: October 22, 2009, 07:35:01 pm »
Quote from: "Balder"
write more doc and tutorials so people knows they're using a well documented library!
Is something missing in the actual doc/tutorials ? (maybe "read'em all"  :P )
SFML / OS X developer

Balder

  • Newbie
  • *
  • Posts: 26
    • View Profile
Strange error linking statically
« Reply #7 on: October 22, 2009, 08:45:22 pm »
Okay, true for this topic in concrete. But what I was meaning is "great, we have tutorials for most important tasks and we have the official doc detailing the functions" even though SDL has many books and walkthrough tutorials (great book on SDL is Ernst Pazera's one). I don't have enough understanding of the library to accomplish that kind of task, but I'm sure that those kind of "follow the book to get the full project done step by step" will be very attractive. (and demagogic!) :roll:

Summing up, my discourse was not a criticism but an advice. :)

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
Strange error linking statically
« Reply #8 on: October 23, 2009, 02:21:11 am »
Aren't the tutorials already like a walkthrough? Personally I think that it's not typical for a library that the author writes tutorials for nearly every aspect of the library.

Programmers *must* be able to read and understand a documentation. SFML's documentation is superb: When you're just starting, there're tutorials. When you have the basics covered, you will find everything in the API documentation. And if you still have questions, you can ask the forum or read some SFML source code, which helps very often!

Sure, there could be walkthroughs or tutorials for writing, for example, a Tetris game. But that isn't really related to SFML, it's about game and software design in general. My opinion is that when you're able to do a Tetris in a console window, you'll have to problems doing it with SFML. ;)

Sorry when I sound like the typical RTFM guy, but in this case (SFML), you really should Read The Fine Manual. :P

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Strange error linking statically
« Reply #9 on: October 23, 2009, 05:23:37 pm »
Unrelated to here - but in general, I have got the impression, there are a lot of C++ beginners starting with SFML. Some have really bad knowledge of the programming language (but not only beginners - even people who claim to have been programmers for 25 years) and are totally overwhelmed. In this respect, I can understand that some people are confused by the tutorials. However, basic C++ knowledge should be required in order to work effieciently with a library like SFML. The people, who decide to take the "fast" way, recognize soon that they've miscalculated the situation. :)

@ Balder:
SFML is a quite young framework, whereas SDL has been existing for more than 10 years. So, just be a little bit patient, there will be books. ;)
At the moment, a book wouldn't make much sense, because the library is in steady progress. Things change all the time - before a new book is released, it's already outdated. sfml-dev.org is the most up to date source you can have.

I agree with Tank, SFML's documentation is really valuable. Especially the tutorials explain a lot of things in a clear way. Additionally, there is this forum where Laurent, the library developper himself, spends a lot of time to help the users (I don't know how often he has been answering the question how to link SFML yet). That's not to be taken for granted, either.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Balder

  • Newbie
  • *
  • Posts: 26
    • View Profile
Strange error linking statically
« Reply #10 on: October 24, 2009, 02:50:39 am »
Quote
SFML is a quite young framework, whereas SDL has been existing for more than 10 years. So, just be a little bit patient, there will be books. Wink
At the moment, a book wouldn't make much sense, because the library is in steady progress. Things change all the time - before a new book is released, it's already outdated. sfml-dev.org is the most up to date source you can have.


That's what I wanted to hear: community will keep working to spread the word and easy things to newcomers. The most people use it, the most powerfull it'll get.

Before closing the topic I have to say that I've valued a lot the admin's response and also user's opinions. I was expecting the usual "read the tutorial answer", but sometimes when you're blocked or coming from another framework you keep beating you're head against the wall. So, again, many thanks!

As I've done a few applications I see it's very easy to do things which were time consuming in SDL and also I see a great community powering the library. You've got my vote for a (I think) long time. :D

See ya!