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

Author Topic: Help With Project Properties  (Read 6309 times)

0 Members and 3 Guests are viewing this topic.

Koosmono

  • Newbie
  • *
  • Posts: 8
    • View Profile
Help With Project Properties
« on: May 01, 2011, 04:17:08 am »
Okay, so first off I want to say I'm sorry for bogging down the forums recently. I am really hoping that this will be my last post for awhile.

Really I just want to have an understanding of what I need to do with the project properties when using SFML. Here is where I am at with the first clock tutorial.

I am using Visual Studio 2008 now
I downloaded the full SDK version for Windows - Visual C++ 2008
I added the include and lib folders as described in the tutorial.

I have tried all of whats mentioned in the rest of the tutorial, but I'm stilling getting an error like this.

1>LINK : fatal error LNK1104: cannot open file 'sfml-system-d.lib'

Just like in the tutorial I added sfml-system-d.lib to  Linker / Input

(I've also tried it without the 'd' and with -s-d and just -s)
The tutorial shows "Configuratio: Active(Release), but I don't have that option, so I'm trying to use Active(Debug).

Part of the tutorial says  "If you linked against the dynamic versions of the SFML libraries, donc forget to copy the corresponding DLLs"
I don't know what this means, but I did copy sfml-system.dll to my
Visual Studio 2008/Projects/sfml-test, folder

I also tried adding SFML_DYNAMIC where specified, but this didn't help and again I am not sure what the tutorial means when it says "if you link against the dynamic libraries"

Trying all the combinations I could come up with, I still get a similar error to the one above.

If someone could explain to me what it is I need to do in project properties when I want to use a particular library, I would be so thankful.

After coding 2 years, This is the first API I've tried to use and I have no experience on the subject. Everywhere I've gone SFML is promoted as a noob friendly tool and I am really hoping to be able to use it. These issues I'm having are so aggravating in that they don't pertain to the actual coding, but rather an understanding of linking.

Again, sorry for so many posts recently, but help with this would be highly highly appreciated. I really want to understand this so I don't keep running into the issue later.

thePyro_13

  • Full Member
  • ***
  • Posts: 156
    • View Profile
Help With Project Properties
« Reply #1 on: May 01, 2011, 07:02:10 am »
'sfml-system.lib' is the release lib, you need the debug version(that's what the -d stands for in the name) 'sfml-system-d.lib'.

Dynamic library's are stored in dll/lib files, when using them the dll must be available for your exe to access(as all the code is kept in them)

Static(the alternative to dynamic) librarys are added to your exe,  so that the code doesn't need to be referenced from an external file. This means that the exe must become larger(to fit all the extra code in).

For most instances its best to stick with dynamic.

Regarding API difficulty, this is just the norm, linking always works like this,  their isn't really any room to make it easier or harder. The other areas of SFML are significantly easier than many of their alternatives though.

Koosmono

  • Newbie
  • *
  • Posts: 8
    • View Profile
Help With Project Properties
« Reply #2 on: May 01, 2011, 07:27:43 am »
Thanks for clearing some of that up. That is very helpful, especially to know that I should try to stick with Dynamic. However, I'm still getting errors.


Here are the properties I'm using. When I use "Release" for the configuration, I get these errors.

1>main.obj : error LNK2019: unresolved external symbol "void __cdecl sf::Sleep(float)" (?Sleep@sf@@YAXM@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: float __thiscall sf::Clock::GetElapsedTime(void)const " (?GetElapsedTime@Clock@sf@@QBEMXZ) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall sf::Clock::Clock(void)" (??0Clock@sf@@QAE@XZ) referenced in function _main
1>C:\Users\Drew\Documents\Visual Studio 2008\Projects\work-please\Debug\work-please.exe : fatal error LNK1120: 3 unresolved externals


when I place sfml-sytem-d.lib in any other configuration (Active(Debug) or Debug) I get the same error I was getting before.



And here is where I have the file in my project files. I've also tried it with the file in the DeBug folder.



Thanks again for helping, I hope this might reveal what exactly I'm doing wrong.

thePyro_13

  • Full Member
  • ***
  • Posts: 156
    • View Profile
Help With Project Properties
« Reply #3 on: May 01, 2011, 08:05:06 am »
Have you got it working with the debug configuration yet? Or is it just the release that's failing?

When using the release config you should use the release versions of the .lib/.dll (the versions without the -d).

The debug versions are only for the Debug config.

The .dll should be in the same folder as the exe(the debug folder in this case) in most cases.

I'm not sure exactly what is causing your current problem, you should try following the tutorials to make sure you have everything set up properly.

Koosmono

  • Newbie
  • *
  • Posts: 8
    • View Profile
Help With Project Properties
« Reply #4 on: May 01, 2011, 08:18:31 am »
Thank you again for trying to help!

I've been re-reading the tutorial, looking for something I missed, but it was while going through it that I got stuck.

Should I typically use Active(Debug) or Debug? When I use the DeBug or Active(Debug) configuration with "sfml-system-d.dll" in the "DeBug" folder and sfml-system-d.lib in the properties, I get this error.

1>LINK : fatal error LNK1104: cannot open file 'sfml-system-d.lib'

Heres what I currently have





I feel like I'm missing something obvious. I even tried adding SFML_DYNAMIC where it says too (even though I don't think I need to) and it didn't work.

Koosmono

  • Newbie
  • *
  • Posts: 8
    • View Profile
Help With Project Properties
« Reply #5 on: May 01, 2011, 08:49:41 am »
Okay, so I think I solved this!

I removed all SFML files.

I re-downloaded the full SDK and instead of following the steps for placing the folders, I did the direct link in the tools/options of VC++ 2008.

I noticed some differences in the folder selections for these steps which leads me to suspect my problem might have come from a possible mistake in the tutorial.

The first, says to copy the SFML folder inside of Include
Copy the SFML development files to your Visual Studio installation directory

Copy SFML-x.y\include\
SFML to the VC\include directory of your Visual Studio installation (so that you obtain VC\include\SFML)
Copy the *.lib files in SFML-x.y\lib to the VC\lib directory of your Visual Studio installation


The second has you link the Include folder in the options and not the SFML folder.
Leave the SFML files where you want, and setup Visual Studio so that it can find them

Go to the Tools / Options menu, then to Projects and Solutions / VC++ Directories
In Include files, add SFML-x.y\
include
In Library files, add SFML-x.y\lib

I haven't tested this, but if it's true it should probably be changed.

Anyway, thank you tons for helping all that you did! I am so glad this finally works!

thePyro_13

  • Full Member
  • ***
  • Posts: 156
    • View Profile
Help With Project Properties
« Reply #6 on: May 01, 2011, 09:39:05 am »
No problem, I'm glad you got it working.

Silly me, I should have remembered that the lib directories need to be set in the project settings. Would have saved you some time. :P

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Help With Project Properties
« Reply #7 on: May 01, 2011, 10:32:31 am »
Quote
I noticed some differences in the folder selections for these steps which leads me to suspect my problem might have come from a possible mistake in the tutorial.
[...]
SFML-x.y\include\SFML
[...]
SFML-x.y\include

It's not a mistake, these paths don't have to be the same.

For the first, by copying "SFML-x.y/include/SFML" in "VC/include" you'll end up with "VC/include/SFML/xxx.hpp", and since "VC/include" is a standard header path for the compiler, it'll be able to find <SFML/xxx.hpp> headers.

For the second,you have "SFML-x.y/include/SFML/xxx.hpp", so you must add "SFML-x.y/include" to your compiler's header paths so that it can find <SFML/xxx.hpp> headers.
Laurent Gomila - SFML developer

 

anything