I'm learning C++ using the learncpp website, i'm on Windows 64bits and i'm using GCC with C++14.
I tried to implement the example in the std::bitset parts of this chapter : http://www.learncpp.com/cpp-tutorial/3-8a-bit-flags-and-bit-masks/
No error at compile time but when I launch the program I get this error :
Here is my code :
#include <iostream>
#include <iomanip>
#include <cstdint>
#include <cmath>
#include <bitset>
int main()
{
const int option0 = 0;
const int option1 = 1;
const int option2 = 2;
const int option3 = 3;
const int option4 = 4;
const int option5 = 5;
const int option6 = 6;
const int option7 = 7;
std::bitset<8> bits(0x2); // we need 8 bits, start with bit pattern 0000 0010
bits.set(option4); // set bit 4 to 1 (now we have 0001 0010)
/*bits.flip(option5);
bits.reset(option5);
std::cout << "Bit 4 has value: " << bits.test(option4) << '\n';
std::cout << "Bit 5 has value: " << bits.test(option5) << '\n';
std::cout << "All the bits: " << bits << '\n';*/
}
You have to know that if we remove the set function no error is thrown.
I think that there is a problem in the option initialization but can't figure it out :/
Here is a (very inaccurate) translation for the error : "The procedure entry point _ZSt24__throw_out_of_range_fmtPKcz can't be found in the dynamic link library"
Thanks in advance.