mac os x下用netbeans编译opencv

sogo3q 2014-07-22 09:35:33
源代码为:
#include "opencv/highgui.h"

int main()
{
IplImage *img = cvLoadImage("1.png");
cvNamedWindow("百度贴吧",CV_WINDOW_AUTOSIZE);
cvShowImage("百度贴吧",img);
cvWaitKey(0);
cvReleaseImage(&img);
cvDestroyWindow("百度贴吧");

return 0;
}


makefile为:
#
# There exist several targets which are by default empty and which can be
# used for execution of your targets. These targets are usually executed
# before and after some main targets. They are:
#
# .build-pre: called before 'build' target
# .build-post: called after 'build' target
# .clean-pre: called before 'clean' target
# .clean-post: called after 'clean' target
# .clobber-pre: called before 'clobber' target
# .clobber-post: called after 'clobber' target
# .all-pre: called before 'all' target
# .all-post: called after 'all' target
# .help-pre: called before 'help' target
# .help-post: called after 'help' target
#
# Targets beginning with '.' are not intended to be called on their own.
#
# Main targets can be executed directly, and they are:
#
# build build a specific configuration
# clean remove built files from a configuration
# clobber remove all built files
# all build all configurations
# help print help mesage
#
# Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and
# .help-impl are implemented in nbproject/makefile-impl.mk.
#
# Available make variables:
#
# CND_BASEDIR base directory for relative paths
# CND_DISTDIR default top distribution directory (build artifacts)
# CND_BUILDDIR default top build directory (object files, ...)
# CONF name of current configuration
# CND_PLATFORM_${CONF} platform name (current configuration)
# CND_ARTIFACT_DIR_${CONF} directory of build artifact (current configuration)
# CND_ARTIFACT_NAME_${CONF} name of build artifact (current configuration)
# CND_ARTIFACT_PATH_${CONF} path to build artifact (current configuration)
# CND_PACKAGE_DIR_${CONF} directory of package (current configuration)
# CND_PACKAGE_NAME_${CONF} name of package (current configuration)
# CND_PACKAGE_PATH_${CONF} path to package (current configuration)
#
# NOCDDL


# Environment
MKDIR=mkdir
CP=cp
CCADMIN=CCadmin


# build
build: .build-post

.build-pre:
# Add your pre 'build' code here...

.build-post: .build-impl
# Add your post 'build' code here...


# clean
clean: .clean-post

.clean-pre:
# Add your pre 'clean' code here...

.clean-post: .clean-impl
# Add your post 'clean' code here...


# clobber
clobber: .clobber-post

.clobber-pre:
# Add your pre 'clobber' code here...

.clobber-post: .clobber-impl
# Add your post 'clobber' code here...


# all
all: .all-post

.all-pre:
# Add your pre 'all' code here...

.all-post: .all-impl
# Add your post 'all' code here...


# build tests
build-tests: .build-tests-post

.build-tests-pre:
# Add your pre 'build-tests' code here...

.build-tests-post: .build-tests-impl
# Add your post 'build-tests' code here...


# run tests
test: .test-post

.test-pre: build-tests
# Add your pre 'test' code here...

.test-post: .test-impl
# Add your post 'test' code here...


# help
help: .help-post

.help-pre:
# Add your pre 'help' code here...

.help-post: .help-impl
# Add your post 'help' code here...



# include project implementation makefile
include nbproject/Makefile-impl.mk

# include project make variables
include nbproject/Makefile-variables.mk


错误提示为:

"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
nbproject/Makefile-Debug.mk:73: warning: ignoring old commands for target `dist/Debug/GNU-MacOSX/hello'
nbproject/Makefile-Debug.mk:77: warning: overriding commands for target `dist/Debug/GNU-MacOSX/hello'
nbproject/Makefile-Debug.mk:75: warning: ignoring old commands for target `dist/Debug/GNU-MacOSX/hello'
nbproject/Makefile-Debug.mk:79: warning: overriding commands for target `dist/Debug/GNU-MacOSX/hello'
nbproject/Makefile-Debug.mk:77: warning: ignoring old commands for target `dist/Debug/GNU-MacOSX/hello'
nbproject/Makefile-Debug.mk:81: warning: overriding commands for target `dist/Debug/GNU-MacOSX/hello'
nbproject/Makefile-Debug.mk:79: warning: ignoring old commands for target `dist/Debug/GNU-MacOSX/hello'
nbproject/Makefile-Debug.mk:83: warning: overriding commands for target `dist/Debug/GNU-MacOSX/hello'
nbproject/Makefile-Debug.mk:81: warning: ignoring old commands for target `dist/Debug/GNU-MacOSX/hello'
nbproject/Makefile-Debug.mk:85: warning: overriding commands for target `dist/Debug/GNU-MacOSX/hello'
nbproject/Makefile-Debug.mk:83: warning: ignoring old commands for target `dist/Debug/GNU-MacOSX/hello'
nbproject/Makefile-Debug.mk:87: warning: overriding commands for target `dist/Debug/GNU-MacOSX/hello'
nbproject/Makefile-Debug.mk:85: warning: ignoring old commands for target `dist/Debug/GNU-MacOSX/hello'
nbproject/Makefile-Debug.mk:89: warning: overriding commands for target `dist/Debug/GNU-MacOSX/hello'
nbproject/Makefile-Debug.mk:87: warning: ignoring old commands for target `dist/Debug/GNU-MacOSX/hello'
nbproject/Makefile-Debug.mk:91: warning: overriding commands for target `dist/Debug/GNU-MacOSX/hello'
nbproject/Makefile-Debug.mk:89: warning: ignoring old commands for target `dist/Debug/GNU-MacOSX/hello'
nbproject/Makefile-Debug.mk:93: warning: overriding commands for target `dist/Debug/GNU-MacOSX/hello'
nbproject/Makefile-Debug.mk:91: warning: ignoring old commands for target `dist/Debug/GNU-MacOSX/hello'
nbproject/Makefile-Debug.mk:96: warning: overriding commands for target `dist/Debug/GNU-MacOSX/hello'
nbproject/Makefile-Debug.mk:93: warning: ignoring old commands for target `dist/Debug/GNU-MacOSX/hello'
make[2]: *** No rule to make target `opencv_calib3d249d.lib', needed by `dist/Debug/GNU-MacOSX/hello'. Stop.
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2

构建 FAILED (退出值2, 总时间: 178ms)


附加依赖项为:
opencv_calib3d249d.lib; opencv_contrib249d.lib; opencv_core249d.lib; opencv_features2d249d.lib; opencv_flann249d.lib; opencv_gpu249d.lib; opencv_highgui249d.lib; opencv_imgproc249d.lib; opencv_legacy249d.lib; opencv_ml249d.lib; opencv_nonfree249d.lib; opencv_objdetect249d.lib; opencv_photo249d.lib; opencv_stitching249d.lib; opencv_ts249d.lib; opencv_video249d.lib; opencv_videostab249d.lib;



求高人看看为什么出错。
...全文
186 7 打赏 收藏 举报
写回复
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
sogo_nds 2014-07-29
  • 打赏
  • 举报
回复
楼主用homebrew装吧,可以帮你搞定一切 1、brew tap homebrew/science 2、brew install opencv 参考:http://blog.csdn.net/forandever/article/details/26700517
sogo3q 2014-07-26
  • 打赏
  • 举报
回复
引用 5 楼 jerry_dqh 的回复:
没法看,makefile-debug.mk这个文件又include .dep.inc ,没有完整的makefile工程,不能看到问题所在,还得你懂些基本的makefile写法,你可以简单加一些echo "" 定位问题
哎,我是一点都不懂啊 T_T。。。还是谢谢你了
碼上道 2014-07-25
  • 打赏
  • 举报
回复
没法看,makefile-debug.mk这个文件又include .dep.inc ,没有完整的makefile工程,不能看到问题所在,还得你懂些基本的makefile写法,你可以简单加一些echo "" 定位问题
sogo3q 2014-07-25
  • 打赏
  • 举报
回复
引用 2 楼 jerry_dqh 的回复:
没有定义target,问题不在你贴的这个makefile。Makefile-Debug.mk这个贴出来看看,你可以在makefile添加echo ""定位问题
makefile-debug.mk如下:
#
# Generated Makefile - do not edit!
#
# Edit the Makefile in the project folder instead (../Makefile). Each target
# has a -pre and a -post target defined where you can add customized code.
#
# This makefile implements configuration specific macros and targets.


# Environment
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-MacOSX
CND_DLIB_EXT=dylib
CND_CONF=Debug
CND_DISTDIR=dist
CND_BUILDDIR=build

# Include project Makefile
include Makefile

# Object Directory
OBJECTDIR=${CND_BUILDDIR}/${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=

# Build Targets
.build-conf: ${BUILD_SUBPROJECTS}
	"${MAKE}"  -f nbproject/Makefile-${CND_CONF}.mk ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/hello

${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/hello: ${OBJECTFILES}
	${MKDIR} -p ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}
	${LINK.cc} -o ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/hello ${OBJECTFILES} ${LDLIBSOPTIONS}

${OBJECTDIR}/main.o: main.cpp 
	${MKDIR} -p ${OBJECTDIR}
	${RM} "$@.d"
	$(COMPILE.cc) -g -MMD -MP -MF "$@.d" -o ${OBJECTDIR}/main.o main.cpp

# Subprojects
.build-subprojects:

# Clean Targets
.clean-conf: ${CLEAN_SUBPROJECTS}
	${RM} -r ${CND_BUILDDIR}/${CND_CONF}
	${RM} ${CND_DISTDIR}/${CND_CONF}/${CND_PLATFORM}/hello

# Subprojects
.clean-subprojects:

# Enable dependency checking
.dep.inc: .depcheck-impl

include .dep.inc
sogo3q 2014-07-25
  • 打赏
  • 举报
回复
引用 1 楼 zhao4zhong1 的回复:
提醒:makefile中tab字符必须是实际的tab字符,不能用空格代替。
makefile不是我写的,是netbeans自动生成的。 我后来发现我可能opencv没装完全。因为我到usr/lib下看了没有opencv文件夹。我是用homebrew装的,不知道它装到哪里了。
碼上道 2014-07-24
  • 打赏
  • 举报
回复
没有定义target,问题不在你贴的这个makefile。Makefile-Debug.mk这个贴出来看看,你可以在makefile添加echo ""定位问题
赵4老师 2014-07-23
  • 打赏
  • 举报
回复
提醒:makefile中tab字符必须是实际的tab字符,不能用空格代替。
发帖
其它技术问题

3880

社区成员

C/C++ 其它技术问题
社区管理员
  • 其它技术问题社区
加入社区
帖子事件
创建了帖子
2014-07-22 09:35
社区公告
暂无公告