Stupid, stupid C newb question

Stephen F. Booth me at sbooth.org
Thu Nov 8 03:58:13 UTC 2012


To get rid of the warnings you'll need to remove the semicolons following your #includes.

The "lib" prefix is implied in the -l option, so the flag should just be -ltag instead of -lllibtag.

Stephen 

On Wednesday, November 7, 2012 at 7:54 PM, Jeremy Gregorio wrote:

> Forgive me for asking this, but I'm banging my head against the wall because IDEs have spoiled me,
> 
> I want to do hello world in taglib. I've done it before years ago, but can't remember how.
> 
> I built taglib staticly in Linux using:
> 
> cmake -DENABLE_STATIC=ON  -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_RELEASE_TYPE=Release .
> make
> make install
> 
> It worked like a charm and I now have 
> 
> /usr/local/lib/libtag.a
> and the whole
> /usr/local/include/taglib/ folder with the headers
> 
> Here's my little cpp
> 
> // my first program in C++
> 
> #include <iostream>
> using namespace std;
> #include "tag.h";
> #include "fileref.h";
> 
> int main ()
> {
> 
>  TagLib::FileRef f("Latex Solar Beef.mp3");
>  TagLib::String artist = f.tag()->artist(); // artist == "Frank Zappa"
> 
>  f.tag()->setAlbum("Fillmore East");
>  f.save();
> 
>  TagLib::FileRef g("Free City Rhymes.ogg");
>  TagLib::String album = g.tag()->album(); // album == "NYC Ghosts & Flowers"
> 
>  g.tag()->setTrack(1);
>  g.save();
> 
>   return 0;
> }//END MAIN
> 
> And I try to build with:
> 
> g++ -o hello2 hello.cpp -I/usr/local/include/taglib/  -L/usr/local/lib/ -llibtag
> 
> But I get back:
> 
> hello.cpp:5:17: warning: extra tokens at end of #include directive [enabled by default]
> hello.cpp:6:21: warning: extra tokens at end of #include directive [enabled by default]
> /usr/bin/ld: cannot find -llibtag
> collect2: ld returned 1 exit status
> 
> I know I'm just doing something dumb, but for the life of my I can't remember what. :P
> 
> -- 
> Jeremy D Gregorio
> Sr Consultant
> #: 520-275-5352
> fax: 520-747-2540
> 
> 
> 
> _______________________________________________
> taglib-devel mailing list
> taglib-devel at kde.org (mailto:taglib-devel at kde.org)
> https://mail.kde.org/mailman/listinfo/taglib-devel
> 
> 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/taglib-devel/attachments/20121107/9c8fd4f1/attachment.html>


More information about the taglib-devel mailing list