Class type redefinition problem

Pages: 123
and when I tried to install the 2008 version, it would only work with 2008


I find that very surprising, and almost don't believe it. =o
Yeah, I checked youtube. They didn't do it the same way I installed Allegro. According to youtube It should say "open with..." and "Visual Studio 2010" when you right click it after download. It doesn't on mine. It only says "Open" and it opens with 2008. And the 2008-version doesn't work on my computer anymore for an unknown reason.

Maybe I should try and install it "the Allegro way"...

Edit: That didn't work either. I try to include the lib folder of SFML in the VC++ directory but there aren't any files in there... GAAAAAAAAAAAAARRRRRRRRRRRRRGGGGGGGGGGGHG!!!!!!!!!!!!!!!!!!! I'm really mad, right now...

Edit 2: I now see that there aren't any files in the SFML folder at all. They're there when I look in the explorer but not when I try to include them in VC++...
Last edited on
According to youtube It should say "open with..." and "Visual Studio 2010" when you right click it after download


wait... what?

Just follow these steps:

http://sfml-dev.org/tutorials/1.6/start-vc.php
I've tried that too. VC doesn't find my files.
If VC isnt' finding your files, then you're not putting them in the right spot (or you're not telling VC where to find them).

Let's start simple... when you downloaded the .zip file it had a lib and include folder in it. Where did you put those folders?
I remember now that I maybe have to extract them first?

I copied those files and pasted them in VCs folders "lib" and "include". That webpage says that the folders that you should include in the directory are supposed to be named C:\SFML-1.6\lib (or \include) So I try to open the file that I downloaded (not the folders where I pasted the files) and there are no files in there. Only folders. But when I open the folders in the explorer, the files are there.
Last edited on
You shouldn't copy outside libraries into the VC library.

If you keep the SFML files in C:\SFML-1.6\lib (or \include) you need to tell VC where they are.
Under Options -> Project Solutions -> VC++ Directories, you need to add C:\SFML-1.6\lib (for library) and C:\SFML-1.6\include (for include directories)


Afterwards, to use SFML in a project, you need to tell your project specifically to link the libraries. So in project properties -> Linker -> Input, in the Additional Dependency box, you need to type the name of the library you're using, and you'll probably have to copy the library files to the directory your projects in.

SFML was pretty hard to set up, (i spent like 30 minutes figuring it out last night, Disch.) But after you get it done, it's simple to use.
I remember now that I maybe have to extract them first?


Yes. Files cannot be in the zip. You must extract them.

I copied those files and pasted them in VCs folders "lib" and "include".


To clarify, you should copy the contents of the "lib" folder (various .lib files) to VC's lib folder

And you should copy the contents of the "include" folder (should just be a single folder called "SFML") to VC's include folder.

So I try to open the file that I downloaded (not the folders where I pasted the files) and there are no files in there. Only folders. But when I open the folders in the explorer, the files are there.


Whaaaaat? The files are there when you open it, but when you open it they're not there? Which is it?
To anwer the last question from Disch: Under View -> Property Manager -> VC++ Directories, I can't find the files I want VC to find. I can only find the folders. (In VC 2010 it's the same place as Thumper said I should tell VC where to find my files.
Options -> Project Solutions -> VC++ Directories, you need to add C:\SFML-1.6\lib (for library) and C:\SFML-1.6\include (for include directories)
) But in the Windows Explorer, the files are there.



I'm going to try and extract them and see if that works.

Edit: Wierd. I thought I saw a "Extract all" before. I guess they are extracted after all... Then I suppose I've done everything. I think I'm going to uninstall everything and install it again to see if that works.
Last edited on
I want VC to find. I can only find the folders.

You only need the folders, VC will assume all files in the directory you give.

EDIT: Better explanation -
You're telling VC a directory (folder) to look in for the libraries and include files. You don't have to click all the files individually.
Last edited on
So if I can't even see them when I enter the folders, that's how it should be? I tried to write the program from this website http://www.sfml-dev.org/tutorials/1.6/start-vc.php but I get four errors.

error LNK2019: unresolved external symbol "void __cdecl sf::Sleep(float)" (?Sleep@sf@@YAXM@Z) referenced in function _main

error LNK2019: unresolved external symbol "public: float __thiscall sf::Clock::GetElapsedTime(void)const " (?GetElapsedTime@Clock@sf@@QBEMXZ) referenced in function _main

error LNK2019: unresolved external symbol "public: __thiscall sf::Clock::Clock(void)" (??0Clock@sf@@QAE@XZ) referenced in function _main


fatal error LNK1120: 3 unresolved externals

Since I don't really know the language, it's hard to see what the problems are and if they're connected to the issues that I'm having



Edit: I can probably just write the code right here.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <SFML/System.hpp>
#include <iostream>

int main()
{
    sf::Clock Clock;
    while (Clock.GetElapsedTime() < 5.f)
    {
        std::cout << Clock.GetElapsedTime() << std::endl;
        sf::Sleep(0.5f);
    }

    return 0;
}
Last edited on
Its not the language, it's the compiler that's tricky to learn how to use.

I'll just make a full on pic tut, give me like, 10 mins.

edit: Nevermind, i'm gonna hypercam it. Pictures are giving me problems today..
Last edited on
Thanks :D
Those linker errors are caused because you're not linking to the lib.

Just below the code it says this:

Open your project's options, then go to the Linker / Input item. In the Additional dependencies row, add the SFML libraries you are using. Here we only use sfml-system.lib.
This is for the dynamic version of the libraries, the one using the DLLs. If you want to link with the static version of the libraries, add the "-s" suffix : sfml-system-s.lib, or sfml-system-s-d.lib for the debug version.


It also shows a picture of the screen it's talking about and what you need to input and where.
What Disch said.. I totally forgot the SFML site explains that.. fail.
Yeah, now the compiler won't find sfml-system.dll altough I have copied it to the VC lib-folder. It seems that the program will run when I get that to work, though. You have been of great help guys, thanks!
put the dll files in your system folder. C\WINNT\System32 or something.

Is it the compiler that won't find the .dll? or is it an error you get at runtime that says "unable to locate sfml-system.dll"?
If it's a runtime error, you need to copy the .dll file to the folder your executable is in.
The compiler doesn't care about the DLL. The DLL is used at runtime, not compiletime.

Also, you can put the dll in the same folder as the executable, but then you have to copy it to every single future project you make with SFML. You end up with a bunch of duplicate DLL files all over your HD.

You're better off putting the DLLs in your system folder. The OS looks for DLL files there, so if you stick the DLL there, it will be found for any and all future programs that use that version of SFML.
Last edited on
Right, but if you're distributing your executable, the DLL needs to be with it.
Pages: 123