6

次のライブラリをコードに含めました。

#include <minix/drivers.h>
#include <curl/curl.h>
#include <sys/stat.h>
#include <time.h>
#include <assert.h>
#include <string.h>

次のエラーが表示されます。

In file included from /usr/local/include/curl/curlbuild.h:152
                 from /usr/local/include/curl/curl.h:34
                 from xxx.c:2
/usr/pkg/gcc44/lib/gcc/i686-pc-minix/4.4.3/include-fixed/sys/socket.h:134: error: conflicting types for '_send'
/usr/include/minix/ipc.h:152: note: previous declaration was here

私が知る限り、これは_sendが 2 つのライブラリ (minix/drivers.hおよびcurl/curl.h) で宣言されていることを意味しますが、この問題を解決したり、何らかの方法で回避したりできるかどうか疑問に思っていました。

4

1 に答える 1

1

minix を使用しているため、ライブラリの 1 つ (または両方) を で変更できますobjcopy。マニュアルページから:

--redefine-sym old=new
       Change the name of a symbol old, to new.  This can be useful when 
       one is trying link two things together for which you have no source, 
       and there are name collisions.

_sendまたは、ライブラリのいずれかが必要ない場合:

-L symbolname
--localize-symbol=symbolname
       Make symbol symbolname local to the file, so that it is not visible 
       externally.  This option may be given more than once.

もちろん、それに応じてヘッダーを更新する必要があります。また、変更したライブラリとヘッダーに別の名前を付けることをお勧めします。これにより、変更したことが明確になります。

于 2012-01-19T00:44:39.513 に答える