Author Topic: adding header files so codeblocks knows where to look  (Read 4699 times)

Offline userx-bw

  • Multiple posting newcomer
  • *
  • Posts: 14
adding header files so codeblocks knows where to look
« on: April 13, 2015, 09:47:48 pm »
OK i got the part where to find the search paths tabs ---
then I added /usr/include/ to the path it made it a relative path

I am getting errors undefined reference to -- a Imlib2.h function call (all of them that I use) it too does not know where the standard Include directory is in Linux so I am getting the same problem for X11.h and Xatom.h

I added to the linker tab /usr/include/Imlib2.h then it tells me it is not there when it is..

under Projects ---> Build Options ---> Linker settings tab . is this where the path to the header files go? 
under Projects ----> Build Option ----> Search Directories tab I have  ../../../../../../usr/include   
this is the only place I have headers files I am using other then my own header file in the same directory that my c file is at.

what exactly to I have to type in these places that need to know what header files I am using and where to find them

I have no real idea how codeblocks works I needed an app that debugs as I got this 64 bit Laptop now and my program is now giving me seg faults when it didn't on a 32 bit linux os. for all I know it maybe data types declarations because 64 bit uses a different size . this is all new to me I am not a programmer per say just a dude that figured out how to program a little bit  ;D


Debian Linux 64 bit OS

New to Code Blocks

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: adding header files so codeblocks knows where to look
« Reply #1 on: April 13, 2015, 11:36:09 pm »
Read the CB FAQ esp learn how to post a full re-build log.

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

Find a programming web site to ask your programming questions on.
I think this one is OK http://cboard.cprogramming.com/

FYI: You need to learn what a Library is and how to link to one is my guess of your problem.
Without a error message and build log it is just a guess.

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 userx-bw

  • Multiple posting newcomer
  • *
  • Posts: 14
Re: adding header files so codeblocks knows where to look
« Reply #2 on: April 14, 2015, 02:33:23 am »
O tay -- you got a main.c and header files that define the library with the o files that is compiled code and header files define the functions within them --



