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

Author Topic: Linking, relative paths and sharing projects.  (Read 4036 times)

0 Members and 1 Guest are viewing this topic.

natchos

  • Jr. Member
  • **
  • Posts: 97
    • View Profile
    • Email
Linking, relative paths and sharing projects.
« on: May 04, 2012, 10:37:42 am »
So I've worked on a project and I want to send a release version to a friend so that he can see what I have done. However I don't really get how I would be able to link to SFML. I've heard of relative paths but there are no good guides about it on the internet that I could find.

The project is located in C:\Users\Olle\Desktop\C++\PAR SFML\New Game\New Game
and the sfml I want to link to is in C:\Users\Olle\Desktop\C++\PAR SFML\New Game
If I was to transfer the release folder to another computer and include a SFML-1.6\SFML in the same folder so that it would C:\Users\Something\New Game as a parent folder with two folders (SFML-1.6 and Release folders). How would I link to the SFML?

If there is anyone who can help me, alternatively provide me with a better way to organise/put together my project please do.

Sorry if the question is unclear.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Linking, relative paths and sharing projects.
« Reply #1 on: May 04, 2012, 11:02:55 am »
Do you want to send the sources so that your friend can compile your app, or just binaries so that it can execute it?

And what's your compiler/IDE?
Laurent Gomila - SFML developer

natchos

  • Jr. Member
  • **
  • Posts: 97
    • View Profile
    • Email
Re: Linking, relative paths and sharing projects.
« Reply #2 on: May 04, 2012, 11:09:52 am »
Sorry, should include that. I just want to send the binaries, and I'm using Visual C++ 2008 Express

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Linking, relative paths and sharing projects.
« Reply #3 on: May 04, 2012, 04:14:20 pm »
So, just provide the exe, the resource files and the SFML DLLs all in the same directory.
Laurent Gomila - SFML developer

Serapth

  • Full Member
  • ***
  • Posts: 105
    • View Profile
Re: Linking, relative paths and sharing projects.
« Reply #4 on: May 04, 2012, 09:58:26 pm »
In my SFML tutorial, I set it up so SFML is included and set up to link using relative paths, so you can just download the zip, open the solution and be off to the races.

If you check out part 1, you can see an example ( with screenshots ) of setting up a project to be relative pathed.  The settings are for C++ and the Linker.  The example is in Visual Studio 2010, but 2008 is close enough you should be fine.

natchos

  • Jr. Member
  • **
  • Posts: 97
    • View Profile
    • Email
Re: Linking, relative paths and sharing projects.
« Reply #5 on: May 04, 2012, 10:01:44 pm »
Before reading this I would like to state that I have no idea what DLLs do, or how they do it.
With that said.

Can you do that?
I mean since I in the code link directly using
#include "Graphics.hpp"
#include "System.hpp"
Wont it just return a file not found error?

natchos

  • Jr. Member
  • **
  • Posts: 97
    • View Profile
    • Email
Re: Linking, relative paths and sharing projects.
« Reply #6 on: May 04, 2012, 10:02:39 pm »
In my SFML tutorial, I set it up so SFML is included and set up to link using relative paths, so you can just download the zip, open the solution and be off to the races.

If you check out part 1, you can see an example ( with screenshots ) of setting up a project to be relative pathed.  The settings are for C++ and the Linker.  The example is in Visual Studio 2010, but 2008 is close enough you should be fine.

Yea, but would that work if I just want to send the binaries to someone?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Linking, relative paths and sharing projects.
« Reply #7 on: May 04, 2012, 10:30:42 pm »
Quote
Wont it just return a file not found error?
Headers are only used when you compile the code, not when you execute it. Have you ever seen any application that was distributed with C or C++ headers? ;)

You should definitely read about headers, libraries, the preprocessing/compiling/linking processes, etc. You can't do anything without this basic knowledge.
Laurent Gomila - SFML developer

natchos

  • Jr. Member
  • **
  • Posts: 97
    • View Profile
    • Email
Re: Linking, relative paths and sharing projects.
« Reply #8 on: May 05, 2012, 10:28:09 pm »
That is very true, now that you mention it. ^^ Tyvm for the help! And I will try to read some articles about headers, linking and libs.

 

anything