首页 > 解决方案 > 如何使用 Oracle Solaris 10 1/13 s10s_u11wos_24a SPARC 在 C 中编译此程序

问题描述

大家好,我正在尝试正确编译 C 程序,但是当我运行程序时抛出错误无效参数。

我试图把架构类型像 -xarch=sparc 或 -m64 但没有

bash-3.2$ cc -c Prueba.c -o Prueba.o -xarch=sparc
bash-3.2$ chmod 777 Prueba.o
bash-3.2$ ./Prueba.o
bash: ./Prueba.o: Invalid argument
bash-3.2$ cat /etc/release
                   Oracle Solaris 10 1/13 s10s_u11wos_24a SPARC
  Copyright (c) 1983, 2013, Oracle and/or its affiliates. All rights reserved.
                            Assembled 17 January 2013

标签: csolarissparc

解决方案


您已将 C 文件编译为目标模块,而不是编译并与 C 运行时和库链接以创建可加载的可执行文件。

你需要更多类似的东西:

cc -o Prueba Prueba.c
chmod 777 Prueba
./Prueba

推荐阅读