Code
||=== mhsetroot, Debug ===|
obj/Debug/main.o||In function `setAlpha':|
/home/userx/projects/c/mhsetroot/mhsetroot/main.c|144|undefined reference to `imlib_image_set_has_alpha'|
/home/userx/projects/c/mhsetroot/mhsetroot/main.c|145|undefined reference to `imlib_create_color_modifier'|
/home/userx/projects/c/mhsetroot/mhsetroot/main.c|146|undefined reference to `imlib_context_set_color_modifier'|
/home/userx/projects/c/mhsetroot/mhsetroot/main.c|149|undefined reference to `imlib_get_color_modifier_tables'|
/home/userx/projects/c/mhsetroot/mhsetroot/main.c|154|undefined reference to `imlib_set_color_modifier_tables'|
/home/userx/projects/c/mhsetroot/mhsetroot/main.c|156|undefined reference to `imlib_apply_color_modifier'|
/home/userx/projects/c/mhsetroot/mhsetroot/main.c|157|undefined reference to `imlib_free_color_modifier'|
/home/userx/projects/c/mhsetroot/mhsetroot/main.c|160|undefined reference to `imlib_context_set_image'|
obj/Debug/main.o||In function `setRootAtoms':|
/home/userx/projects/c/mhsetroot/mhsetroot/main.c|174|undefined reference to `XInternAtom'|
/home/userx/projects/c/mhsetroot/mhsetroot/main.c|175|undefined reference to `XInternAtom'|
/home/userx/projects/c/mhsetroot/mhsetroot/main.c|180|undefined reference to `XGetWindowProperty'|
/home/userx/projects/c/mhsetroot/mhsetroot/main.c|186|undefined reference to `XGetWindowProperty'|
/home/userx/projects/c/mhsetroot/mhsetroot/main.c|193|undefined reference to `XKillClient'|
/home/userx/projects/c/mhsetroot/mhsetroot/main.c|198|undefined reference to `XInternAtom'|
/home/userx/projects/c/mhsetroot/mhsetroot/main.c|199|undefined reference to `XInternAtom'|
/home/userx/projects/c/mhsetroot/mhsetroot/main.c|205|undefined reference to `XChangeProperty'|
/home/userx/projects/c/mhsetroot/mhsetroot/main.c|209|undefined reference to `XChangeProperty'|
obj/Debug/main.o||In function `setOrginalSizedImageFlippedCenterScreen':|
/home/userx/projects/c/mhsetroot/mhsetroot/main.c|285|undefined reference to `imlib_load_image'|
/home/userx/projects/c/mhsetroot/mhsetroot/main.c|290|undefined reference to `imlib_context_set_image'|
/home/userx/projects/c/mhsetroot/mhsetroot/main.c|291|undefined reference to `imlib_image_get_width'|
/home/userx/projects/c/mhsetroot/mhsetroot/main.c|291|undefined reference to `imlib_image_get_height'|
/home/userx/projects/c/mhsetroot/mhsetroot/main.c|298|undefined reference to `imlib_image_flip_horizontal'|
/home/userx/projects/c/mhsetroot/mhsetroot/main.c|302|undefined reference to `imlib_blend_image_onto_image'|
/home/userx/projects/c/mhsetroot/mhsetroot/main.c|307|undefined reference to `imlib_image_flip_vertical'|
/home/userx/projects/c/mhsetroot/mhsetroot/main.c|311|undefined reference to `imlib_blend_image_onto_image'|
/home/userx/projects/c/mhsetroot/mhsetroot/main.c|316|undefined reference to `imlib_image_flip_diagonal'|
/home/userx/projects/c/mhsetroot/mhsetroot/main.c|322|undefined reference to `imlib_blend_image_onto_image'|
/home/userx/projects/c/mhsetroot/mhsetroot/main.c|325|undefined reference to `imlib_context_set_image'|
/home/userx/projects/c/mhsetroot/mhsetroot/main.c|326|undefined reference to `imlib_free_image'|
/home/userx/projects/c/mhsetroot/mhsetroot/main.c|328|undefined reference to `imlib_context_set_image'|
obj/Debug/main.o||In function `setOrginalSizeImageTiledWithinItself':|
/home/userx/projects/c/mhsetroot/mhsetroot/main.c|338|undefined reference to `imlib_load_image'|
/home/userx/projects/c/mhsetroot/mhsetroot/main.c|343|undefined reference to `imlib_context_set_image'|
/home/userx/projects/c/mhsetroot/mhsetroot/main.c|344|undefined reference to `imlib_image_get_width'|
/home/userx/projects/c/mhsetroot/mhsetroot/main.c|344|undefined reference to `imlib_image_get_height'|
/home/userx/projects/c/mhsetroot/mhsetroot/main.c|349|undefined reference to `imlib_context_set_image'|
/home/userx/projects/c/mhsetroot/mhsetroot/main.c|354|undefined reference to `imlib_image_tile_horizontal'|
/home/userx/projects/c/mhsetroot/mhsetroot/main.c|367|undefined reference to `imlib_blend_image_onto_image'|
/home/userx/projects/c/mhsetroot/mhsetroot/main.c|373|undefined reference to `imlib_image_tile_vertical'|
/home/userx/projects/c/mhsetroot/mhsetroot/main.c|385|undefined reference to `imlib_blend_image_onto_image'|
/home/userx/projects/c/mhsetroot/mhsetroot/main.c|390|undefined reference to `imlib_image_tile'|
/home/userx/projects/c/mhsetroot/mhsetroot/main.c|402|undefined reference to `imlib_blend_image_onto_image'|
/home/userx/projects/c/mhsetroot/mhsetroot/main.c|406|undefined reference to `imlib_context_set_image'|
/home/userx/projects/c/mhsetroot/mhsetroot/main.c|407|undefined reference to `imlib_free_image'|
/home/userx/projects/c/mhsetroot/mhsetroot/main.c|409|undefined reference to `imlib_context_set_image'|
obj/Debug/main.o||In function `setOrginalSizeImageCenterScreen':|
/home/userx/projects/c/mhsetroot/mhsetroot/main.c|418|undefined reference to `imlib_load_image'|
/home/userx/projects/c/mhsetroot/mhsetroot/main.c|423|undefined reference to `imlib_context_set_image'|
/home/userx/projects/c/mhsetroot/mhsetroot/main.c|424|undefined reference to `imlib_image_get_width'|
/home/userx/projects/c/mhsetroot/mhsetroot/main.c|424|undefined reference to `imlib_image_get_height'|
/home/userx/projects/c/mhsetroot/mhsetroot/main.c|430|undefined reference to `imlib_blend_image_onto_image'|
/home/userx/projects/c/mhsetroot/mhsetroot/main.c|443|undefined reference to `imlib_blend_image_onto_image'|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build finished: 50 errors, 0 warnings ===|

in geany I will not and do not get this error because it already knows where to look for everything in accordence to a main.c declarations

Code

#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <Imlib2.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>

#include "functions.h"

void main (void)
{
foo bar ......

exit 0;
}
geany already knows where the
Code
 #include <foo.h> 
is at and the
Code
 #include "foo.h" 
is at to look for them and the libs and everything it needs just provide the proper command line args and it compiles accordingly.

 Whereas CodeBlocks lacks in this simple set up. the pogram already knows it is on a linux but it does not know where anything is at on linux include files or libs for some strange reason. (lack of coding it to know that possibly)

so  what do I got a write in this code blocks app to tell it where the headers are and libs within a linux pc so I do not get this error savy?  :-\
« Last Edit: April 14, 2015, 03:39:48 am by userx-bw »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: adding header files so codeblocks knows where to look
« Reply #3 on: April 14, 2015, 03:37:08 am »
Please read the FAQs and the Rules before you are banned!!
http://wiki.codeblocks.org/index.php?title=FAQ
http://forums.codeblocks.org/index.php/topic,9996.0.html
http://wiki.codeblocks.org/index.php?title=User_documentation

YOU NEED TO LEARN THE NAME OF THE LIBRARY THAT IS NEEDED!!!

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 userx-bw

  • Multiple posting newcomer
  • *
  • Posts: 14
Re: adding header files so codeblocks knows where to look
« Reply #4 on: April 14, 2015, 04:08:39 am »
Code
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <Imlib2.h>

the libs to that in /usr/lib/.... where Linux puts its Libraries 

still trying to get it to work

« Last Edit: April 14, 2015, 04:16:55 am by userx-bw »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: adding header files so codeblocks knows where to look
« Reply #5 on: April 14, 2015, 07:04:45 am »
Still no "Build Log" and I still have no idea if you know the name of the library needed.
I have no idea if you know what a library is; you should know that a header file is NOT a library.
But, I give up you seem to be unable to follow links and read the information on those links.

In time, an administrator will lock this thread for the rules violation or you will start asking valid questions for this site.
Its a toss up which happens first. 

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