Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Saurabh_Pradhan
Beginner
401 Views

Unable to compile c++ code in Fedora linux

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
401 Views

Hi,

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

Regards,

Viet 

jean-charles_b_
Beginner
401 Views

Hello,

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

Regards

Jean-Charles

Saurabh_Pradhan
Beginner
401 Views

Thanks. That actually worked.

parker__john
Beginner
401 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.

 

paul__mike
Beginner
401 Views

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

add the "-ansi" option

full codes

Reply