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

Unable to compile c++ code in Fedora linux

Saurabh_Pradhan
Beginner
672 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
672 Views

Hi,

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

Regards,

Viet 

jean-charles_b_
Beginner
672 Views

Hello,

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

Regards

Jean-Charles

Saurabh_Pradhan
Beginner
672 Views

Thanks. That actually worked.

parker__john
Beginner
672 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
672 Views
#include <iostream>
int main ()
{
        std::cout<<"Hello world !" <<std::endl ; 
        return 0 ; 
}

add the "-ansi" option

full codes

Reply