Author Topic: Using Blaze with Code::Blocks  (Read 2759 times)

Offline gvanderzwan

  • Single posting newcomer
  • *
  • Posts: 2
Using Blaze with Code::Blocks
« on: April 05, 2018, 11:52:07 am »
I am trying to use the Blaze math library in CB, but keep getting tons of errors in the building process.

The example program I use is a pared down version of FirstExample from the Blaze wiki:
Code
#include <blaze/Math.h>

using blaze::StaticVector;
using blaze::DynamicVector;

int main()
{
    StaticVector<int,3UL> a{ 4, -2, 5 };

    std::cout << "a =\n" << a << "\n";

    return 0;
}

Running this program from a terminal works fine, with the command line

g++  -std=c++1y -o FirstExample FirstExample.cpp
./FirstExample

In the CB  "build options" I did check "Have g++ follow the C++11ISO C++ language standard, and the global compiler settings does link to the correct compiler in toolchain executables. Although in /usr/bin  gcc/g++ is a link to gcc-6/g++-6, but I also tried gcc-6/gcc-6 directly, which does not work either. I also tried putting -std=c++1y in "Other linker options" without success. I'm using Ubuntu 14.04.

I am more or less out of options to try (I even uninstalled and reinstalled CB in the hope it would pick up the correct gcc, also to no avail), but I would really like to use both CB and this library. Help will be appreciated.
« Last Edit: April 05, 2018, 11:55:54 am by gvanderzwan »

Offline gvanderzwan

  • Single posting newcomer
  • *
  • Posts: 2
Re: Using Blaze with Code::Blocks
« Reply #1 on: April 05, 2018, 12:03:53 pm »
Found it, I think.

I added -std=c++1y to "Other options" in "Compiler settings" and that seems to help. I leave the post in case someone else runs into this problem.
« Last Edit: April 05, 2018, 12:13:27 pm by gvanderzwan »

Offline sodev

  • Regular
  • ***
  • Posts: 497
Re: Using Blaze with Code::Blocks
« Reply #2 on: April 05, 2018, 11:23:12 pm »
The latest Blaze library requires C++14, therefor just enabling C++11 is not enough.

This is a compiler setting and not a linker setting so it has to be put in the compiler settings, apparently your CodeBlocks is older than mine, because mine already has at least C++1y (the non-final name of C++14) in its settings. Otherwise you can, like you already figured out, put any to CodeBlocks unknown settings in the Other compiler options tab.