Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Garcia__Javier
Beginner
259 Views

std::error_code, std::system_error and std::generic_category

Does the C++ standard library have these C++11 features?

My simple program:

#include <iostream>                     
                                        
std::error_code code;                   
                                        
int main() {                            
    std::cout << "Hello" << std::endl;
}                                       

fails to compile with the following error:

error: namespace "std" has no member "error_code"

This is the compile command I'm using:

icpc -std=c++11 -o test test.cpp

 

0 Kudos
2 Replies
Viet_H_Intel
Moderator
259 Views

What compiler version are you using? and you have GCC version < 5.1 

$ icpc t2.cpp -std=c++11 -V
Intel(R) C++ Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 19.0.4.243 Build 20190416
$ cat t2.cpp
#include <iostream>

std::error_code code;

int main() {
    std::cout << "Hello" << std::endl;
}
$
 

Garcia__Javier
Beginner
259 Views

I wasn't aware that icpc needed GCC to run. I've loaded a newer GCC version and now the program compiles fine.

Thanks!

Reply