I still haven't got this thing to work. How do I static link this project?
Haven't you found out that the paths to your images are the problem?
If still the paths are your problem i cant try to explain to you how paths work with projects:
1) If you program an application and you open a file with fopen("image.jpg"); Your application will search in the same folder as where it is for the file "image.jpg". This is called the "current working directory", cwd in short.
2) If you start this application from codeblocks, codeblocks will set the cwd to the folder where the project file is located. This is done so you can make a release build and a debug build in different folders, but your resources are always at the same place. You can change the cwd in Project->Properties->Execution working directory. Changing this option will not alter the behaviour if you start your application by double clicking on it
3) So if you open a file in your application using relative paths place the resource file in the project directory when starting your application within codeblocks, and put your resource file near to your application if you start it through double click.
To link your library in your application is dependend on your library. This is not specific something about codeblocks
I have googled for 5 sec and found this link:
https://www.allegro.cc/forums/thread/616656
I do not know how you have set up your project and added the libraries, but if you use pkg-config you will have to change the line to following:
pkg-config --libs --static allegro-static-5 allegro_image-static-5 allegro_primitives-static-5
How did you installed allegro? If you have used the package manager you do not have a library problem...
Hi stahta01:
I tried to copy the build log but codeblocks had the copy greyed out.
Here is the codeblocks project file:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="yyy" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="Release">
<Option output="/home/scott/allegro5/Image/show_imagex" prefix_auto="1" extension_auto="1" />
<Option working_dir="/home/scott/allegro/Image/" />
<Option object_output="/home/scott/allegro5/Image/yyy" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add directory="/usr/include/allegro5/Image" />
</Compiler>
</Target>
</Build>
<Compiler>
<Add option="-Wall" />
<Add directory="/usr/include/allegro5/Image" />
</Compiler>
<Linker>
<Add library="/usr/lib/i386-linux-gnu/liballegro.so" />
<Add library="/usr/lib/i386-linux-gnu/liballegro_image.so" />
<Add library="/usr/lib/i386-linux-gnu/liballegro_primitives.so" />
</Linker>
<Unit filename="../rubiks_cube_orange.bmp" />
<Unit filename="../show_image.c">
<Option compilerVar="CC" />
</Unit>
<Extensions>
<envvars />
<code_completion />
<debugger />
</Extensions>
</Project>
</CodeBlocks_project_file>
Hope this helps! Thanks for our time.
1) I do not like your project file... The project file should be in the same folder as the source file, or in a sub folder of the project directory, but not like you do:
yourFolder
|- show_image.c
|- rubiks_cube_orange.bmp
|- SOMEFOLDER_I_DO_NO_KNOW
|- Your project file.cbp
It should look more like this:
yourFolder
|- Your project file.cbp
|- src
| |- show_image.c
|- res
|- rubiks_cube_orange.bmp
2) Why do you add the image to the project? Codeblocks can do nothing with the image. Images are not related with your application. (Unless you do not compile it within the exe, but this is done only on windows as far as i know)
3) I simply can not understand where your problem is...
3.1) Do you have compiling problems?
If yes post a build log. If you can not copy and paste it from within codeblocks you can say codeblocks to put it in a log file and post the log file: Settings->Compiler->Build options (you my have to klick on the > arrow until the tab appears)->Save build log to HTML file->Always output the full command line
3.2) Do you have a runtime problem (your application crashes, does the wrong thing)?
Implement proper error handling and error output in your program. Codeblocks is not responsible for your error handling and for this, this forum is the wrong place as statha01 has posted
3.3) If it runs within codeblocks, but not outside codeblocks see 3.2)
I simply do not know how to help you, because i do not understand what your problem is.
You can try to explain it better with as many details as possible. For example like this:
1) Open codeblocks
2) Create a new console project
3) Write the following code:
A minimal code example to reproduce your problem
4) Hit Build->Build an run
5) Outcome: I get a window but no image is displayed
6) Expected behaviour: I get a window with an image
ecc...