C 包括一些.so文件

C 包括一些.so文件,c,linux,makefile,dynamic-library,C,Linux,Makefile,Dynamic Library,我正在尝试使用我编写的一些动态库,但gcc似乎无法找到它们,我不明白为什么会这样。libresistance.so、libcomponent.so和libpower.so文件都位于/usr/lib中,据我所知,这是Linux中动态libs的默认位置。那我做错了什么 C文件 #include <resistance.h> #include <component.h> #include <power.h> int main(int argc, char *argv

我正在尝试使用我编写的一些动态库,但gcc似乎无法找到它们,我不明白为什么会这样。libresistance.so、libcomponent.so和libpower.so文件都位于/usr/lib中,据我所知,这是Linux中动态libs的默认位置。那我做错了什么

C文件

#include <resistance.h>
#include <component.h>
#include <power.h>
int main(int argc, char *argv[] )
{
}
all:
    gcc `pkg-config --cflags gtk+-2.0` -o elektrotestgtk main.c `pkg-config --libs gtk+-2.0` -L. -lresistance -lpower -lcomponent -Wl,-rpath,

我找到了答案,为了能够编译程序,gcc需要.h文件,为了找到它们,需要将它们放在/usr/include中。

在安装库之后是否运行了
ldconfig
?您可能需要仔细编辑
/etc/ld.so.conf
…此外,最好在您的Make文件中添加一些行,如
CFLAGS=-Wall$(shell pkg config--CFLAGS gtk+-2.0)
LDLIBS=$(shell pkg config--libs gtk+-2.0)-L.-lresistance
。。。最后,您应该考虑为应用程序切换到GTK3。