使用 liboauth 时出现链接错误。出现错误未定义对“oauth_url_escape”的引用
使用 liboauth 时出现链接错误 代码 id
#include <cstdlib>
#include<oauth.h>
using namespace std;
/*
*
*/
int main(int argc, char** argv) {
oauth_url_escape("vivek");
return 0;
}
Makefile 由 Netbeans 自动生成,
MKDIR=mkdir
CP=cp
GREP=grep
NM=nm
CCADMIN=CCadmin
RANLIB=ranlib
CC=gcc
CCC=g++
CXX=g++
FC=gfortran
AS=as
# Macros
CND_PLATFORM=GNU-Linux-x86
CND_CONF=Debug
CND_DISTDIR=dist
# Include project Makefile
include Makefile
# Object Directory
OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
# Object Files
OBJECTFILES= \
${OBJECTDIR}/main.o
# C Compiler Flags
CFLAGS=
# CC Compiler Flags
CCFLAGS=
CXXFLAGS=
# Fortran Compiler Flags
FFLAGS=
# Assembler Flags
ASFLAGS=
# Link Libraries and Options
LDLIBSOPTIONS=-loauth
# Build Targets
.build-conf: ${BUILD_SUBPROJECTS}
"${MAKE}" -f nbproject/Makefile-Debug.mk dist/Debug/GNU-Linux-x86/cppapplication_4
dist/Debug/GNU-Linux-x86/cppapplication_4: ${OBJECTFILES}
${MKDIR} -p dist/Debug/GNU-Linux-x86
${LINK.cc} -o ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/cppapplication_4 ${OBJECTFILES} ${LDLIBSOPTIONS}
${OBJECTDIR}/main.o: main.cpp
${MKDIR} -p ${OBJECTDIR}
${RM} [email protected]
$(COMPILE.cc) -g -I../../Desktop/code_try/trunk/lib/out/linux/release64/liboauth-0.9.4/src -MMD -MP -MF [email protected] -o ${OBJECTDIR}/main.o main.cpp
# Subprojects
.build-subprojects:
# Clean Targets
.clean-conf: ${CLEAN_SUBPROJECTS}
${RM} -r build/Debug
${RM} dist/Debug/GNU-Linux-x86/cppapplication_4
# Subprojects
.clean-subprojects:
# Enable dependency checking
.dep.inc: .depcheck-impl
include .dep.inc
我收到错误代码
g++ -o dist/Debug/GNU-Linux-x86/cppapplication_4 build/Debug/GNU-Linux-x86/main.o ../../Desktop/cm_try/trunk/lib/out/linux/release64/sqlite/liboauth.a
build/Debug/GNU-Linux-x86/main.o: In function `main':
/home/vivek/NetBeansProjects/CppApplication_4/main.cpp:16: undefined reference to `oauth_url_escape(char const*)'
collect2: ld returned 1 exit status
gmake[2]: *** [dist/Debug/GNU-Linux-x86/cppapplication_4] Error 1
gmake[1]: *** [.build-conf] Error 2
gmake: *** [.build-impl] Error 2
gmake[2]: Leaving directory `/home/vivek/NetBeansProjects/CppApplication_4'
gmake[1]: Leaving directory `/home/vivek/NetBeansProjects/CppApplication_4
'
I am getting linking error when I am using liboauth
code id
#include <cstdlib>
#include<oauth.h>
using namespace std;
/*
*
*/
int main(int argc, char** argv) {
oauth_url_escape("vivek");
return 0;
}
Makefile is auto generated by Netbeans which is
MKDIR=mkdir
CP=cp
GREP=grep
NM=nm
CCADMIN=CCadmin
RANLIB=ranlib
CC=gcc
CCC=g++
CXX=g++
FC=gfortran
AS=as
# Macros
CND_PLATFORM=GNU-Linux-x86
CND_CONF=Debug
CND_DISTDIR=dist
# Include project Makefile
include Makefile
# Object Directory
OBJECTDIR=build/${CND_CONF}/${CND_PLATFORM}
# Object Files
OBJECTFILES= \
${OBJECTDIR}/main.o
# C Compiler Flags
CFLAGS=
# CC Compiler Flags
CCFLAGS=
CXXFLAGS=
# Fortran Compiler Flags
FFLAGS=
# Assembler Flags
ASFLAGS=
# Link Libraries and Options
LDLIBSOPTIONS=-loauth
# Build Targets
.build-conf: ${BUILD_SUBPROJECTS}
"${MAKE}" -f nbproject/Makefile-Debug.mk dist/Debug/GNU-Linux-x86/cppapplication_4
dist/Debug/GNU-Linux-x86/cppapplication_4: ${OBJECTFILES}
${MKDIR} -p dist/Debug/GNU-Linux-x86
${LINK.cc} -o ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/cppapplication_4 ${OBJECTFILES} ${LDLIBSOPTIONS}
${OBJECTDIR}/main.o: main.cpp
${MKDIR} -p ${OBJECTDIR}
${RM} [email protected]
$(COMPILE.cc) -g -I../../Desktop/code_try/trunk/lib/out/linux/release64/liboauth-0.9.4/src -MMD -MP -MF [email protected] -o ${OBJECTDIR}/main.o main.cpp
# Subprojects
.build-subprojects:
# Clean Targets
.clean-conf: ${CLEAN_SUBPROJECTS}
${RM} -r build/Debug
${RM} dist/Debug/GNU-Linux-x86/cppapplication_4
# Subprojects
.clean-subprojects:
# Enable dependency checking
.dep.inc: .depcheck-impl
include .dep.inc
I am getting error code
g++ -o dist/Debug/GNU-Linux-x86/cppapplication_4 build/Debug/GNU-Linux-x86/main.o ../../Desktop/cm_try/trunk/lib/out/linux/release64/sqlite/liboauth.a
build/Debug/GNU-Linux-x86/main.o: In function `main':
/home/vivek/NetBeansProjects/CppApplication_4/main.cpp:16: undefined reference to `oauth_url_escape(char const*)'
collect2: ld returned 1 exit status
gmake[2]: *** [dist/Debug/GNU-Linux-x86/cppapplication_4] Error 1
gmake[1]: *** [.build-conf] Error 2
gmake: *** [.build-impl] Error 2
gmake[2]: Leaving directory `/home/vivek/NetBeansProjects/CppApplication_4'
gmake[1]: Leaving directory `/home/vivek/NetBeansProjects/CppApplication_4
'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我们只需要改变C++代码中的include语句
We just need to change include statement in C++ code