GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 13-Dec-2003, 13:16
kenbrilliant kenbrilliant is offline
New Member
 
Join Date: Dec 2003
Posts: 1
kenbrilliant is an unknown quantity at this point
Angry

including external libraries


I'm fairly new to C++, and I'm writing a program at Uni for a project. I need to include a library from the Vienna RNA package www.tbi.univie.ac.at to use one of the functions in it.

I am using both linux (g++ compiler) and Windoze (Borland / DevC++), so a solution for either would suit me.

I have tried putting

#include "fold.h"

in my program (the header file that contains the function i want to use - the fold(char *, char *) function), and adding the c source file for that header to my Borland project, but when i try and use the function I get an 'unresolved external' error on compiling.

I figure it's something to do with object files, but I don't really get what these are - are they different under linux and win? (they have different file extensions, .o and .obj)?

when i use g++ under linux i get a similar error message.

could someone pleeeeeeeease tell me what to do, coz i know this is something that should be really easy to accomplish, and it's really annoying me coz all i need is one number from one goddamn function!!!!!!!!

just a run-thru of how to include external libraries, either for borland or for linux would be exceptionally useful, or even a link to an appropriate tutorial on the net.

Cheers

Will
  #2  
Old 15-Dec-2003, 13:06
Garth Farley Garth Farley is offline
Invalid Email Address
 
Join Date: May 2002
Location: Ireland
Posts: 638
Garth Farley is a jewel in the roughGarth Farley is a jewel in the roughGarth Farley is a jewel in the rough
I don't like combining 2 different compilers, I suggest you try to avoid it if possible. Object files *should* be the same no matter which compiler, but there may be differences between the .o file (fron gcc) and .obj (from borland), which the opposing compiler won't like.

Choose one compiler & stick to it.

Now. Object files are partially compiled source, files with no main function, just other functions. You've to explicitly tell the g++ compiler to include the .o file when compiling your main program, like so:
Code:
g++ -o program program.cc fold.o -lm

Then the compiler knows where these functions are available, and can include them.

Hope this helps
GF
 
 

Recent GIDBlogMore photos on Flickr by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Including Maps and strings?? maddie C++ Forum 17 05-Jul-2004 06:25
Including CGI JdS Free Web Hosting 5 08-Nov-2001 23:16
External Stylesheet Question JdS Web Design Forum 3 07-Sep-2001 16:48
Including Includes Guest Web Design Forum 1 16-Aug-2001 20:31

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 13:07.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.