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

Author Topic: How can I make .exe?  (Read 13457 times)

0 Members and 2 Guests are viewing this topic.

mhmtemnacr

  • Newbie
  • *
  • Posts: 5
  • SFML Starter
    • View Profile
    • Mehmet Emin Acar
    • Email
How can I make .exe?
« on: May 12, 2012, 10:48:09 pm »
Hi, I'm new to your forums.

I have a problem with my VC++ 2010 compiler and SFML. I made half of my game (it's ready to build) but I can't "compile" or "build" (I couldn't understand the difference between them yet) my project. I want to make executable for my game. I find a exe under Documents/VS 2010/Projects/<myprojectname>/Debug. When I run it, it's opening and right after closing. But I can run it successfully with VC++ Debug mode (I dont know what I did, compile or build). Please Help! I couldn't tell my problem well (sorry for my fking english) but I hope you understood. MY GAME IS WAITING FOR BUILD OR COMPILE, HE DON'T WANT TO BE WASTED :(

Thanks a lot in advance. Sorry for my bad english...

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: How can I make .exe?
« Reply #1 on: May 13, 2012, 12:31:26 am »
First off: read a book about programming and one about how to use Visual Studio!

I can't "compile" or "build" (I couldn't understand the difference between them yet) my project.
There are 'only' two steps in creating a executable, compile and link. If you say to build sth. you normaly mean compile and link.

When I run it, it's opening and right after closing. But I can run it successfully with VC++ Debug mode
Open a command line (Start->Run->cmd.exe[ENTER]) then go to the folder where you're exe is (by using cd folder). Then start the exe by entering its name. Look what the application spits out. I bet it's missing some resource and you've copied the code from the example which immediatly terminates the application if the resource isn't found. Running it within VS it gets a diffrent working folder which contains the needed files. But it's just a guess, don't know what really happens.

Please Help! I couldn't tell my problem well (sorry for my fking english) but I hope you understood. MY GAME IS WAITING FOR BUILD OR COMPILE, HE DON'T WANT TO BE WASTED :(
I hope you understand that writting UPPERCASE is interpreted in the digital world as shouting and I guess if you'd want people to help you wouldn't yell them into their face, would you.
(meaning: read some stuff on nettiquetts for forums/internet)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

mhmtemnacr

  • Newbie
  • *
  • Posts: 5
  • SFML Starter
    • View Profile
    • Mehmet Emin Acar
    • Email
Re: How can I make .exe?
« Reply #2 on: May 13, 2012, 11:29:55 am »
Hi, eXpl0it3r.

First, thanks for your valuable reply and I'm sorry for uppercase. I have a book about C++ Programming (without Visual Studio lessons). I couldn't learn knowledge about VS 2010. Anyway, I think some necessary files are missing, too. There are these files under Documents/Visual Studio 2010/Projects/kelime_oyunu/Debug (note: "kelime_oyunu" is my project name) :

kelime_oyunu.exe
kelime_oyunu.ilk
kelime_oyunu.pdb
libsndfile-1.dll
openal32.dll


Another Note: I added files colored with red into the directory myself.
Footnote: I compiled my project or my CPP file 10 times at least.

And, my code isn't from an example. I wrote it myself... Also, I linked SFML lib files statically (there is no DLLs).

I'm waiting for your reply. :) I'm 14 years old and I'm sorry for my ignorance about programming.
Best regards, mhmtemnacr.

OniLinkPlus

  • Hero Member
  • *****
  • Posts: 500
    • View Profile
Re: How can I make .exe?
« Reply #3 on: May 13, 2012, 07:24:12 pm »
Well, you're missing SFML's DLLs. May we see your source code?

Copy the sfml-system, sfml-window, and sfml-graphics DLLs into the same folder as your exe. If you're using audio as well, copy the sfml-audio DLL into the folder too.
I use the latest build of SFML2

mhmtemnacr

  • Newbie
  • *
  • Posts: 5
  • SFML Starter
    • View Profile
    • Mehmet Emin Acar
    • Email
Re: How can I make .exe?
« Reply #4 on: May 13, 2012, 08:25:08 pm »
I found source of the problem. I forgot putting the data files (in-game resources) into my exe folder. I putted it and the game is running successfully now. Thanks for the replies and I'll ask a second question. How can I change my executable's icon? (not the in-game icon) :o

texus

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
    • TGUI
    • Email
Re: How can I make .exe?
« Reply #5 on: May 13, 2012, 08:41:58 pm »
I think you just have to add an icon to the resources.
If I am not wrong then Visual Studio will use the first icon resource as the executable's icon.
TGUI: C++ SFML GUI

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: How can I make .exe?
« Reply #6 on: May 14, 2012, 12:36:34 am »
Well, you're missing SFML's DLLs. May we see your source code?
Then why did he write:
Quote
Also, I linked SFML lib files statically (there is no DLLs).
;)

I found source of the problem. I forgot putting the data files (in-game resources) into my exe folder.
That's what I was talking about.

For the icon part, just use a bit more of google's magic, I'm sure you'll end up with some stack overflow thread.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/