我正在尝试使用汇编程序版本6.1在aix6.1上用g++4.6.1编译c代码。
由于以下原因,编译失败:-
line 3954495: 1252-171 The displacement must be greater than or equal to
-32768 and less than or equal to 32767.
line 3955281: 1252-171 The displacement must be greater than or equal to
-32768 and less than or equal to 32767.
line 3955395
因此,我被要求在AIX7 (64位)机器上编译一些遗留的C代码。
而且,我刚刚修改了makefile以编辑所使用的编译器(从gcc到xlc_r)和标志,从(-DAIX3到-DAIX7)。
然而,由于这个愚蠢的做法,我得到了一个错误,它抱怨
xlc_r -c -q64 -O -DAIX -DAIX7 log.c
"log.c", line 128.7: 1506-343 (S) Redeclaration of log_write differs from previous declaration on line 140 of "lib.h".
我只是C++的初学者。我正在尝试构造一些头文件header.h,但输出总是如下所示:
/tmp/ccTmZKXX.o: In function `main':
main.c:(.text+0x13): undefined reference to `func'
collect2: ld returned 1 exit status
你能帮我检查一下我使用头文件的方式是否正确吗?非常感谢!
主代码(main.c):
#include "stdio.h"
#include "func.h"
main() {
double a = f(2.3
在我的项目的这个特定领域,我把信息放在前面,他命令行做不同的事情。即使程序按原样正确执行,我也会得到这个错误。
lab2.c:86: error: conflicting types for ‘rrotate’
lab2.c:67: error: previous implicit declaration of ‘rrotate’ was here
下面是函数以及调用它的位置。
呼叫:
else if(strcmp(action, compare_r) == 0)
{
/* unsigned long rrotate(unsigned long x, int
我使用TCL在AIX机器上执行以下代码,但它失败了
失败原因是在AIX LPAR上以某种方式缺省启用了'gcc‘。
我要封杀gcc。我该怎么做呢?
AC_DEFUN(SC_ENABLE_GCC, [
AC_ARG_ENABLE(gcc, [ --enable-gcc allow use of gcc if available [--disable-gcc]],
[ok=$enableval], [ok=no])
if test "$ok" = "yes"; then
CC=gcc
我在学习"strtok“函数时发现了一个奇怪的问题。起初,我在编写演示程序时遗漏了一个头文件,如下所示:
/* strtok example */
#include <stdio.h>
//#include <string.h> // the header file I've missed at first
int main ()
{
char str[] ="- This, a sample string.";
char * pch;
printf ("Splitting string \"%s
假设在bar.h中可能存在:
static inline int fun () { return 2; }
为了确保始终定义fun,foo.h包含以下内容:
static inline int fun () { return 3; }
当bar.h包含该定义时,以下是否会引发未定义的行为?
#include "foo.h" /* ensure there is always a definition */
#include "bar.h" /* use the bar definition if it exists */
int main () {
/*
假设代码:
extern int foo(void);
static int foo(void)
{
return 0;
}
试着和GCC一起编译
$ gcc -Wall -std=c99 1.c
1.c:3:12: error: static declaration of ‘foo’ follows non-static declaration
1.c:1:12: note: previous declaration of ‘foo’ was here
1.c:3:12: warning: ‘foo’ defined but not used [-Wunused-func
我收到了关于lstat被隐式声明的警告,但是应该在包含的头中显式声明它。
汇编如下:
// Standard library
#include <stdio.h>
// Feature test macro
#define _POSIX_C_SOURCE 200809L
// POSIX inclusions
#include <sys/stat.h>
// Function
int main()
{
struct stat x;
char* s = "/data/file";
char* t = "/data/link&
我希望在AIX上编译proftpd,使它可以在其他服务器上部署,而不必在每个服务器上重新安装所有gnu库。
我已经设法编译它的动态,但我不能设法使它编译的选项
LDFLAG="-Wl,-static"
比如官方的proftpd文档中的建议。
这是我得到的config.log错误
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by conf
希望这是一个非常简单的问题。下面是我的C pgm (test.c)。
#include <stdio.h>
//#include <stdlib.h>
int main (int argc, char *argv[]) {
int intValue = atoi("1");
double doubleValue = atof("2");
fprintf(stdout,"The intValue is %d and the doubleValue is %g\n", intValue, double
这个程序违背了我在C语言中学到的所有东西,它是如何编译的?为什么这不需要是int main?为什么不返回0?您不需要在main上初始声明sub()吗?这真让我抓狂。我喜欢将我的函数保持在main之上。
#include <stdio.h>
main()
{
sub ();
sub ();
}
sub()
{
static int y = 5;
printf(" y is %d \n",y);
y++;
}
gcc的版本是:
gcc version 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC)
这似乎
我在一些软件上工作,它加载一组用户指定的共享对象。我想在我们的“加载器”组件中添加一些代码,该组件可以查询每个指定的共享对象,并找出用于构建/链接该共享对象的编译器和编译器版本。
在过去,我已经能够使用“字符串-a \ grep”方法,如下所示。但是,这种方法并不适用于power AIX上用g++ 4.8编译的代码,对于在x86 linux上使用g++ 4.8编译的代码也不是很好。
如果可能的话,我也希望找到一些更干净的方法来获取这些信息,而不是对字符串进行打招呼。
任何人都可以就如何查询共享对象的名称以及编译器的版本提供建议吗?
下面是一些来自我当前技术的示例命令和输出:
on x86 l
我正在尝试从AIX6.5机器上的源代码构建python2.6.8,但是有几个模块无法成功构建。在构建过程中,有一个XLC手册页跳出并停止运行。我必须按q键结束手册页,这个过程将继续进行。所以我在考虑是否是因为构建调用了默认的XLC编译器,并且我试图将默认编译器更改为g++:
make clean
CC=/bin/gcc CXX=/bin/g++ ./configure
make
但它似乎不起作用,XLC手册页仍然弹出,模块无法构建。
如何确保它将使用g++而不是XLC?谢谢。
更新
这是CC=/bin/gcc CXX=/bin/g++ ./configure之后的日志
-bash-3.2$ C
我遇到了来自gcc 4.1.2的以下警告:
warning: comparison is always false due to limited range of data type
相关的C代码如下所示:
if ( unlikely(count < 0) ) BUG();
其中'count‘是无符号的。
我尝试禁用该警告,因为我不允许修改源代码:
-Wno-type-limits
但似乎gcc 4.1.2并不支持它。
cc1: error: unrecognized command line option "-Wno-type-limits"
有没有其他方法可以
我正在使用IBM的XL编译器处理AIX。我正在捕获一个编译错误,我不知道如何继续:
$ xlc -g3 -O0 -qarch=pwr8 -qaltivec fips197-p8.c -o fips197-p8.exe
"fips197-p8.c", line 59.16: 1506-754 (W) The parameter type is not valid for a function of this linkage type.
相关的源代码如下所示。完整的源代码可在上获得。源代码是Power 8 __cipher和__vcipherlast的测试驱动程序。它有一个主函数和