编译错误 [英] Compile Error

查看:75
本文介绍了编译错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Solaris 10 6/06 SPARC计算机上。我试图为Asterisk编译声音播放器

app并收到以下错误:


有人可以提供解释或解决方法吗?谢谢!


xxdev2:12:24:/opt/sft/voip/asterisk-addons-1.2.5/format_mp3gmake

gcc -pipe -fPIC - Wall -Wstrict-prototypes -Wmissing-prototypes

-Wmissing-declarations -D_REENTRANT -D_GNU_SOURCE -O6

-I / usr / include / -I / u01 / app / oracle / product / primary / rdbms / public /

-I / usr / local / include -I / usr / local / openldap / include

-I / usr / local / BerkeleyDB.4.4 / include -I / usr / local / ssl / include

-I / usr / local / imap-2006a / include -I / usr / local / pgsql / include

-I / usr / local / mysql / include / mysql / include -I / opt / asterisk / usr / include -c

-o format_mp3.o format_mp3.c

来自/opt/asterisk/usr/include/asterisk/channel.h:109的文件,
来自format_mp3.c的
:21:

/ opt / asterisk / usr / include / asterisk / frame.h:289:错误:语法错误
$'b $ b''u_int16_t''

/ opt / asterisk / usr / include / asterisk /frame.h:289:警告:没有分号

结构或联合结束

/opt/asterisk/usr/include/asterisk/frame.h:299:警告:在''数据'声明中键入默认值

到''int''

/opt/asterisk/usr/include/asterisk/frame.h:299:警告:数据定义

没有类型或存储类

/ opt / asterisk / usr /include/asterisk/frame.h:300:错误:语法错误
在''}''之前的
令牌

在format_mp3.c中包含的文件中:21:

/opt/asterisk/usr/include/asterisk/channel.h:在函数''ast_select''中:

/ opt / asterisk / usr / include / asterisk / channel。 h:1159:警告:隐含

函数声明''timersub''

gmake:*** [format_mp3.o]错误1

违规行代码:


struct ast_option_header {

/ *始终保持网络字节顺序* /

#if __BYTE_ORDER == __BIG_ENDIAN

u_int16_t flag:3;

u_int16_t选项:13;

#else

#if __BYTE_ORDER == __LITTLE_ENDIA N

u_int16_t选项:13;

u_int16_t标志:3;

#else

#error字节顺序没有定义

#endif

#endif

u_int8_t data [0];

}; // line 300 frame.h


GCC版本:


xxdev2:12:24:/ opt / sft / voip / asterisk-addons -1.2.5 / format_mp3gcc -v

使用内置规格。

目标:sparc-sun-solaris2.10

配置:

/net/tibia/export/bldmstr/nightly/20060817_mars_gcc.s10.opt.tarbuild/src/configure

--prefix = / opt / gcc --enable- shared --with-system-zlib

--enable-checking = release --disable-libmudflap --enable-languages = c,c ++

--enable-version -specific-runtime-libs

--with-gxx-include-dir = / opt / gcc / include / c ++ / 4.0.3 --with-cpu = v9

线程模型:posix

gcc版本4.0.3(gccfss)

I am on a Solaris 10 6/06 SPARC machine. I tried to compile sound player
app for Asterisk and got the following error:

Can someone provide an explanation or work around? Thanks!

xxdev2:12:24:/opt/sft/voip/asterisk-addons-1.2.5/format_mp3gmake
gcc -pipe -fPIC -Wall -Wstrict-prototypes -Wmissing-prototypes
-Wmissing-declarations -D_REENTRANT -D_GNU_SOURCE -O6
-I/usr/include/ -I/u01/app/oracle/product/primary/rdbms/public/
-I/usr/local/include -I/usr/local/openldap/include
-I/usr/local/BerkeleyDB.4.4/include -I/usr/local/ssl/include
-I/usr/local/imap-2006a/include -I/usr/local/pgsql/include
-I/usr/local/mysql/include/mysql/include -I/opt/asterisk/usr/include -c
-o format_mp3.o format_mp3.c
In file included from /opt/asterisk/usr/include/asterisk/channel.h:109,
from format_mp3.c:21:
/opt/asterisk/usr/include/asterisk/frame.h:289: error: syntax error
before ''u_int16_t''
/opt/asterisk/usr/include/asterisk/frame.h:289: warning: no semicolon at
end of struct or union
/opt/asterisk/usr/include/asterisk/frame.h:299: warning: type defaults
to ''int'' in declaration of ''data''
/opt/asterisk/usr/include/asterisk/frame.h:299: warning: data definition
has no type or storage class
/opt/asterisk/usr/include/asterisk/frame.h:300: error: syntax error
before ''}'' token
In file included from format_mp3.c:21:
/opt/asterisk/usr/include/asterisk/channel.h: In function ''ast_select'':
/opt/asterisk/usr/include/asterisk/channel.h:1159: warning: implicit
declaration of function ''timersub''
gmake: *** [format_mp3.o] Error 1
Offending lines of code:

struct ast_option_header {
/* Always keep in network byte order */
#if __BYTE_ORDER == __BIG_ENDIAN
u_int16_t flag:3;
u_int16_t option:13;
#else
#if __BYTE_ORDER == __LITTLE_ENDIAN
u_int16_t option:13;
u_int16_t flag:3;
#else
#error Byte order not defined
#endif
#endif
u_int8_t data[0];
}; //line 300 frame.h

GCC version:

xxdev2:12:24:/opt/sft/voip/asterisk-addons-1.2.5/format_mp3gcc -v
Using built-in specs.
Target: sparc-sun-solaris2.10
Configured with:
/net/tibia/export/bldmstr/nightly/20060817_mars_gcc.s10.opt.tarbuild/src/configure
--prefix=/opt/gcc --enable-shared --with-system-zlib
--enable-checking=release --disable-libmudflap --enable-languages=c,c++
--enable-version-specific-runtime-libs
--with-gxx-include-dir=/opt/gcc/include/c++/4.0.3 --with-cpu=v9
Thread model: posix
gcc version 4.0.3 (gccfss)

推荐答案

您是否包含stdint.h?

Did you include stdint.h?





2006年12月13日星期三,Mikail Dellovich写道:


On Wed, 13 Dec 2006, Mikail Dellovich wrote:

我在Solaris 10 6/06 SPARC机器上。我试图为Asterisk编译声音播放器应用程序

并得到以下错误:


有人可以提供解释或解决方法吗?谢谢!


xxdev2:12:24:/opt/sft/voip/asterisk-addons-1.2.5/format_mp3gmake

gcc -pipe -fPIC - Wall -Wstrict-prototypes -Wmissing-prototypes

-Wmissing-declarations -D_REENTRANT -D_GNU_SOURCE -O6 -I / usr / include /

-I / u01 / app / oracle / product / primary / rdbms / public / -I / usr / local / include

-I / usr / local / openldap / include -I / usr / local / BerkeleyDB.4.4 / include

-I / usr / local / ssl / include -I / usr / local / imap-2006a / include

-I / usr / local / pgsql / include -I / usr / local / mysql / include / mysql / include

-I / opt / asterisk / usr / include -c -o format_mp3.o format_mp3.c

包含在/的文件中opt / asterisk / usr / include / asterisk / channel.h:109,
来自format_mp3.c的
:21:

/ opt / asterisk / usr / include / asterisk / frame.h:289:错误:语法错误之前

''u_int16_t''

/opt/asterisk/usr/include/asterisk/frame.h:289:警告:结尾没有分号

结构或联合

/opt/asterisk/usr/include/asterisk/frame.h:299:警告:在''数据'声明中输入默认为

''int''

/opt/asterisk/usr/include/asterisk/frame.h:299:警告:数据定义已经

没有类型或存储类

/ opt / asterisk / usr / include / asterisk / frame.h:300:错误:语法错误之前

''}''令牌

包含在format_mp3.c中的文件:21 :

/opt/asterisk/usr/include/asterisk/channel.h:在函数''ast_select''中:

/ opt / asterisk / usr / include / asterisk /channel.h:1159:警告:隐含

函数声明''timersub''

gmake:*** [format_mp3.o]错误1


违规行代码:


struct ast_option_header {

/ *始终保持网络字节顺序* /

#if __BYTE_ORDER == __BIG_ENDIAN

u_int16_t flag:3;

u_int16_t选项:13;

#else

#if __BYTE_ORDER == __LITTLE_ENDIAN

u_int16_t选项:13;

u_int16_t标志:3;

#else

#error没有定义字节顺序

#endif

#endif

u_int8_t data [0];

}; //第300行frame.h
I am on a Solaris 10 6/06 SPARC machine. I tried to compile sound player app
for Asterisk and got the following error:

Can someone provide an explanation or work around? Thanks!

xxdev2:12:24:/opt/sft/voip/asterisk-addons-1.2.5/format_mp3gmake
gcc -pipe -fPIC -Wall -Wstrict-prototypes -Wmissing-prototypes
-Wmissing-declarations -D_REENTRANT -D_GNU_SOURCE -O6 -I/usr/include/
-I/u01/app/oracle/product/primary/rdbms/public/ -I/usr/local/include
-I/usr/local/openldap/include -I/usr/local/BerkeleyDB.4.4/include
-I/usr/local/ssl/include -I/usr/local/imap-2006a/include
-I/usr/local/pgsql/include -I/usr/local/mysql/include/mysql/include
-I/opt/asterisk/usr/include -c -o format_mp3.o format_mp3.c
In file included from /opt/asterisk/usr/include/asterisk/channel.h:109,
from format_mp3.c:21:
/opt/asterisk/usr/include/asterisk/frame.h:289: error: syntax error before
''u_int16_t''
/opt/asterisk/usr/include/asterisk/frame.h:289: warning: no semicolon at end
of struct or union
/opt/asterisk/usr/include/asterisk/frame.h:299: warning: type defaults to
''int'' in declaration of ''data''
/opt/asterisk/usr/include/asterisk/frame.h:299: warning: data definition has
no type or storage class
/opt/asterisk/usr/include/asterisk/frame.h:300: error: syntax error before
''}'' token
In file included from format_mp3.c:21:
/opt/asterisk/usr/include/asterisk/channel.h: In function ''ast_select'':
/opt/asterisk/usr/include/asterisk/channel.h:1159: warning: implicit
declaration of function ''timersub''
gmake: *** [format_mp3.o] Error 1
Offending lines of code:

struct ast_option_header {
/* Always keep in network byte order */
#if __BYTE_ORDER == __BIG_ENDIAN
u_int16_t flag:3;
u_int16_t option:13;
#else
#if __BYTE_ORDER == __LITTLE_ENDIAN
u_int16_t option:13;
u_int16_t flag:3;
#else
#error Byte order not defined
#endif
#endif
u_int8_t data[0];
}; //line 300 frame.h



< snip>

我想问题是编译器无法找到

u_int16_t类型的定义。解决方法是在使用之前添加适当的定义

的u_int16_t。据我所知,Solaris定义了

uint16_t类型(注意'u'之后缺少的下划线)。因此在定义struct ast_option_header

之前添加

以下行可能会有所帮助:


#include< stdint.h>


typedef uint8_t u_int8_t;

typedef uint16_t u_int16_t;


您应该将定义括在特定于平台的位置

#ifdef / #endif


发布到特定于Solaris的编程组也可能有所帮助。


Emil

<snip>

I suppose the problem is that the compiler could not find a definition of
the u_int16_t type. A workaround would be to add an appropriate definition
of u_int16_t before the usage. As far as I know, Solaris defines the
uint16_t type (notice the missing underscore between after ''u''). So adding
the following lines before the definition of struct ast_option_header
might help:

#include <stdint.h>

typedef uint8_t u_int8_t;
typedef uint16_t u_int16_t;

You should bracket the definitions with a platform-specific
#ifdef / #endif

Posting to a Solaris specific programming group might help as well.

Emil


dc ***** @ connx.com 写道:
dc*****@connx.com writes:

您是否包含stdint.h?
Did you include stdint.h?



stdint.h不会(不应该)帮助u_int16_t,因为

'不是标准名称。我打赌你在考虑uint16_t。

-

鉴于计算能力随着时间呈指数级增长,

算法具有指数或更好的O符号

实际上是一个大的常数线性。

- 麦克李

stdint.h will not (should not) help with u_int16_t, because
that''s not a standard name. I bet you''re thinking of uint16_t.
--
"Given that computing power increases exponentially with time,
algorithms with exponential or better O-notations
are actually linear with a large constant."
--Mike Lee


这篇关于编译错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