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

Problem with #include <climits>

mnaydin
Beginner
1,141 Views
Hi,

I hava problems compiling C++ programs which includes climits. The operating system is Debian Linux (64-bit), icc version is 12.0.4, gcc version is 4.3.2. The following test program does not compile with icpc (but it compiles with g++):

#include
#include
int main()
{
std::cout << INT_MAX << "\\n";
return 0;
}


The error message:
/usr/include/limits.h(125): catastrophic error: cannot open source file "limits.h"
# include_next
^

compilation aborted for test.cpp (code 4)

Interestingly, when I use #include , instead of #include , the test program compiles with icpc and runs correctly.
0 Kudos
4 Replies
bernaske
New Contributor I
1,141 Views
Hi,

i have compile your sample with icpc 12.0.4.20110427 version under openSUSE 12.1 M1 64 Bit linux
without any problems, i think its a OS or environment setting problem,
on openSUSE 12.1 the Intel ICC/ICPC Version 12.0.4.20110427 works without troubles with your sample

regards
Franz
0 Kudos
Om_S_Intel
Employee
1,141 Views
I can also compiler the code in FC11 using icc 12.0.4.191. Could you please try compiling with gcc?

Om
0 Kudos
Scheibe__Patrick
New Contributor I
1,141 Views
Hi,
same problem here: Ubuntu 10.04,g++ (Ubuntu 4.4.3-4ubuntu5) 4.4.3, icpc12.0.4 20110427
Compiling the small sample program with icpc gives the same error message. Compiling it with g++ works fine.
When I compile the sample with
icpc -Wall -I /opt/intel/composerxe/include
it works but on my real program I get then the warnings
/opt/intel/composerxe/include/math.h(19): warning #561: nonstandard preprocessing directive
# include_next /* utilize and expand sys header */
/opt/intel/composerxe/include/math.h(19): warning #561: nonstandard preprocessing directive # include_next /* utilize and expand sys header */
Any ideas?
Cheers
Patrick
0 Kudos
Scheibe__Patrick
New Contributor I
1,141 Views
Hi again,
it seems the problem is the compilervars_arch.sh script. When you look at the other scripts which were made for
tbb, ipp, mkl than you see that they set the CPATH to the corresponding include directory. The include path of the
compiler is not set. When I add
if [ -z "${CPATH}" ]; then
CPATH="${INSTALL_DIR}/compiler/include"; export CPATH
else
CPATH="${INSTALL_DIR}/compiler/include:$CPATH"; export CPATH
fi
if [ -z "${CPATH}" ]; then CPATH="${INSTALL_DIR}/compiler/include"; export CPATHelse CPATH="${INSTALL_DIR}/compiler/include:$CPATH"; export CPATH
fi
to the
/opt/intel/composerxe-2011.4.191/pkg_bin/compilervars_arch.sh
script it seems everything is running fine.
Cheers
Patrick
0 Kudos
Reply