473,385 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

compiling a db2 program

I'm new to db2. I've written a small program to get started but when I
compile it I get -

khello.o(.text+0x27): In function `main':
: undefined reference to `sqlastrt'
khello.o(.text+0x37): In function `main':
: undefined reference to `sqlaaloc'
khello.o(.text+0x6b): In function `main':
: undefined reference to `sqlasetda'
khello.o(.text+0x80): In function `main':
: undefined reference to `sqlacall'
khello.o(.text+0x8d): In function `main':
: undefined reference to `sqlastop'
khello.o(.text+0xa7): In function `main':
: undefined reference to `sqlastrt'
khello.o(.text+0xb7): In function `main':
: undefined reference to `sqlaaloc'
khello.o(.text+0xea): In function `main':
: undefined reference to `sqlasetda'
khello.o(.text+0xff): In function `main':
: undefined reference to `sqlacall'
khello.o(.text+0x10c): In function `main':
: undefined reference to `sqlastop'
khello.o(.text+0x2a4): In function `main':
: undefined reference to `sqlastrt'
khello.o(.text+0x2b9): In function `main':
: undefined reference to `sqlacall'
khello.o(.text+0x2c6): In function `main':
: undefined reference to `sqlastop'

I'm guessing I need to include reference to a library. What is it
called and where is it?
Thanks in anticipation.

AK
Nov 12 '05 #1
3 6242
Ian
abit_oik wrote:
I'm new to db2. I've written a small program to get started but when I
compile it I get -

khello.o(.text+0x27): In function `main':
: undefined reference to `sqlastrt'
khello.o(.text+0x37): In function `main':
: undefined reference to `sqlaaloc'
khello.o(.text+0x6b): In function `main':
: undefined reference to `sqlasetda'
khello.o(.text+0x80): In function `main':
: undefined reference to `sqlacall'
khello.o(.text+0x8d): In function `main':
: undefined reference to `sqlastop'
khello.o(.text+0xa7): In function `main':
: undefined reference to `sqlastrt'
khello.o(.text+0xb7): In function `main':
: undefined reference to `sqlaaloc'
khello.o(.text+0xea): In function `main':
: undefined reference to `sqlasetda'
khello.o(.text+0xff): In function `main':
: undefined reference to `sqlacall'
khello.o(.text+0x10c): In function `main':
: undefined reference to `sqlastop'
khello.o(.text+0x2a4): In function `main':
: undefined reference to `sqlastrt'
khello.o(.text+0x2b9): In function `main':
: undefined reference to `sqlacall'
khello.o(.text+0x2c6): In function `main':
: undefined reference to `sqlastop'

I'm guessing I need to include reference to a library. What is it
called and where is it?


See the Makefile in the ../sqllib/samples/c directory for help on how to
compile.

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Nov 12 '05 #2
Ian <ia*****@mobileaudio.com> wrote in message news:<40**********@corp.newsgroups.com>...
abit_oik wrote:
I'm new to db2. I've written a small program to get started but when I
compile it I get -

khello.o(.text+0x27): In function `main':
: undefined reference to `sqlastrt'

khello.o(.text+0x37): In function `main':
: undefined reference to `sqlaaloc'

khello.o(.text+0x6b): In function `main':
: undefined reference to `sqlasetda'

khello.o(.text+0x80): In function `main':
: undefined reference to `sqlacall'

khello.o(.text+0x8d): In function `main':
: undefined reference to `sqlastop'

khello.o(.text+0xa7): In function `main':
: undefined reference to `sqlastrt'

khello.o(.text+0xb7): In function `main':
: undefined reference to `sqlaaloc'

khello.o(.text+0xea): In function `main':
: undefined reference to `sqlasetda'

khello.o(.text+0xff): In function `main':
: undefined reference to `sqlacall'

khello.o(.text+0x10c): In function `main':
: undefined reference to `sqlastop'

khello.o(.text+0x2a4): In function `main':
: undefined reference to `sqlastrt'

khello.o(.text+0x2b9): In function `main':
: undefined reference to `sqlacall'

khello.o(.text+0x2c6): In function `main':
: undefined reference to `sqlastop'

I'm guessing I need to include reference to a library. What is it
called and where is it?


See the Makefile in the ../sqllib/samples/c directory for help on how to
compile.

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----

Thanks for the reply. Now solved the problem.

When stating the path to the libraries/includes for DB2 I'd
incorrectly stated the path so no wonder it could't find anything. I
went back to basics and typed everything at the command line instead
of in my Makefile. It still took ages to spot what the difference was.
The path that now works for me is -

/home/db2inst1/sqllib

which I include in the -I and -L options to g++.
Thanks
Nov 12 '05 #3
abit_oik wrote:
Thanks for the reply. Now solved the problem.

When stating the path to the libraries/includes for DB2 I'd
incorrectly stated the path so no wonder it could't find anything. I
went back to basics and typed everything at the command line instead
of in my Makefile. It still took ages to spot what the difference was.
The path that now works for me is -

/home/db2inst1/sqllib

which I include in the -I and -L options to g++.
Thanks


I guess I solved it a different way that seems simpler to me.

I happen to use GNOME and X Window System most of the time, but compile in
an xterm. That probably does not matter much. I tend to compile programs
as myself and not as the instance name. I use C++, not plain C.
In my .bash_profile are (among other things) the lines:

# These are for IBM's DB2 dbms.
IBM_DB2_ROOT=/dataA/db2inst1

.. $IBM_DB2_ROOT/sqllib/db2profile
In my makefiles are lines like this near the beginning:

CXX = /usr/bin/g++296
IBM_DB2_PATH = ${IBM_DB2_ROOT}/sqllib
IBM_DB2_BIN = ${IBM_DB2_PATH}/bin
IBM_DB2_DB2 = ${IBM_DB2_BIN}/db2
IBM_DB2_HEADERS = ${IBM_DB2_PATH}/include
IBM_DB2_LIB = ${IBM_DB2_PATH}/lib
MY_ROOT = /home/me
MY_BIN = ${MY_ROOT}/bin
MY_HEADERS = ${MY_ROOT}/include
MY_LIB = ${MY_ROOT}/lib
MY_STOCKS = ${MY_ROOT}/stocks
MY_STOCK_HEADERS = ${MY_STOCKS}/include
MY_STOCK_LIB = ${MY_STOCKS}/lib
SYS_LIB = /usr/lib

(CXX is to use a compatibility compiler because DB2 does not like the
current one with RHEL 3 ES)

so that in compile steps, I have:

enter_vl: ${OBJS} ${MY_STOCK_LIB}/libstock.a ${MY_LIB}/libmine.a
${CXX} ${DEBUG_FLAG} ${CXX_LIBS} \
-Wl,-L,${IBM_DB2_LIB},-L${SYS_LIB} \
-Wl,-rpath,${IBM_DB2_LIB},-rpath,${SYS_LIB} \
-o $@ ${OBJS} \
-lstock -lmine \
-ldb2 ${SYS_LIB}/libc.so

While setting stuff like that up took some time, it permits me to tweak
just what goes into things as my Linux distributions update out of step
with the releases of DB2 change. It got this way when I upgraded from Red
Hat Linux 6.2 to 7.3 when I was still running DB2 V6.1. V6.1 needed old
libraries which were in a compatibility library somewhere, and an old
ldd.so (I think it was). It took a while to figure that out, and I am glad
I did, because recently I installed RHEL 3 ES and DB2 V8.1.5, and 8.1.5 is
already considered behind the times by Red Hat and must use a
compatability compiler (though the libraries this time are OK).

--
.~. Jean-David Beyer Registered Linux User 85642.
/V\ Registered Machine 241939.
/( )\ Shrewsbury, New Jersey http://counter.li.org
^^-^^ 07:00:00 up 2 days, 15:59, 5 users, load average: 2.09, 2.14, 2.09

Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: smjmitchell | last post by:
Hi All, I have written a program in VB 6.0 that I would like to distribute to many users (most likely via freeware / shareware). The program is a relatively simple and does not call any external...
0
by: Johnathan Doe | last post by:
I've been thinking about what the issues would be in compiling Python into native machine code, and since type information is important in Python, it seems possible that Python code can be...
2
by: Erik | last post by:
Hi Everyone, I'm having real problems compiling some source for eVC4++. The errors I am getting are below: It all seems to be centred around winsock. If I move the afsock.h reference to before...
1
by: Jim Heavey | last post by:
Hello, trying to round out my knowlege here about compiling. To date I have used VS.Net to do all my compiling "majically", but I want to understand how to do it on my own, should the need ever...
0
by: erkidevries | last post by:
Problem compiling Tkinter program with bmp images (using py2exe) I have a Tkinter gui program that uses bmp as backgrounds. The program itself works when I run from the source. I placed the...
1
by: Riaan | last post by:
I am compiling my app (including CODEBASE database headers) but as soon as i compile it gives me the following errors : c:\Program Files\Microsoft Visual Studio\VC98\Include\UTILITY(81) : warning...
2
by: stevenruiz | last post by:
Hi Everyone, The Strings.h has the function Get_Line which is defined and the error is shown below: Strings.h: void get_line( istream & );
2
by: renagade629 | last post by:
Can anybody help me understand what i'm doing wrong or what I'm missing? Is there anyother good and commendable C++ program I can use (free) from the internet like Dev C++? I'm having trouble doing...
1
by: jon2211 | last post by:
I tried to compile some code with #include <shellapi.h. I am linking shell32.lib. I am not trying to use ShellExecute() but right now just getting the code to compile with the header file an...
10
by: Tomás Ó hÉilidhe | last post by:
I'd post this on a gcc newsgroup but I'd be more productive talking to the wall. Anyway, let's say someone throws some source code at you for a particular program and says, "Just compile it, it...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.