Quantcast

Selected post Dec 09, 2016; 11:59am Undefined symbols for architecture x86_64

classic Classic list List threaded Threaded
2 messages Options
lcy
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Selected post Dec 09, 2016; 11:59am Undefined symbols for architecture x86_64

lcy
This post has NOT been accepted by the mailing list yet.
My Code is :
unique_ptr<FrontendActionFactory> factory = newFrontendActionFactory<GodEyesFrontendAction>();

it can compile well in clang 3.7, but when I upgrade clang to 3.9, it fails.
I try when I just change my code to
unique_ptr<FrontendActionFactory> factory;    without newFrontendActionFactory, it can compile well.

=================================================================
ERROR Message is :

Undefined symbols for architecture x86_64:  
    "typeinfo for clang::ASTConsumer", referenced from:  
    typeinfo for GodEyesASTConsumer in GodEyes.cpp.o  
    "typeinfo for clang::ASTFrontendAction", referenced from:  
    typeinfo for GodEyesFrontendAction in GodEyes.cpp.o  
    "typeinfo for clang::tooling::FrontendActionFactory", referenced from:  
    typeinfo for std::__1::unique_ptr<clang::tooling::FrontendActionFactory, std::__1::default_delete<clang::tooling::FrontendActionFactory> >   clang::tooling::newFrontendActionFactory<GodEyesFrontendAction>  ()::SimpleFrontendActionFactory in GodEyes.cpp.o  
ld: symbol(s) not found for architecture x86_64  
clang: error: linker command failed with exit code 1 (use -v to see invocation)  
ninja: build stopped: subcommand failed.  
=================================================================

My CMakeLists.txt is as below:

cmake_minimum_required (VERSION 2.8)

project(main)  
set(main_VERSION 3.1)  

configure_file (  
  "${PROJECT_SOURCE_DIR}/config.h.in"  
  "${PROJECT_SOURCE_DIR}/config.h"  
  )  

set(CMAKE_C_COMPILER "/usr/bin/clang")  
set(CMAKE_CXX_COMPILER "/usr/bin/clang++")  
set(CMAKE_AR "/usr/bin/llvm-ar")  
set(CMAKE_LINKER "/usr/bin/llvm-ld")  
set(CMAKE_NM "/usr/bin/llvm-nm")  
set(CMAKE_OBJDUMP "/usr/bin/llvm-objdump")  
set(CMAKE_RANLIB "/usr/bin/llvm-ranlib")  
set(CLANG_ROOT "/Users/baixx/clang-llvm/build/lib/clang/3.9.0/include")  
set(LLVM_LINK_COMPONENTS support)  
set(LLVM_USED_LIBS clangTooling clangBasic clangAST)  

set(CMAKE_BUILD_TYPE "Release")  
set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g -ggdb")  
set(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall -DCMAKE_OSX_ARCHITECTURES=x86_64")  

aux_source_directory(. DIR_SRCS)  
aux_source_directory(rules RULE_SRCS)  
add_executable (main-core ${DIR_SRCS} ${RULE_SRCS})  
target_link_libraries(main-core clangTooling curl)
=================================================================

Please help me out here.Any idea will be appreciated! thanks!!!
lcy
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Selected post Dec 09, 2016; 11:59am Undefined symbols for architecture x86_64

lcy
This post has NOT been accepted by the mailing list yet.
Please Help me out !!!!!!!!!!!
Loading...