所以在对堆栈溢出进行了大量研究之后,我仍然无法克服我遇到的链接错误。我尝试将搜索 parch 更改为递归,添加链接器标志并尝试链接动态库(.dylibs - 我仍然有点不确定如何安装它。)但没有成功。
任何帮助,将不胜感激:
错误:
Ld /Users/Pete/Library/Developer/Xcode/DerivedData/test- grdrvveervoomvcdkcjjqdekbjcq/Build/Products/Debug/test normal x86_64
cd "/Users/Pete/Documents/University work/Third year Computer Science/practice/test"
setenv MACOSX_DEPLOYMENT_TARGET 10.8
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -L/Users/Pete/Library/Developer/Xcode/DerivedData/test- grdrvveervoomvcdkcjjqdekbjcq/Build/Products/Debug -L/usr/local/lib -L/usr/local/lib/pkgconfig -L/usr/local/lib/python2.7 -L/usr/local/lib/python2.7/site-packages - L/usr/local/lib/python2.7/site-packages "-L/Users/Pete/Documents/University work/Third year Computer Science/practice/test/../../../../../Downloads/OpenCV.framework" - F/Users/Pete/Library/Developer/Xcode/DerivedData/test- grdrvveervoomvcdkcjjqdekbjcq/Build/Products/Debug -filelist /Users/Pete/Library/Developer/Xcode/DerivedData/test- grdrvveervoomvcdkcjjqdekbjcq/Build/Intermediates/test.build/Debug/test.build/Objects- normal/x86_64/test.LinkFileList -mmacosx-version-min=10.8 -lm -lopencv_core -lopencv_highgui - lopencv_video -lopencv_imgproc -stdlib=libc++ -o /Users/Pete/Library/Developer/Xcode/DerivedData/test- grdrvveervoomvcdkcjjqdekbjcq/Build/Products/Debug/test
Undefined symbols for architecture x86_64:
"cv::imread(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int)", referenced from:
ex6(int, char**) in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
配置:
//:configuration = Debug
ARCHS = $(ARCHS_STANDARD_64_BIT)
SDKROOT = macosx
ONLY_ACTIVE_ARCH = YES
MACOSX_DEPLOYMENT_TARGET = 10.8
COPY_PHASE_STRIP = NO
OTHER_LDFLAGS = -lm -lopencv_core -lopencv_highgui -lopencv_video -lopencv_imgproc
ALWAYS_SEARCH_USER_PATHS = NO
HEADER_SEARCH_PATHS = /usr/local/include /opt/local/include
LIBRARY_SEARCH_PATHS = /usr/local/lib/**
GCC_DYNAMIC_NO_PIC = NO
GCC_OPTIMIZATION_LEVEL = 0
GCC_SYMBOLS_PRIVATE_EXTERN = NO
GCC_C_LANGUAGE_STANDARD = gnu99
CLANG_CXX_LANGUAGE_STANDARD = gnu++0x
CLANG_CXX_LIBRARY = libc++
GCC_ENABLE_OBJC_EXCEPTIONS = YES
CLANG_ENABLE_OBJC_ARC = YES
GCC_PREPROCESSOR_DEFINITIONS = DEBUG=1 $(inherited)
CLANG_WARN_EMPTY_BODY = YES
CLANG_WARN_CONSTANT_CONVERSION = YES
GCC_WARN_64_TO_32_BIT_CONVERSION = YES
CLANG_WARN_ENUM_CONVERSION = YES
CLANG_WARN_INT_CONVERSION = YES
GCC_WARN_ABOUT_RETURN_TYPE = YES
GCC_WARN_UNINITIALIZED_AUTOS = YES
GCC_WARN_UNUSED_VARIABLE = YES
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES
//:configuration = Release
ARCHS = $(ARCHS_STANDARD_64_BIT)
SDKROOT = macosx
DEBUG_INFORMATION_FORMAT = dwarf-with-dsym
MACOSX_DEPLOYMENT_TARGET = 10.8
COPY_PHASE_STRIP = YES
OTHER_LDFLAGS = -lm -lopencv_core -lopencv_highgui -lopencv_video -lopencv_imgproc
ALWAYS_SEARCH_USER_PATHS = NO
HEADER_SEARCH_PATHS = /usr/local/include /opt/local/include
LIBRARY_SEARCH_PATHS = /usr/local/lib/**
GCC_C_LANGUAGE_STANDARD = gnu99
CLANG_CXX_LANGUAGE_STANDARD = gnu++0x
CLANG_CXX_LIBRARY = libc++
GCC_ENABLE_OBJC_EXCEPTIONS = YES
CLANG_ENABLE_OBJC_ARC = YES
CLANG_WARN_EMPTY_BODY = YES
CLANG_WARN_CONSTANT_CONVERSION = YES
GCC_WARN_64_TO_32_BIT_CONVERSION = YES
CLANG_WARN_ENUM_CONVERSION = YES
CLANG_WARN_INT_CONVERSION = YES
GCC_WARN_ABOUT_RETURN_TYPE = YES
GCC_WARN_UNINITIALIZED_AUTOS = YES
GCC_WARN_UNUSED_VARIABLE = YES
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES
//:completeSettings = some
ADDITIONAL_SDKS
ARCHS
SDKROOT
ONLY_ACTIVE_ARCH
SUPPORTED_PLATFORMS
VALID_ARCHS
SYMROOT
OBJROOT
CONFIGURATION_BUILD_DIR
CONFIGURATION_TEMP_DIR
SHARED_PRECOMPS_DIR
BUILD_VARIANTS
GCC_VERSION
DEBUG_INFORMATION_FORMAT
GENERATE_PROFILING_CODE
PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR
RUN_CLANG_STATIC_ANALYZER
SCAN_ALL_SOURCE_FILES_FOR_INCLUDES
VALIDATE_PRODUCT
CODE_SIGN_ENTITLEMENTS
CODE_SIGN_IDENTITY
CODE_SIGN_RESOURCE_RULES_PATH
OTHER_CODE_SIGN_FLAGS
STRIPFLAGS
ALTERNATE_GROUP
ALTERNATE_OWNER
ALTERNATE_MODE
ALTERNATE_PERMISSIONS_FILES
COMBINE_HIDPI_IMAGES
DEPLOYMENT_LOCATION
DEPLOYMENT_POSTPROCESSING
INSTALL_GROUP
INSTALL_OWNER
INSTALL_MODE_FLAG
DSTROOT
INSTALL_PATH
MACOSX_DEPLOYMENT_TARGET
PRODUCT_DEFINITION_PLIST
SKIP_INSTALL
COPY_PHASE_STRIP
STRIP_INSTALLED_PRODUCT
STRIP_STYLE
SEPARATE_STRIP
MODULE_NAME
MODULE_START
MODULE_STOP
MODULE_VERSION
BUNDLE_LOADER
DYLIB_COMPATIBILITY_VERSION
DYLIB_CURRENT_VERSION
DEAD_CODE_STRIPPING
LINKER_DISPLAYS_MANGLED_NAMES
PRESERVE_DEAD_CODE_INITS_AND_TERMS
LD_DYLIB_INSTALL_NAME
EXPORTED_SYMBOLS_FILE
LD_NO_PIE
INIT_ROUTINE
LINK_WITH_STANDARD_LIBRARIES
MACH_O_TYPE
ORDER_FILE
OTHER_LDFLAGS
LD_MAP_FILE_PATH
GENERATE_MASTER_OBJECT_FILE
PRELINK_LIBS
KEEP_PRIVATE_EXTERNS
LD_RUNPATH_SEARCH_PATHS
SEPARATE_SYMBOL_EDIT
PRELINK_FLAGS
SECTORDER_FLAGS
UNEXPORTED_SYMBOLS_FILE
WARNING_LDFLAGS
LD_GENERATE_MAP_FILE
APPLY_RULES_IN_COPY_FILES
EXECUTABLE_EXTENSION
EXECUTABLE_PREFIX
INFOPLIST_EXPAND_BUILD_SETTINGS
GENERATE_PKGINFO_FILE
FRAMEWORK_VERSION
INFOPLIST_FILE
INFOPLIST_OTHER_PREPROCESSOR_FLAGS
INFOPLIST_OUTPUT_FORMAT
INFOPLIST_PREPROCESSOR_DEFINITIONS
INFOPLIST_PREFIX_HEADER
INFOPLIST_PREPROCESS
COPYING_PRESERVES_HFS_DATA
PRIVATE_HEADERS_FOLDER_PATH
PRODUCT_NAME
PLIST_FILE_OUTPUT_FORMAT
PUBLIC_HEADERS_FOLDER_PATH
STRINGS_FILE_OUTPUT_ENCODING
WRAPPER_EXTENSION
ALWAYS_SEARCH_USER_PATHS
FRAMEWORK_SEARCH_PATHS
HEADER_SEARCH_PATHS
LIBRARY_SEARCH_PATHS
REZ_SEARCH_PATHS
EXCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES
INCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES
USER_HEADER_SEARCH_PATHS
OTHER_TEST_FLAGS
TEST_AFTER_BUILD
TEST_HOST
TEST_RIG
CURRENT_PROJECT_VERSION
VERSION_INFO_FILE
VERSION_INFO_EXPORT_DECL
VERSION_INFO_PREFIX
VERSION_INFO_SUFFIX
VERSIONING_SYSTEM
VERSION_INFO_BUILDER
GCC_FAST_OBJC_DISPATCH
CLANG_X86_VECTOR_INSTRUCTIONS
GCC_STRICT_ALIASING
GCC_GENERATE_DEBUGGING_SYMBOLS
GCC_DYNAMIC_NO_PIC
GCC_GENERATE_TEST_COVERAGE_FILES
GCC_INLINES_ARE_PRIVATE_EXTERN
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS
GCC_ENABLE_KERNEL_DEVELOPMENT
LLVM_LTO
GCC_REUSE_STRINGS
GCC_NO_COMMON_BLOCKS
GCC_OPTIMIZATION_LEVEL
GCC_FAST_MATH
GCC_THREADSAFE_STATICS
GCC_SYMBOLS_PRIVATE_EXTERN
GCC_UNROLL_LOOPS
GCC_CHAR_IS_UNSIGNED_CHAR
GCC_ENABLE_ASM_KEYWORD
GCC_C_LANGUAGE_STANDARD
CLANG_CXX_LANGUAGE_STANDARD
CLANG_CXX_LIBRARY
GCC_CW_ASM_SYNTAX
GCC_INPUT_FILETYPE
GCC_ENABLE_CPP_EXCEPTIONS
GCC_ENABLE_CPP_RTTI
GCC_LINK_WITH_DYNAMIC_LIBRARIES
GCC_ENABLE_OBJC_EXCEPTIONS
GCC_ENABLE_TRIGRAPHS
GCC_ENABLE_FLOATING_POINT_LIBRARY_CALLS
GCC_USE_INDIRECT_FUNCTION_CALLS
GCC_USE_REGISTER_FUNCTION_CALLS
CLANG_LINK_OBJC_RUNTIME
GCC_INCREASE_PRECOMPILED_HEADER_SHARING
CLANG_ENABLE_OBJC_ARC
OTHER_CFLAGS
OTHER_CPLUSPLUSFLAGS
GCC_PRECOMPILE_PREFIX_HEADER
GCC_PREFIX_HEADER
GCC_ENABLE_BUILTIN_FUNCTIONS
GCC_ENABLE_PASCAL_STRINGS
GCC_SHORT_ENUMS
GCC_USE_STANDARD_INCLUDE_SEARCHING
GCC_PREPROCESSOR_DEFINITIONS
GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS
GCC_WARN_INHIBIT_ALL_WARNINGS
GCC_WARN_PEDANTIC
GCC_TREAT_WARNINGS_AS_ERRORS
GCC_WARN_CHECK_SWITCH_STATEMENTS
GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS
CLANG_WARN_EMPTY_BODY
GCC_WARN_FOUR_CHARACTER_CONSTANTS
GCC_WARN_SHADOW
CLANG_WARN_CONSTANT_CONVERSION
GCC_WARN_64_TO_32_BIT_CONVERSION
CLANG_WARN_ENUM_CONVERSION
CLANG_WARN_INT_CONVERSION
CLANG_WARN_IMPLICIT_SIGN_CONVERSION
GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED
GCC_WARN_ABOUT_RETURN_TYPE
GCC_WARN_MISSING_PARENTHESES
GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS
GCC_WARN_ABOUT_MISSING_PROTOTYPES
GCC_WARN_ABOUT_MISSING_NEWLINE
WARNING_CFLAGS
GCC_WARN_ABOUT_POINTER_SIGNEDNESS
GCC_WARN_SIGN_COMPARE
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION
GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS
GCC_WARN_TYPECHECK_CALLS_TO_PRINTF
GCC_WARN_UNINITIALIZED_AUTOS
GCC_WARN_UNKNOWN_PRAGMAS
GCC_WARN_UNUSED_FUNCTION
GCC_WARN_UNUSED_LABEL
GCC_WARN_UNUSED_PARAMETER
GCC_WARN_UNUSED_VALUE
GCC_WARN_UNUSED_VARIABLE
CLANG_WARN__EXIT_TIME_DESTRUCTORS
GCC_WARN_NON_VIRTUAL_DESTRUCTOR
GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS
GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO
CLANG_WARN_CXX0X_EXTENSIONS
CLANG_WARN__DUPLICATE_METHOD_MATCH
CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES
CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS
GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL
GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS
CLANG_WARN_OBJC_RECEIVER_WEAK
GCC_WARN_STRICT_SELECTOR_MATCH
GCC_WARN_UNDECLARED_SELECTOR
CLANG_WARN__ARC_BRIDGE_CAST_NONARC
OTHER_OSACOMPILEFLAGS
OSACOMPILE_EXECUTE_ONLY
CLANG_ANALYZER_DEADCODE_DEADSTORES
CLANG_ANALYZER_GCD
CLANG_ANALYZER_MALLOC
CLANG_ANALYZER_OBJC_ATSYNC
CLANG_ANALYZER_OBJC_NSCFERROR
CLANG_ANALYZER_OBJC_INCOMP_METHOD_TYPES
CLANG_ANALYZER_OBJC_CFNUMBER
CLANG_ANALYZER_OBJC_COLLECTIONS
CLANG_ANALYZER_OBJC_UNUSED_IVARS
CLANG_ANALYZER_OBJC_SELF_INIT
CLANG_ANALYZER_OBJC_RETAIN_COUNT
CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER
CLANG_ANALYZER_SECURITY_KEYCHAIN_API
CLANG_ANALYZER_SECURITY_INSECUREAPI_UNCHECKEDRETURN
CLANG_ANALYZER_SECURITY_INSECUREAPI_GETPW_GETS
CLANG_ANALYZER_SECURITY_INSECUREAPI_MKSTEMP
CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND
CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY
CLANG_ANALYZER_SECURITY_INSECUREAPI_VFORK
代码 :
void ex6(int i, char** argv){
Mat test, test2;
test2 = imread(argv[i],CV_LOAD_IMAGE_COLOR);
}
//
int main(int argc, char** argv){
//IplImage* img = cvLoadImage(argv[1]); // all IplImage pointers may be shown in a cvShowImage function call.
//ex1(img);
//img = cvLoadImage(argv[1]); // necessary to re-allocated to prevent null pointer error.
//ex2(img);
//img = cvLoadImage(argv[1]); // necessary to re-allocated to prevent null pointer error.
//ex3(img);
//img = cvLoadImage(argv[1]);
//ex4(argc, argv);
string s(argv[1]);
ex6(argc,argv);
return 0;
}