我正在尝试使用以下Makefile编译示例代码pjsua2_demo.cpp(重命名为myapp.cpp),由pjsip项目提供,但是我得到了以下错误: 操作系统是Centos 7 ..
[root@localhost pjsip]# make
cc -o myapp myapp.cpp `pkg-config --cflags --libs libpjproject`
cc: error: @PJ_INSTALL_CXXFLAGS@: No existe el fichero o el directorio
cc: error: @PJ_LDXXLIBS@: No existe el fichero o el directorio
make: *** [myapp] Error 1
[root@localhost pjsip]# cat Makefile
# If your application is in a file named myapp.cpp or myapp.c
# this is the line you will need to build the binary.
all: myapp
myapp: myapp.cpp
$(CC) -o $@ $< `pkg-config --cflags --libs libpjproject`
clean:
rm -f myapp.o myapp
[root@localhost pjsip]#
我无法弄清楚设置这些变量的方法,我甚至尝试使用pkg_config,正如一些文章指出的那样,但它没有用。
[root@localhost pjsip]# pkg-config --cflags libpjproject
@PJ_INSTALL_CXXFLAGS@ -I@INCLUDEDIR@
[root@localhost pjsip]#
[root@localhost pjsip]# pkg-config --libs libpjproject
@PJ_LDXXLIBS@ -L@LIBDIR@
[root@localhost pjsip]#
[root@localhost pjsip]# pkg-config --version
0.27.1
[root@localhost pjsip]# pkg-config --modversion libpjproject
@PJ_VERSION@
[root@localhost pjsip]#
[root@localhost pjsip]# env|grep PKG
PKG_CONFIG_PATH=/home/sd/Downloads/pjproject-2.7.1
[root@localhost pjsip]#
你知道吗?
另一方面,我按照下面的说明安装了pjsip,我在'make dep'命令中得到了一些错误(我在下面复制了它们)。这可能是个问题吗?我试过禁用libyuv,但它没有帮助。提前致谢
[root@localhost pjsip]# cd pjproject-2.7.1
[root@localhost pjproject-2.7.1]# ./configure --enable-shared
[root@localhost pjproject-2.7.1]# make dep
[root@localhost pjproject-2.7.1]# make
[root@localhost pjproject-2.7.1]# make install
make[2]: Leaving directory `/home/sd/Downloads/pjproject-2.7.1/pjsip-apps/build'
make -f Samples.mak depend
make[2]: Entering directory `/home/sd/Downloads/pjproject-2.7.1/pjsip-apps/build'
make[2]: Nothing to be done for `depend'.
make[2]: Leaving directory `/home/sd/Downloads/pjproject-2.7.1/pjsip-apps/build'
make[1]: se sale del directorio `/home/sd/Downloads/pjproject-2.7.1/pjsip-apps/build'
[root@localhost pjproject-2.7.1]#