|
How to generate a standalone .exe ? |
jw716264
Member #17,098
June 2019
|
I want the game to be playable on computers without allegro,mingw,codeblocks etc. I have tried the method" gcc -o game main.c `allegro-config --libs --static` "but my cmd can't recognize either allegro-config or --libs or --static . |
MikiZX
Member #17,092
June 2019
|
I've never used the command line but possibly you are using an obsolete command line switch? See on https://wiki.allegro.cc/index.php?title=Compiling_Allegro_Programs Allegro 4.4.x starts using 'pkg-config' instead of 'allegro-config' - possibly this is an issue? again, not sure this can help at all. |
Audric
Member #907
January 2001
|
The syntax with the backticks requires a command interpreter like bash (or sh). |
jw716264
Member #17,098
June 2019
|
what do you mean" run allegro-config --libs --static "? |
Audric
Member #907
January 2001
|
I mean open a console, and type the command (what is between the ` `) |
bamccaig
Member #7,536
July 2006
|
I'm pretty sure allegro-config was only used by 4.2 and less. You should be using pkg-config for Allegro 5. It is available for MSYS2. Ultimately, allegro-config and pkg-config are used to output compiler options that link in Allegro and its dependencies. This is predominantly used by Makefiles and other such build systems. If you're going to use your IDE to do the building/linking then you probably won't need this. Where's Edgar when you need him? He knows how to setup Code::Blocks for Allegro development in Windows. I think he wrote this guide: https://wiki.allegro.cc/index.php?title=Windows,_Code::Blocks_and_Allegro_5. That should get you started, but you might need him to come help you get it working ultimately. It's important that your MinGW version that you're using in Code::Blocks matches the version Allegro was compiled with. If they don't match you could either have linking errors or runtime errors. It's not clear to me which version of MinGW was used to build that distribution though. Where did you download Allegro from? -- acc.js | al4anim - Allegro 4 Animation library | Allegro 5 VS/NuGet Guide | Allegro.cc Mockup | Allegro.cc <code> Tag | Allegro 4 Timer Example (w/ Semaphores) | Allegro 5 "Winpkg" (MSVC readme) | Bambot | Blog | C++ STL Container Flowchart | Castopulence Software | Check Return Values | Derail? | Is This A Discussion? Flow Chart | Filesystem Hierarchy Standard | Clean Code Talks - Global State and Singletons | How To Use Header Files | GNU/Linux (Debian, Fedora, Gentoo) | rot (rot13, rot47, rotN) | Streaming |
Edgar Reynaldo
Major Reynaldo
May 2007
|
haha don't worry Edgar is here. jw716264 said: Posted on 06-27-2019 02:32 I want the game to be playable on computers without allegro,mingw,codeblocks etc. I have tried the method" gcc -o game main.c `allegro-config --libs --static` "but my cmd can't recognize either allegro-config or --libs or --static . Since you're using Allegro 5.2.2 (Allegro 5.2.5.1 is the latest version now btw), that means you no longer use allegro-config etc.... If you're using Linux or MSYS(2) you use pkg-config. First, use grep and pkg-config to list the installed allegro packages you have : pkg-config --list-all | grep allegro Then use the names given by pkg-config as its argument list. (Use the names provided, not the $NAME I use) Usage : g++ -Wall -Wextra -Wshadow -g -o Proggie.exe `pkg-config --includes --static $ALLEGRO_LIBRARY_NAME $ALLEGRO_OPTIONAL_ADDON_LIBRARY_NAMES Main.c `pkg-config --libs --static $SAME_NAMES_AS_ABOVE` -static-libstdc++ -static-libgcc Then to test it open another command terminal, set the path to empty, and then execute your program. If everything works, you did it right. Otherwise you forgot resources or the working directory was wrong, etc... cmd.exe set path="" Proggie.exe exit
MikiZX said: Posted on 06-27-2019 04:24 I've never used the command line but possibly you are using an obsolete command line switch? See on https://wiki.allegro.cc/index.php?title=Compiling_Allegro_Programs Allegro 4.4.x starts using 'pkg-config' instead of 'allegro-config' - possibly this is an issue? again, not sure this can help at all. Yes, Allegro 4.2 and previous used allegro-config. Allegro 4.4+ uses pkg-config, as well as Allegro 5 and up. Audric said: Posted on 06-27-2019 05:02, revised 06-27-2019 05:03 The syntax with the backticks requires a command interpreter like bash (or sh). Yes, but pkg-config. jw716264 said: Posted on 06-27-2019 05:11 what do you mean" run allegro-config --libs --static "? Type it at a command prompt (terminal / console / etc...) bamccaig said:
Posted on 06-27-2019 10:07 ...I think he wrote this guide: https://wiki.allegro.cc/index.php?title=Windows,_Code::Blocks_and_Allegro_5. That should get you started, but you might need him to come help you get it working ultimately. It's important that your MinGW version that you're using in Code::Blocks matches the version Allegro was compiled with. If they don't match you could either have linking errors or runtime errors. It's not clear to me which version of MinGW was used to build that distribution though. Where did you download Allegro from?
jw716264 said: allegro-mingw-gcc6.2.0-x86-static-5.2.2 He's using MinGW GCC 6.2.0 with allegro 5.2.2 in 32 bit mode. I suggest upgrading to the latest version. There are several ways to do that. MSYS2 package managerSee SiegeLord's guide to MSYS2 here : https://wiki.allegro.cc/index.php?title=Building_with_msys2 MinGW-W64 binaries I provideI provide up to date binaries for MinGW-W64 packages for Allegro 5.2 and 4.4 on my bitbucket download page here : https://bitbucket.org/bugsquasher/unofficial-allegro-5-binaries/src/master/ Compile Allegro from GIT yourselfSee my Windows and MinGW-W64 compile guide in my sig for info on building allegro. Phew. That only took an hour. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Doctor Cop
Member #16,833
April 2018
|
You don't even need MSYS or MSYS2. I use Git bash or Babun when I need Linux capabilities and GNU suit is always at your disposal.
|
Edgar Reynaldo
Major Reynaldo
May 2007
|
No, you don't need MSYS2, but it's package manager can be nice to have. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
GullRaDriel
Member #3,861
September 2003
|
Particularly to keep things up to date. "Code is like shit - it only smells if it is not yours" |
bamccaig
Member #7,536
July 2006
|
Doctor Cop said: You don't even need MSYS or MSYS2. I use Git bash or Babun when I need Linux capabilities and GNU suit is always at your disposal. Git for Windows is based on MSYS. You are getting a minimal MSYS system bundled with Git. That's why Git Bash exists at all in Windows (on other platforms you'd just use bash, and run git inside of it; bash is a completely separate project). Git for Windows has some core Unix utilities included, but for something like building Allegro you need much more. -- acc.js | al4anim - Allegro 4 Animation library | Allegro 5 VS/NuGet Guide | Allegro.cc Mockup | Allegro.cc <code> Tag | Allegro 4 Timer Example (w/ Semaphores) | Allegro 5 "Winpkg" (MSVC readme) | Bambot | Blog | C++ STL Container Flowchart | Castopulence Software | Check Return Values | Derail? | Is This A Discussion? Flow Chart | Filesystem Hierarchy Standard | Clean Code Talks - Global State and Singletons | How To Use Header Files | GNU/Linux (Debian, Fedora, Gentoo) | rot (rot13, rot47, rotN) | Streaming |
|