Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to Set up the execution context to run the test

Here's my current setup:

  • I've got a set of Unit Tests that run flawlessly
  • I've got a set of libraries all compiled as static .lib
  • The unit test project is compiled as a .dll and contains a number of classes

I recently added a class, namely MyCoolClass.h:

#include "AnotherBoringClass.h" // also inherits from BoringClass

class SuperCoolClass: public BoringClass
{
    /*
     * My super cool implementation
    */
protected:
    std::shared_ptr<AnotherBoringClass> myCoolPointer;
}

Everything is fine, compiles and so on. But when I try to add a unit test:

#include "CppUnitTest.h"
#include "MyCoolClass.h"

TEST_CLASS(MyTestClass)
    {
    public:
        /*
         * Bunch of super cool -working- tests
        */
        TEST_METHOD(MyBrokenTest)
        {
            auto myVar = std::make_shared<MyCoolClass>();  // as soon as I comment this line everything works!!!
        }
    }

When I comment the line as above everything work well! What am I doing wrong?

What I've tried:

  • This, but I've got everything in the same output folder. Also, I make use of QuantLib and Boost, but all other Unit Tests work fine

  • Same as previous link

Thanks in advance!

like image 549
7raiden7 Avatar asked Oct 24 '25 00:10

7raiden7


1 Answers

After an endless effort to solve the problem, I finally did it. It was because I was using MKL linked statically, whereas my program was compiled using the option Property -> C/C++ -> Code Generation -> Runtime Library -> xxx DLL.

Hope it helps!

like image 182
7raiden7 Avatar answered Oct 26 '25 14:10

7raiden7



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!