简体   繁体   中英

How to link C/C++ for DB2 Express-C

I am required to use IBM DB2 and C/C++ (not an option). My compiler is gcc/cygwin64.

The self help approaches to this have lead to things that are either out of date or not right for my environment.

The best page (of many) I found so far was : http://www.eecs.yorku.ca/course_archive/2013-14/W/3421/db2notes/embed-c.html

I am now stuck at the last part, where we do the linking. What do I need to do to get this to compile and link on: Windows 8.1 / Cygwin64 using gcc ? (c++ eventually, any pointers on that would be helpful too). I am trying to get one of the c examples provided by IBM to compile, link, and run.

I changed the link command to use -ldb2api (just guessing here, there is no db2.lib in my copy of Express-C) which seems to get all the symbols resolved, but this gives many errors of 'relocation truncated to fit...'

Googling that sent me down another rat hole about def files which I still haven't figured out. Per the instructions on the page, no def file is being generated. I am not sure how, or if, fixing that would work. So far, my attempts to generate one based on examples haven't worked. Most help on that is quite old, so I am not really sure which ones to go for.

I would like to get this all to run 'standalone' without any of the .bat scripts or provided makefiles. That approach has already given me more fun than I can take. I am hoping this simpler approach will eventually work out.

So far, I got the latest DB Express-C up and running, and I am using the samples in the c directory provided by IBM. I am hoping this is the final step and there is not a new mountain behind it (other than the programming itself, of course). All components are current. Any help appreciated.

When you install DB2, you need to specify the Application Development, in order to include the headers. Otherwise, DB2 just install the binaries.

You can modify your installation, by adding this option to an existing installation.

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM