Why does cout not work when using uBLAS io?

80 views Asked by At

I am using cygwin and I have boost 1.62.0 installed. I have compiled the following code using g++ and it functions as expected printing "Hi!" to the screen.

#include <iostream>

int main(){
    std::cout << "Hi!" << std::endl;
}

When I try to compile the following code, I get nothing on the console. No "Hi!" and no printout of my vector 'v' that I created.

#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/io.hpp>


int main () {
    using namespace boost::numeric::ublas;
    vector<double> v (3);
    for (unsigned i = 0; i < v.size (); ++ i) {
        v (i) = i;
    }
    std::cout << "Hi!" << std::endl;
    std::cout << v << std::endl;

}

Even inserting #include <iostream> at the top doesn't help. Why is this happening?

UPDATE: I created a new, simplified test case with the following code:

#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/matrix_proxy.hpp>
#include <boost/numeric/ublas/io.hpp>

int main(){
    std::cout << "Hi!" << std::endl;
    //boost::numeric::ublas::matrix<double> m (3, 3);
}

This program prints "Hi!" as expected and gives the return code "0" when I run $ echo $ at the prompt, but as soon as I uncomment the commented line, it doesn't output anything and the return code is "127".

0

There are 0 answers