LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-01-2017, 10:10 AM   #1
m@o_614
LQ Newbie
 
Registered: Jul 2017
Posts: 10

Rep: Reputation: Disabled
Compiler xlc can't find headers


Hi

I am having problems with my C compiler xlc. It can't find the header files when I try to compile a program. For example, if I:

cc md5.c

It throws me an error that says: include file <sqludf.h> not found. But if I search the sqludf.h header I find it in a path. I already changed the angle brackets to quotes in the md5.c file:

#include file "sqludf.h"

to search for headers in the current directory over system headers, but it still shows the same error "include file "sqludf.h" not found". I also tried to bind the path where the sqludf.h is to the LD_LIBRARY_PATH, but it doesn't work either:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/header/sqludf.h

what can i do to solve this? Thanks in advance

Last edited by m@o_614; 08-01-2017 at 10:13 AM.
 
Old 08-02-2017, 03:03 AM   #2
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_10{.0|.1|.2}
Posts: 4,506
Blog Entries: 6

Rep: Reputation: 2421Reputation: 2421Reputation: 2421Reputation: 2421Reputation: 2421Reputation: 2421Reputation: 2421Reputation: 2421Reputation: 2421Reputation: 2421Reputation: 2421
That is failing to find a header file, not a linked library.

I am not familiar with xlc, but with most C/C++ compilers you would need to pass the search directory with -I, like

Code:
cc -I/path/to/header source.c
Or you could simply use the full path in the include directive.
 
Old 08-02-2017, 09:56 AM   #3
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 12,892
Blog Entries: 27

Rep: Reputation: 2183Reputation: 2183Reputation: 2183Reputation: 2183Reputation: 2183Reputation: 2183Reputation: 2183Reputation: 2183Reputation: 2183Reputation: 2183Reputation: 2183
Moderator response

Moved: This thread is more suitable in <Programming> and has been moved accordingly to help your thread/question get the exposure it deserves.
 
Old 08-02-2017, 02:29 PM   #4
m@o_614
LQ Newbie
 
Registered: Jul 2017
Posts: 10

Original Poster
Rep: Reputation: Disabled
Hi

Thanks for your responses. I put the full path in the include directives and the error messages "sqludf.h not found". are no longer appearing but now it is giving me another error when i try to compile the md5.c file:


ld: 0711-317 ERROR: Undefined symbol: .main
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.

this is the code in md5.c, as you can see there is no main in this file and neither in the md5.h:

#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include </home/inst6/sqllib/include/sqludf.h>
#include </home/inst6/sqllib/include/sqlca.h>
#include </home/inst6/sqllib/include/sqlda.h>
#include "md5.h"


/*--------------------------------------------------*/
/* MD5 Hashing */
/*--------------------------------------------------*/

#ifdef __cplusplus
extern "C"
#endif
void SQL_API_FN md5_c(
SQLUDF_VARCHAR *in,
SQLUDF_CHAR out[33],
SQLUDF_SMALLINT *innull,
SQLUDF_SMALLINT *outnull,
SQLUDF_TRAIL_ARGS) {

char *t;

t = md5( in );
strcpy( out, t );
free( t );

*outnull = 0;
return;
md5.c
 
Old 08-02-2017, 02:41 PM   #5
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 3,304

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
This isn't a main program, so you cannot create an executable from it.
Anyways, please read this topic: What information to include in a post and how to use [code] tags?

Edit: you seem to wish to create a DB2-database plugin, that calculates MD5.
Try this:

Code:
xlc -Iincludepath -o md5.o md5.c
xlc -G -o libmd5.so md5.o

Last edited by NevemTeve; 08-02-2017 at 02:50 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Included Linux headers - functions not recognised by compiler gudrun Linux - Newbie 5 09-03-2012 03:24 AM
compiler not able to find headers in /usr/include gupta.pulkit89 Linux - Mobile 0 05-03-2011 05:10 PM
Downgrade xlC compiler version in AIX 5.3 vathsan AIX 4 02-22-2009 03:22 PM
Installing xlc on CentOS5 - where do I find it? neocontrol Linux - Software 1 06-15-2008 01:35 PM
gcc compiler error / linux headers install help SciYro Linux - Software 2 12-07-2003 02:44 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration