Author Topic: Adding files to project  (Read 10053 times)

Offline MannyMoe

  • Multiple posting newcomer
  • *
  • Posts: 14
Re: Adding files to project
« Reply #15 on: January 04, 2019, 03:33:47 pm »
Hi stahta01:

     I tried to copy the build log but codeblocks had the copy greyed out.

     Here is the codeblocks project file:

Code
<?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.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: Adding files to project
« Reply #16 on: January 04, 2019, 05:52:43 pm »
Use relative paths for your images in both the CB package and in your code.
Set the working path to where your executable is located. I would also put the images in the same folder as the executable or in a sub-folder.
Note: The above directions are valid for an Windows program with your issue; they may or may not be valid for an Linux program.

Tim S.

« Last Edit: January 04, 2019, 06:01:13 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: Adding files to project
« Reply #17 on: January 04, 2019, 06:02:37 pm »
Hi stahta01:

     I tried to copy the build log but codeblocks had the copy greyed out.


You likely tried to copy the "Build Messages" instead try to copy the "build log" next time.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline MannyMoe

  • Multiple posting newcomer
  • *
  • Posts: 14
Re: Adding files to project
« Reply #18 on: January 04, 2019, 08:51:27 pm »
Hi stahta01:

     No, I tried to copy the Build Log. I tried again and it is still greyed out as before.
You mentioned earlier about using GCC from the command line. If you have the time
could you post what that would look like? Maybe their is enough info from the project
file to come up with something. I would like to try it to see what difference, if any, it
would make. Also, do you think there is some PATH that needs to be corrected to solve
my problem? Thanks!

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: Adding files to project
« Reply #19 on: January 04, 2019, 09:48:29 pm »
Hi stahta01:

     No, I tried to copy the Build Log. I tried again and it is still greyed out as before.
You mentioned earlier about using GCC from the command line. If you have the time
could you post what that would look like? Maybe their is enough info from the project
file to come up with something. I would like to try it to see what difference, if any, it
would make. Also, do you think there is some PATH that needs to be corrected to solve
my problem? Thanks!

I can not help you.
I think the problem is likely in your code; therefore this site rules says it is off topic.
http://forums.codeblocks.org/index.php/topic,9996.0.html
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Adding files to project
« Reply #20 on: January 06, 2019, 08:45:48 pm »
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:
Code
yourFolder
|- show_image.c
|- rubiks_cube_orange.bmp
|- SOMEFOLDER_I_DO_NO_KNOW
     |- Your project file.cbp

It should look more like this:
Code
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:
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...