Re: Undefined reference to just about everything... am I doing something wrong?

ace jones <[email protected]> Fri, 21 Oct 2005 19:18:48 -0700
Newsgroups gmane.comp.multimedia.libnjb.user
Message-ID <[email protected]>
Hi, Nate.  You need to link in libnjb, which defines those symbols.  You
probably should become familiar with:

http://www.faqs.org/docs/Linux-HOWTO/GCC-HOWTO.html

</Ace>

On Fri, 2005-10-21 at 15:23, Nate Freeman wrote:
> I recently compiled and installed libnjb-2.2.4 from source on a Mandrake 
> Linux system for use with a Dell DJ. I also installed gnomad2, but now I 
> want to work with the library a bit. However, I can't compile my own 
> programs for some reason. Gnomad2 works just fine, so I know that 
> something's working. Here's the source of my program and the command I'm 
> using to compile it. As you can see, I didn't get very far before I 
> started getting problems compiling.
> 
> /home/nfreeman/projects/dj_functions/dj_functions.cpp:
> 
>         #include <libnjb.h>
>         #include <stdio.h>
>         #include <string.h>
>        
>         int main(int argc, char **argv)
>         {
>         //There's actually quite a bit of code right here that deals 
> with the arguments to the program, but it doesn't really apply to the 
> situation so I just omitted it.
>         //Begin DJ initialization code.
>             int n = 1;
>             njb_t njbs[NJB_MAX_DEVICES], *njb;
>             njb_songid_t *songid;
>             if( NJB_Discover(njbs, 0, &n) == 1 );
>             {
>                 printf("***FATAL ERROR:\n   Jukebox Discovery failed.\n");
>                 return 3;
>             }
>             if( n == 0 )
>             {
>                 printf("***FATAL ERROR:\n   No Jukeboxes found.\n");
>                 return 3;
>             }
>             return 0;
>         }
> 
> And the compilation command and output (after changing to the correct 
> directory):
>         $ c++ ./dj_functions.cpp -o ./dj_functions
>         /home/nfreeman/tmp/ccELWHeO.o(.text+0x318): In function `main':
>         : undefined reference to `NJB_Discover'
>         collect2: ld returned 1 exit status
> 
> I'm at a loss here, but I've probably just done something stupid 
> somewhere. Any help is appreciated very much as I'm going crazy trying 
> to figure this out.
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by:
> Power Architecture Resource Center: Free content, downloads, discussions,
> and more. http://solutions.newsforge.com/ibmarch.tmpl
> _______________________________________________
> Libnjb-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/libnjb-users




-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl