Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mac 编译错误 #75

Open
siguiws opened this issue Nov 16, 2017 · 2 comments
Open

Mac 编译错误 #75

siguiws opened this issue Nov 16, 2017 · 2 comments

Comments

@siguiws
Copy link

siguiws commented Nov 16, 2017

cmake done

sudo make
[ 5%] Building CXX object CMakeFiles/hardseed.dir/Users/wangshu/Documents/hardseed/src/main.o
[ 11%] Building CXX object CMakeFiles/hardseed.dir/Users/wangshu/Documents/hardseed/src/lib/self/TopicsListWebpage.o
[ 16%] Building CXX object CMakeFiles/hardseed.dir/Users/wangshu/Documents/hardseed/src/lib/self/AichengTopicsListWebpage.o
[ 22%] Building CXX object CMakeFiles/hardseed.dir/Users/wangshu/Documents/hardseed/src/lib/self/CaoliuTopicsListWebpage.o
[ 27%] Building CXX object CMakeFiles/hardseed.dir/Users/wangshu/Documents/hardseed/src/lib/self/TopicWebpage.o
[ 33%] Building CXX object CMakeFiles/hardseed.dir/Users/wangshu/Documents/hardseed/src/lib/self/AichengTopicWebpage.o
[ 38%] Building CXX object CMakeFiles/hardseed.dir/Users/wangshu/Documents/hardseed/src/lib/self/CaoliuTopicWebpage.o
[ 44%] Building CXX object CMakeFiles/hardseed.dir/Users/wangshu/Documents/hardseed/src/lib/self/SeedWebpage.o
[ 50%] Building CXX object CMakeFiles/hardseed.dir/Users/wangshu/Documents/hardseed/src/lib/self/JandownSeedWebpage.o
[ 55%] Building CXX object CMakeFiles/hardseed.dir/Users/wangshu/Documents/hardseed/src/lib/self/RmdownSeedWebpage.o
[ 61%] Building CXX object CMakeFiles/hardseed.dir/Users/wangshu/Documents/hardseed/src/lib/self/Aicheng.o
[ 66%] Building CXX object CMakeFiles/hardseed.dir/Users/wangshu/Documents/hardseed/src/lib/self/Caoliu.o
[ 72%] Building CXX object CMakeFiles/hardseed.dir/Users/wangshu/Documents/hardseed/src/lib/helper/Webpage.o
[ 77%] Building CXX object CMakeFiles/hardseed.dir/Users/wangshu/Documents/hardseed/src/lib/helper/Time.o
[ 83%] Building CXX object CMakeFiles/hardseed.dir/Users/wangshu/Documents/hardseed/src/lib/helper/CmdlineOption.o
[ 88%] Building CXX object CMakeFiles/hardseed.dir/Users/wangshu/Documents/hardseed/src/lib/helper/Misc.o
[ 94%] Building CXX object CMakeFiles/hardseed.dir/Users/wangshu/Documents/hardseed/src/lib/3rd/json11/json11.o
[100%] Linking CXX executable hardseed
Undefined symbols for architecture x86_64:
"_iconv", referenced from:
Webpage::convertCharset(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) in Webpage.o
"_iconv_close", referenced from:
Webpage::convertCharset(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) in Webpage.o
"_iconv_open", referenced from:
Webpage::convertCharset(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) in Webpage.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [hardseed] Error 1
make[1]: *** [CMakeFiles/hardseed.dir/all] Error 2
make: *** [all] Error 2

what is the linker command?

@Rogary
Copy link

Rogary commented Nov 18, 2017

change CMakeLists.txt

## osX
##>>>>>>>>>>>>>>>>>>>>>>

SET(CMAKE_CXX_COMPILER "gcc-7")
SET(CMAKE_CXX_FLAGS "-std=c++0x -O3 -lstdc++")
SET(CMAKE_BUILD_TYPE release)
ADD_EXECUTABLE(hardseed ${SRC_LIST})
TARGET_LINK_LIBRARIES(hardseed curl pthread iconv )
INSTALL(PROGRAMS hardseed DESTINATION /usr/local/bin)

@nickyboy13
Copy link

nickyboy13 commented Nov 22, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants