Sunday, November 24, 2013

Using EasyLogging++ on Apple Mac OSX 10.8.5

To use EasyLogging++ on Apple Mac OSX 10.8.5, you need to add:

-std=c++11 -stdlib=libc++

to your compiler options.

So, for a hello world example paste this into a file hello.cpp:

#include "easylogging++.h"

_INITIALIZE_EASYLOGGINGPP

int main(int argv, const char** argc) {
    LOG(INFO) << "Hello, world";
    return 0;
}


and compile it with:

g++ -std=c++11 -stdlib=libc++ hello.cpp -o hello

Run the program:

./hello

That will give you something similar to:

24/11/2013 11:46:52,297 INFO  [default] Hello, world