User forums > Using Code::Blocks

Adding files to project

<< < (3/5) > >>

BlueHazzard:

--- Quote ---Also, do I need to upgrade my version of codeblocks or do you think
version 13.12 is ok for what I do?
--- End quote ---
13.12 is at least 5(6) years old... updating won't hurt, there where 100s of bugfixes and improvements...

MannyMoe:
BlueHazzard:

   I still haven't got this thing to work. How do I static link this project?

   Could that be my problem?

   Still grasping for straws on this.

   Have a great new year!

BlueHazzard:

--- Quote ---   I still haven't got this thing to work. How do I static link this project?
--- End quote ---
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:

--- Code: ---pkg-config --libs --static allegro-static-5 allegro_image-static-5 allegro_primitives-static-5

--- End code ---

How did you installed allegro? If you have used the package manager you do not have a library problem...

MannyMoe:
BlueHazzard:

     I have been working everyday for the last (3) weeks and still coming up
with the same thing. Let's review: My project will run perfectly in codeblocks
after I do a build and run. My file will run perfectly when I go to the directory and
double click the file. If I copy the file generated with codeblocks to my Desktop,
the screen will only blink and turn black. If I include the absolute path to my
image file and build and run the file, outside of a project, the file will run perfectly.
This is just a simple file for testing. If only draws a rectangle at the border of the
screen and displays an image in the center of the screen.
      In looking at the .cbp file, it shows adding the libraries (.so files) to the project.
It also shows the .c file and the image file added. I do not know anything else to do.
The fact that it runs by itself adding the absolute path to the image file, proves where
the problem is, but I can't find out why the project file won't run from the Desktop.
Since it doesn't seem to be a library problem, perhaps the static libraries won't work
either. Me thinks I have found a real problem for the books. I am still very calm!!!!
      While I have you here, tell my why that 'main.c' file keeps showing up and how
do I get rid of it? Very annoying to say the least! Have a good day!

stahta01:
Try posting a full build log and maybe someone will see a problem to fix!

http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F

Edit: Attaching your Code::Blocks project file (.cbp) to a post might also help someone help you.

Tim S.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version