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

Cannot compile simple Hello world on Ubuntu 13.04

therob
Beginner
764 Views

Dear all,

I installed the latest Intel C++ compiler (13.1.1) on my machine running Ubuntu 13.04. Trying to compile the following simple program:

#include <iostream>

int main() {
std::cout << "Hello, world!" << std::endl;
return 0;
}

I get this error:

/usr/include/c++/4.7/iostream(39): catastrophic error: cannot open source file "bits/c++config.h"
#include <bits/c++config.h>

The missing file is located here /usr/include/x86_64-linux-gnu/c++/4.7/bits/c++config.h Compiling with gcc works just fine.

Is this some kind of incompatibility between the OS and the compiler or just the OS fault?

All the best.

0 Kudos
12 Replies
SergeyKostrov
Valued Contributor II
764 Views
Please provide a complete command line you used for review. This is a PATH related issue and you need to specify a path to a folder with header files. >>Is this some kind of incompatibility between the OS and the compiler No. >>or just the OS fault? No. For example, Let's say a support for MKL is needed in some application. In that case you need to specify paths to header files and library files ( it is a rule for any platform ). Here is how it looks like with a GCC-like compiler for header files only: ... @g++ ... -I ".../Composer XE/Mkl/Include" ... ...
0 Kudos
Sukruth_H_Intel
Employee
764 Views

Hi,

      Also i just want to know whether have you sourced he compiler script before using the ICC/ICPC compiler? This compiler script is usually located at <Installation_dir>/composer_XE_ver/bin/compilervars.sh ia32/intel64.

Regards,

Sukruth H V

0 Kudos
therob
Beginner
764 Views

Sorry for the late response.

I have sourced the compiler scripts, as suggested at the end of the installation process.

The compiler line I used are:

GCC: g++ hello_world.cpp -o hello_world.x

ICPC: icpc hello_world.cpp -o hello_world.x

I don't think it's a PATH related issue. In fact, if I compile adding a -I/path/to/header where the bits/c++config.h is the error it's still the same.

I "solved" making a symbolic link to the c++config.h header in the directory where the system is looking up. It's not really a solution but it works for the moment.

Best.

0 Kudos
SergeyKostrov
Valued Contributor II
764 Views
Thanks for the follow up. >>...I "solved" making a symbolic link to the c++config.h header in the directory where the system is looking up. It's not really >>a solution but it works for the moment... I see that it was an Access Rights issue for your account and it is good that you could proceed now with your task or project.
0 Kudos
miro_ilias
Beginner
764 Views

Hello,

even with proper including of header file I got this compilation error (fresh Ubuntu 13.04, 3.8.0-26-generic #38-Ubuntu SMP Mon Jun 17 21:43:33 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux), icpc (ICC) 12.1.3 20120212)

icpc helloworld.cpp -I/usr/include/x86_64-linux-gnu/c++/4.7

/usr/include/c++/4.7/ext/atomicity.h(48): error: identifier "__ATOMIC_ACQ_REL" is undefined
{ return __atomic_fetch_add(__mem, __val, __ATOMIC_ACQ_REL); }
^

/usr/include/c++/4.7/ext/atomicity.h(48): error: identifier "__atomic_fetch_add" is undefined
{ return __atomic_fetch_add(__mem, __val, __ATOMIC_ACQ_REL); }
^

/usr/include/c++/4.7/ext/atomicity.h(52): error: identifier "__ATOMIC_ACQ_REL" is undefined
{ __atomic_fetch_add(__mem, __val, __ATOMIC_ACQ_REL); }
^

/usr/include/c++/4.7/ext/atomicity.h(52): error: identifier "__atomic_fetch_add" is undefined
{ __atomic_fetch_add(__mem, __val, __ATOMIC_ACQ_REL); }
^

compilation aborted for helloworld.cpp (code 2)

Any help please ?

Miro

0 Kudos
SergeyKostrov
Valued Contributor II
764 Views
>>.../usr/include/c++/4.7/ext/atomicity.h(48): error: identifier "__ATOMIC_ACQ_REL" is undefined >>{ return __atomic_fetch_add(__mem, __val, __ATOMIC_ACQ_REL); } >>^ >> >>/usr/include/c++/4.7/ext/atomicity.h(48): error: identifier "__atomic_fetch_add" is undefined >>... Did you use -std=c++11 command line option?
0 Kudos
Melanie_B_Intel
Employee
764 Views

The #define symbols such as __ATOMIC_ACQ_REL are automatically predefined if the version of gcc in your environment is 4.7 or greater.  You can either modify your environment so that "gcc -v" is 4.7 or greater. Alternately you can use the Intel compiler options -gcc-name and -gxx-name. I personally favor modifying the environment. You can confirm gcc version compatibility by using the Intel compiler option -v--about the first line that's printed shows (gcc version xxx compatibility)

0 Kudos
rjharrison
Beginner
764 Views

I know it is an unsupported OS version, but has anyone got C++ 13.1 to work on Ubuntu 13.04?  Fixing the simple include path problems discussed above seems to just leave one with a set of inconsistent header files, e.g., in which many elements of the STL don't work.

0 Kudos
Vladimir_P_1234567890
764 Views

Hello,

Could you try to add to command line "-I/usr/include/x86_64-linux-gnu/c++/4.7" for 64-bit system or -I/usr/include/i386-linux-gnu/c++/4.7 for 32 bit system?

BTW, Composer XE 2013 Update 2 introduced new environment variables like below

[bash]

% setenv __INTEL_POST_CFLAGS "-I/usr/include/x86_64-linux-gnu/c++/4.7"

% icc hello.cpp

%

[/bash]

0 Kudos
rjharrison
Beginner
764 Views

As I said, that fixes the original include path problem but subsequently icpc chokes on many standard header files, as if it does not have some internal macros defined correctly.   I'll try to distil some code down to a fragment that reproduces the issues.

0 Kudos
rjharrison
Beginner
764 Views

My bad ... broken template code from repo ... compiler is functioning fine.

0 Kudos
Vladimir_P_1234567890
764 Views

Good to see that compiler works in this case.

thanks.
--Vladimir 

0 Kudos
Reply