Pro-C/C++編譯找不到 stddef.h 檔案的解決辦法
阿新 • • 發佈:2019-01-28
以編譯一個 sample 為例,出現找不到 “stddef.h” 檔案的錯誤,如下:
$ proc sample.pc
Pro*C/C++: Release 11.2.0.1.0 - Production on Wed Dec 26 00:40:15 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
System default option values taken from: /usr/local/oracle/product/11.2.0/dbhome_1/precomp/admin/pcscfg.cfg
Error at line 33, column 10 in file /usr/include/stdlib.h
#include <stddef.h>
.........1
PCC-S-02015, unable to open include file
Error at line 147, column 10 in file /usr/include/sys/types.h
#include <stddef.h>
.........1
PCC-S-02015, unable to open include file
Error at line 25, column 10 in file /usr/include/alloca.h
#include <stddef.h>
.........1
...........
解決辦法:
1. 先確定 stddef.h 在gcc的哪個目錄下
find /usr -name stddef.h
/usr/lib/gcc/x86_64-redhat-linux/4.4.4/include/stddef.h
2. 在 $ORACLE_HOME/precomp/admin/pcscfg.cfg 檔案中加入這個目錄
/usr/lib/gcc/x86_64-redhat-linux/4.4.4/include/
然後再編譯:
$ proc sample.pc
$ proc sample.pc
Pro*C/C++: Release 11.2.0.1.0 - Production on Wed Dec 26 00:40:15 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
System default option values taken from: /usr/local/oracle/product/11.2.0/dbhome_1/precomp/admin/pcscfg.cfg
Error at line 33, column 10 in file /usr/include/stdlib.h
#include <stddef.h>
.........1
PCC-S-02015, unable to open include file
Error at line 147, column 10 in file /usr/include/sys/types.h
#include <stddef.h>
.........1
PCC-S-02015, unable to open include file
Error at line 25, column 10 in file /usr/include/alloca.h
#include <stddef.h>
.........1
...........
解決辦法:
1. 先確定 stddef.h 在gcc的哪個目錄下
find /usr -name stddef.h
/usr/lib/gcc/x86_64-redhat-linux/4.4.4/include/stddef.h
2. 在 $ORACLE_HOME/precomp/admin/pcscfg.cfg 檔案中加入這個目錄
/usr/lib/gcc/x86_64-redhat-linux/4.4.4/include/
然後再編譯:
$ proc sample.pc
生成對應的 sample.c 檔案,問題解決。