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

Author Topic: Visual Studio 2010 Can't Link!!!  (Read 2287 times)

0 Members and 1 Guest are viewing this topic.

Ciphermind

  • Newbie
  • *
  • Posts: 2
    • View Profile
Visual Studio 2010 Can't Link!!!
« on: March 22, 2011, 10:02:59 pm »
I am having incredible difficulty getting the linkers set up.  I normally use devc++ and decided to switch to VC, but the tutorial on this site shows how libraries are linked in 2008, whereas I'm using 2010.

I have no idea what to configure where.  Please help me D:

My code
Code: [Select]
#include <iostream>
#include <iomanip>
#include <SFML/Audio.hpp>

void PlaySound()
{
 
    sf::SoundBuffer Buffer;
    if (!Buffer.LoadFromFile("blueschip.mp3"))
        return;

    sf::Sound Sound(Buffer);
    Sound.Play();

    while (Sound.GetStatus() == sf::Sound::Playing)
{
        sf::Sleep(0.1f);

   
        std::cout << "\rPlaying";
    }
}

int main()
{
PlaySound();
std::cout << "Press enter to exit...";
std::cin.ignore(10000, '\n');
return 0;
}


My error message:

Code: [Select]
1>------ Build started: Project: game, Configuration: Debug Win32 ------
1>Build started 3/22/2011 4:48:18 PM.
1>InitializeBuildStatus:
1>  Touching "Debug\game.unsuccessfulbuild".
1>ManifestResourceCompile:
1>  All outputs are up-to-date.
1>LINK : error LNK2001: unresolved external symbol _WinMainCRTStartup
1>c:\users\mike\documents\visual studio 2010\Projects\game\Debug\game.exe : fatal error LNK1120: 1 unresolved externals
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.14
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Visual Studio 2010 Can't Link!!!
« Reply #1 on: March 22, 2011, 11:07:08 pm »
You should link to sfml-main(-d), unless you declare a WinAPI style main() function.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

inlinevoid

  • Newbie
  • *
  • Posts: 49
    • MSN Messenger - inlinevoidmain@gmail.com
    • AOL Instant Messenger - inlinevoid
    • View Profile
    • Email
Visual Studio 2010 Can't Link!!!
« Reply #2 on: March 23, 2011, 12:31:24 am »
If I'm correct, SFML1.6 doesn't work with VS2010.

If you really want to use SFML with VS2010 you'll have to download SFML2.0 and build the SFML libs/dlls yourself with Cmake.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Visual Studio 2010 Can't Link!!!
« Reply #3 on: March 23, 2011, 07:48:05 am »
SFML works with VC2010, but must be recompiled as there's no pre-compiled release for this compiler.
Laurent Gomila - SFML developer

 

anything