Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

Unable to compile c++ code in Fedora linux

Saurabh_Pradhan
Beginner
1,511 Views

Hi,

I am unable to compile the following  c++ code. 

#include <iostream>
int main ()
{
        std::cout<<"Hello world !" <<std::endl ; 
        return 0 ; 
}

gcc version 8.0.1 20180131

icpc version 18.0.1 

Compilation Error :

icpc   hello.cpp
In file included from /usr/include/c++/8/bits/move.h(55),
                 from /usr/include/c++/8/bits/nested_exception.h(40),
                 from /usr/include/c++/8/exception(144),
                 from /usr/include/c++/8/ios(39),
                 from /usr/include/c++/8/ostream(38),
                 from /usr/include/c++/8/iostream(39),
                 from hello.cpp(1):
/usr/include/c++/8/type_traits(1061): error: type name is not allowed
        : public __bool_constant<__is_assignable(_Tp, _Up)>
                                                 ^

In file included from /usr/include/c++/8/bits/move.h(55),
                 from /usr/include/c++/8/bits/nested_exception.h(40),
                 from /usr/include/c++/8/exception(144),
                 from /usr/include/c++/8/ios(39),
                 from /usr/include/c++/8/ostream(38),
                 from /usr/include/c++/8/iostream(39),
                 from hello.cpp(1):
/usr/include/c++/8/type_traits(1061): error: type name is not allowed
        : public __bool_constant<__is_assignable(_Tp, _Up)>
                                                      ^

In file included from /usr/include/c++/8/bits/move.h(55),
                 from /usr/include/c++/8/bits/nested_exception.h(40),
                 from /usr/include/c++/8/exception(144),
                 from /usr/include/c++/8/ios(39),
                 from /usr/include/c++/8/ostream(38),
                 from /usr/include/c++/8/iostream(39),
                 from hello.cpp(1):
/usr/include/c++/8/type_traits(1061): error: identifier "__is_assignable" is undefined
        : public __bool_constant<__is_assignable(_Tp, _Up)>
                                 ^

compilation aborted for hello.cpp (code 2)

 

 

0 Kudos
5 Replies
Viet_H_Intel
Moderator
1,511 Views

Hi,

Seems like GCC version you have installed isn't supported by ICC 18.0.

Regards,

Viet 

0 Kudos
jean-charles_b_
Beginner
1,511 Views

Hello,

   if you add the "-ansi" option, it will compile.

Regards

Jean-Charles

0 Kudos
Saurabh_Pradhan
Beginner
1,511 Views

Thanks. That actually worked.

0 Kudos
parker__john
Beginner
1,511 Views

You need to install the GCC version is not supported by ICC 18.0. You can download the supported GCC version from rocketmail tech support. Then, you can run any C++ code to that supported GCC without compilation error.

 

0 Kudos
paul__mike
Beginner
1,511 Views
#include <iostream>
int main ()
{
        std::cout<<"Hello world !" <<std::endl ; 
        return 0 ; 
}

add the "-ansi" option

full codes

0 Kudos
Reply