Library creating

Started by
2 comments, last by Birdle 23 years, 2 months ago
Hello all, The other night I decide to have a go at making my own shared library. To start with I thought I would create a library containing one function which prints out a simple message so we do… #include void libmessage(void); void libmessage(void) { printf(“hello from lib\n”); } I then compile this as a shared library following the example in the manual with the compiler. I am using a version of gcc ported over to Qnx RtP. I then write a program to try and call this library and this is where the limit of my knowledge ends and guess work starts. So we do…. #include void libmessage(void); void main(void) { printf (“hello from program\n”); libmessage(); } Now when I try to compile this (linking it to my library as given in other examples in the manual) I get an error message saying something like undefined reference to libmessage(). (I think it was that, but I am not on my qnx machine at the moment and I forgot to write it down!). Any way I think it is something to do with the way I tell my program about the function in my library am I doing that part right? I did a search on the Internet but could not find anything about writing libraries so if you could tell me what I am doing wrong or direct me to a site about library creation I would be most grateful. Sorry for being so long Paul R
Advertisement
ops sorry about the double post

Paul R

If I''m not mistaken you are getting past the compile, but you are getting a linking error. You need to link your library (.lib) to your program. You''ll need to consult the help file for your compiler on how to do this, since it is compiler specific.


- Houdini
- Houdini
Thanks Houdini

There is an error at the linking stage, I will take it to a more appropiate web forum I was thinking along the lines there must be something wrong with my code and as the aim of figuring out libs is so I get make a 2d gamming library (mainly for fun and educating myself). I thought it would make a good first post on this web site, been lurking here for a while and it seems like a friendly place

thanks again

Paul R


This topic is closed to new replies.

Advertisement