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

Author Topic: Installation Problem... Compiling Error  (Read 4567 times)

0 Members and 1 Guest are viewing this topic.

symtaxiz

  • Newbie
  • *
  • Posts: 9
    • View Profile
Installation Problem... Compiling Error
« on: January 01, 2014, 04:59:00 pm »
Hi community,
I have Code::Blocks 13.12 and I have SFML installed just like the tutorial says. Than I have tried to compile but it didn't work, so I downloaded and installed the MinGW compiler and than it has worked (the example code). I have been reading a tutorial from SFML and some codes doesn't work with mine (for example sf::Window::Closed, it says something like Closed is not from Window). Not just that, if I create a new project just like I did the first time, it just doesn't work, the compiler says fatal error in the first line "#include <SFML/Window.hpp>". The problem is that probably (I'm not pretty sure) the MinGW compiler isn't installed properly, can that be the problem?
I will really thank the solution  :).

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11035
    • View Profile
    • development blog
    • Email
Re: Installation Problem... Compiling Error
« Reply #1 on: January 01, 2014, 05:13:46 pm »
Sounds like you didn't add the include directory to the project settings...
Did you follow the tutorial really step by step, without skipping, jumping, adding additional stuff? ;)

Also keep in mind, that the prebuild binaries of SFML only work with the "mingw-setup" version of C::B 12.11. If you use a different MinGW version, you'll have to build SFML yourself.
« Last Edit: January 17, 2014, 12:48:27 pm by eXpl0it3r »
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

symtaxiz

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Installation Problem... Compiling Error
« Reply #2 on: January 01, 2014, 07:54:40 pm »
No, I am pretty sure I have done everything. I guess the problem is in my compiler  :-\. Each time I try to run an application (.exe) without Code::Blocks it give me an error that says that the file libgcc_s_dw2-1.ddl so I copied that file (the file was on MinGW/bin) to the same folder where my exe was, and when I do that, another file is missing. I would like to here your recommendations, now I don't think that the problem is SFML or Code::Blocks, otherwise my compiler. Do you think it is a good idea to reinstall it?
Thank you for answering  :)

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11035
    • View Profile
    • development blog
    • Email
Re: Installation Problem... Compiling Error
« Reply #3 on: January 01, 2014, 08:12:45 pm »
If the compiler's bin directory is not in PATH, then you'll have to copy the runtime libraries next to your exe - for some reason that is not clearly stated in the tutorial. You'll of course also have to copy the SFML's DLLs next to your exe as stated in the tutorial.

I'm using MinGW Builds to get GCC running on Windows. They are uptodate and don't contain ugly tweaks as the TDM compilers, but of course, you'll have to build SFML on your own then. ;)

Don't forget however, it's rarely the compiler/linkers fault if you get an error, in mostly all cases it's just the user not understanding how do properly work with the given tools. :)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

magneonx

  • Full Member
  • ***
  • Posts: 141
    • MSN Messenger - magnumneon04@hotmail.com
    • View Profile
Re: Installation Problem... Compiling Error
« Reply #4 on: January 01, 2014, 08:21:06 pm »
 libgcc_s_dw2-1.dll as far as I know this is on the C/C++ stuff, if you ever use some of the libraries the language has to offer. It will also ask for another one if you ever use C++11. or even BOOST libraries, SFML library, Thor and so on and so forth. I think you need to add the MinGW/bin on your windows environment. You can also first check. You can go ahead and click on:
start then on run type cmd. I just technically saying go run command prompt. So on prompt just type gcc or g++ whatever just type it. If it ever says that it cannot find gcc/g++ as a command it means it is not integrated on your windows environment. But if it says gcc no such file etc. etc. which I cannot remember the exact line means it is integrated on your environment.

If you want to integrate it go ahead on right click on computer then select properties on left pane there must be advance system settings on system settings look a little bit south of the dialog where you can see Environment Variables on environment variables find on path or sometimes PATH don't click new just edit it and don't modify anything that is already written there. Just at the end of the text box append ';' to the last entry then put type in your MinGW/bin directory which is commonly found on C:/MinGW/bin. after that append another ';' sometimes it is not needed but just put it there, it will save you a lot of trouble if you integrate another library in windows. then apply apply apply apply then click ok. Go back to your cmd prompt then type gcc or g++ if it says no file included etc etc it means it recognizes the command.

That means to say it is on your windows environment. Now libgcc_s_dw2-1.dll or such .dll files related to MinGW or C/C++ will no longer ask you that it is missing because windows now knows where to look for them( PATH ). You do the same thing to for other libraries like SFML if ever the executable ask you for for missing SFML .dlls.

But be warned though, if you ever plan to distribute your multi-media app and show it off to your friend you might be aware that their computers don't have SFML or C/C++ installed on their computer, hence you require to build the 'release' folder yourself that is putting all the required .dll and assets(e.g pictures,sprites,music etc etc.) on to your application folder and that is what you send off to your buddies. That means to say you don't have to make your buddies install C++ or SFML to their computer just to make your application work because you have provided .dll already for them and their computer won't ask for missing .dll. And another warning do not ever put specific application's .dll files on your system32 folder which I must not say anyway. Just don't put it there.

Sometimes restarting the pc after installing new compiler and library does the trick for me most of the time. I know this is not the solution to your problem but I hope it solves one of it.

magneonx

  • Full Member
  • ***
  • Posts: 141
    • MSN Messenger - magnumneon04@hotmail.com
    • View Profile
Re: Installation Problem... Compiling Error
« Reply #5 on: January 01, 2014, 08:33:26 pm »
If you ever encounter, the error on the tutorials, I have been there too. But don't be fooled. If it crashes during runtime OR not even compiling, I just simply restarted my computer I know somehow it is not related but it works. THen if it still not works you might go ahead and write your own SFML starting code for beginners that is just write a simple app. Show a window without displaying any graphics. I didn't follow that displaying a circle thing on SFML tutorials only to realize when I initialize my own SFML window it works like a charm. I don't know. I have done it on my friends computer when told me he followed the instructions well. I have checked his computer and all are systems green. We even redo the process all over again, to the same effect. That tutorial example didn't work for our computers, that is when we use SFML 2.0 and installed 2.0 on my laptop. On my desktop that tutorial worked so well. I don't know on my laptop and his laptop. It says undefined reference to etc. etc. and some couple of fatal errors. So what I did is I just run a simple SFML window without graphics on it and it works and we displayed a sprite on a project we currently working on together and it worked also.

I think it made me believed somehow that SFML 2.0 worked on my computer though sample tutorials for checking if ever SFML runs never worked on me.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11035
    • View Profile
    • development blog
    • Email
Re: Installation Problem... Compiling Error
« Reply #6 on: January 01, 2014, 08:47:20 pm »
Not sure why you could just edit your other post, but I can assure you, that SFML works fine everywhere, one just have to know with which compiler, to link what version of SFML and how to link things.
If you take SFML precompiled libs that don't match with your compiler - it won't work.
If you don't add all libraries in the correct order to the linking settings - it won't work.
If you debug and release versions - it won't work.
If you mix static and dynamic versions - it won't work.
If you define SFML_STATIC and link against dynamic libraries - it won't work.
If you don't define SFML_STATIC and link against static libraries - it won't work.
etc. etc.

Linking is a tough businesses for beginners since there are so many ways to do things wrong by accident. But once you understand the concept, things get clearer quickly. So I can strongly advise to read some theoretical information on linking. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

symtaxiz

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Installation Problem... Compiling Error
« Reply #7 on: January 01, 2014, 09:24:38 pm »
Thank you! ;D
magneonx you have solved my problem ;). I have made all the tutorial and it has worked!!!!! I hope the problem of the code is solved too... so tell me please if this code is works: "sf::Window::Closed" because last time I saw it and I tried it but it said Closed is not a part of Window or something like that.
Thank you very much!!!!

symtaxiz

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Installation Problem... Compiling Error
« Reply #8 on: January 02, 2014, 12:09:39 am »
No need to reply... Don't know why but the codes that I have seen in  that tutorial were wrong... now I am lerning from another tutorial and everything works properly  :D. Thank you so much for the help! ;D

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11035
    • View Profile
    • development blog
    • Email
Re: Installation Problem... Compiling Error
« Reply #9 on: January 02, 2014, 12:52:00 am »
Can you elaborate what's supposedly wrong, so Laurent can change/adapt it? :)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

symtaxiz

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Installation Problem... Compiling Error
« Reply #10 on: January 04, 2014, 11:31:31 pm »
Actually I got no code error now so... there is nothing to fix  :D. I was learning from a tutorial and some codes that were there didn't work becuase the codes didn't exist. The tutorial is in spanish so I don't think you would like can check it :P.