Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.
7679 Discussions

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

Garcia__Javier
Beginner
517 Views

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
518 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
518 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