User forums > Using Code::Blocks
Adding files to project
MannyMoe:
Hi guys:
I have some programs I want to execute from my Desktop in Linux. They require loading
Jpeg files. If I don't create a project they will Not run from the Desktop. So, the last few days
I have been trying to figure out how to create a project using Code:Blocks. I have been able
to create the project after some time. My problem seems to be adding files to the project.
When I go to Project - Add Files the window shows up displaying the cbp file. Then I go to
the Directory and pick on my C file and click Open at the bottom. I only get a blank screen.
Evidently this is NOT the proper way to do this. If someone has the time, could you show
the correct way to create the Project and how to load the files in order to compile and link
a program. I have been using Code:Blocks for some time, but never using the project feature.
I would always run my programs from the Directory where the file was located. Now I want
to run them from an Icon on the Desktop. Seems simple but is beyond me how to do this!
Thanks for any help you can offer.
I have switch to version 10.5 Code:Blocks, now I am getting 'Can't read timestamp'.
What is up with that!
MannyMoe:
I have finally gotten my project file completed!
Everything looks great. The file runs perfectly as
long as I am still in codeblocks. When I go to Debug
and try to run the executable, the screen blinks and
is turns black. There is still something I am missing
but I do not know what it is! Has anyone got any ideas
why my file will not run? Thanks for any help you can
offer!
BlueHazzard:
http://wiki.codeblocks.org/index.php/FAQ-Compiling_(general)#Q:_My_program_runs_in_codeblocks_but_if_i_start_it_from_the_outside_it_only_flashes_and_closes_immediately
MannyMoe:
BlueHazzard:
Thanks for the reply. This is not the problem with my project.
My file depends on hitting the ESC key or clicking the Close
button. Is there any setting in Codeblocks that could be causing
my problem? I have tried version 10.05 and version 13.12 and
both do the same thing. I am using ubuntu 16.04 for this project.
Thanks again.
BlueHazzard:
--- Quote ---My file depends on hitting the ESC key or clicking the Close
--- End quote ---
Ok, now you have to specify more closely what type of application you are making. What framework you are using and what it is loading/doing. Without this information it is hard to help...
From my mind there could be 2 reasons for this behavior
1) Your application can not find some dynamic library and crashes (try to open it in command line, or use the ldd tool to find any missing library, or start it with gdb from outside codeblocks). Remember that codeblocks adds the path to the linked libraries automatically to ?LD_LIBRARY_PATH? before it runs the application.
2) Your application can not find some input file (you mentioned you are using jpg files in your program) and you do not do any proper error handing on file not found. Remember that if you run a program trough codeblocks the search path for external files begins in the project folder and if you run your application from double click the search path for external files starts from the place where the executable is
Generally speaking your application goes in one error mode you are not handling and you get an unexpected exit. This is bad programming and should be avoided. Luckily you have found the problem and can now fix it.
[edit:] You will be amazed how better codeblocks is with version 17.12. Please poke the maintainer of ubuntu to update the codeblocks version...
Navigation
[0] Message Index
[#] Next page
Go to full version