Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
65 Views

Issue with cstring standard header

Dear all,

I have installed the C++ compiler with Parallels XE 2017 on a fresh Ubuntu 16.04 LTS distribution.

I am trying to compile a first test program, configured with CMake and the Unix Generator(icc).

Compilation fails on #include<cstring>, with a lot of messages like this:

    /usr/include/c++/5/cstring:75: error: the global scope has no "memchr" 
    using ::memchr;
  1. Is this normal that standard gcc headers are used? It seems no cstring header is shipped with icc.
  2. How can I fix this? Other stdlib c headers seem to work.

Thanks!

 

0 Kudos
3 Replies
Highlighted
Employee
65 Views

 

The Intel compiler does not ship its own set of headers, it uses the one on the system.

I don't have access to a Ubuntu 16.0 LTS distribution, but the problem seems to be that <cstring> has a using declaration which requires the <string.h> be included first and for some reason that isn't happening or the declaration of memchr is missing from string.h.

You should try preprocessing the file with GNU and with Intel and see what is different (use the -E or -P option).

I assume it compiles fine with g++.

thanks and let us know what you find out...

Judy

0 Kudos
Highlighted
Beginner
65 Views

Thanks for your answer! I figured out the issue, one of the files in the project was named "string.h" and had been added to the include path.

So in fact the Intel C++ Compiler for Linux is a drop-in replacement of g++, rather than a full C++ build environment. That's interesting!

Is it the same for the Windows version, does it require MSVC, or does it provide a full build environment with libraries and headers? May it be used with MinGW (windows gcc port) instead of MSVC?

Thanks

0 Kudos
Highlighted
Employee
65 Views

 

Glad to hear you figured it out.

Yes in order to be link compatible with the reference compiler (GNU on Linux and Microsoft on Windows and clang on MacOS) we have to use the same set of headers and libraries. For example the std::string class has to have the same size and layout or else you couldn't mix object files from the Intel compiler with ones produced from the GNU compiler. I doubt MinGW would work correctly, I don't think that is a supported platform.

Judy

 

0 Kudos