Tuesday, August 18, 2009

To hell with system installs of boost

So in my last post I ranted about the inline keyword...

Not so fast.

So if you include and then compile like so:

g++ -o main.exe src/*.o -L $BOOSTROOT/lib -l boost_regex

and not realizing that the system you use ( some old redhat installation ) has its own boost regex from 5 years ago... you'll pick up headers that have symbols in them which will not exist in the latest 1.39 or whatever you use release.

So you'll get this garbage:

undefined reference to `boost::reg_expression
undefined reference to `boost::reg_expression
undefined reference to `boost::reg_expression
undefined reference to `boost::re_detail
undefined reference to `boost::c_regex_traits


however if you fix that g++ command like so:

g++ -o main.exe src/*.o -L $BOOSTROOT/lib -l boost_regex -I $BOOSTROOT/include

You'll be a happier person.

1.32 include files will not work with 1.39 libraries, of course we all knew this... we just didn't specify the include path.

c++ keyword inline actually matters

So today I've learned a very valuable lesson. The lesson could be translated into dollar price tag, but then I'd be giving away personal information.

Recently I've taken an approach to create a bloated structure which allow's dynamic binary data to be put together at runtime and packed nicely into whatever buffer you want.

One of my functions includes references to boost regex tools. The whole thing is being written inside a header file, no source file.

My main file includes this source file. The functions in the wrapper are placed outside the actual class definition, and for the most part I had been using the keyword inline to let the compiler know it's a function which should be used inline.

In the end, I left out the inline for these boost regex function and was left with a good 20 lines of undefined references which left me bothered, annoyed and confused. After having let 2 co-workers give up completely on the situation at hand... I took a small break, came back, and noticed the lack of the inline keyword... I then sat there, stared and imagined in my head.

If the inline keyword is missing, where's main.o supposed to get that code? It doesn't exist basically, which in the end made me realize all over again like senior year, exactly what inline does and how it works.

So I threw in the inline.

It compiled.

The end.

The importance of blogging.

So I've been in a all bottled up for like 3 years now. I've recently learned it's very important to get my ideas, feelings and concerns out into the open, either with a significant other or a website like I used to at 13 through 21.

I used to host my own website, staticx.net, but I've gotten so busy with more important things in life, I find hosting and maintaining my own server and such just too much hassle.

That hassle isn't just the domain names, the DNS records, the verification of account information, the RAID hard disk maintenance, ECC ram upgrades and such, it's also the part that I'm doing it all by myself which is amazingly annoying when you don't care.

So I've turned to blogger.com, let's get started.