次のコードを作成しようとしています:
#include <stdio.h>
#include "defs.h"
struct polynome saisie(void);
struct polynome mult (struct polynome, struct polynome);
/* ************************************************
produit
Produit de 2 polynomes saisis au sein de la fonction
entree : -
sortie : -
**************************************************** */
void produit(void) {
struct polynome P1,P2,Q;
int i;
printf("Premier polynome : \n");
P1=saisie();
printf("Second polynome : \n");
P2=saisie();
Q=mult(P1,P2);
for(i=Q.degre; i>=0; i--)
printf("coefficient de X a la puissance %d : %d\n",i, Q.coef[i]);
printf("\n");
}
このコマンドで:
gcc -shared -o lib/libop.so lib/*.o
そして、私はいつもこのエラーを受け取ります:
Undefined symbols for architecture x86_64:
"_saisie", referenced from:
_produit in produit.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
それがあなたに役立つかどうかはわかりませんが、私の gcc -v 出力があります:
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.76) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix
編集:ここにヘッダーが含まれています
#define N 10
struct polynome {
int degre;
int coef[N];
};
さらに、私の同僚の何人かは、Linux マシンでこのコードを共有ライブラリに正常にコンパイルしました。多分問題は私の設定にありますか?でもどこか見えない