Fw: [問題] clang++編譯時發生錯誤
※ [本文轉錄自 Linux 看板 #1L6Ha6-w ]
作者: x049 (FD) 看板: Linux
標題: [問題] clang++編譯時發生錯誤
時間: Mon Mar 30 17:36:01 2015
先提供linux版本為:Linux Mint 17 Qiana
小弟目前在做專題中需要用到字串轉成點陣圖印出,故參考以下網頁
https://github.com/descent/progs/tree/master/cpp11_utf8
為了能編譯,照著以下網頁步驟安裝了clang與libc++
http://www.cnblogs.com/codemood/p/3142848.html
有先編譯hello world,順利的成功了也能執行
clang++ -g -stdlib=libc++ -std=c++11 -I/usr/include/c++/v1/
-I/usr/include/c++/v1/include/ `freetype-config --cflags` -Wall -W -I. -c
hello.cpp
clang++ -o hello hello.o -stdlib=libc++ -std=c++11 -I/usr/include/c++/v1/
-I/usr/include/c++/v1/include/ `freetype-config --libs`
在把字串轉點陣圖的main.cpp轉.o檔時跳出兩個警告,說有兩個變數沒在程式碼裡調用到
(我認為是沒有影響)
main1.cpp:76:6: warning: unused variable 'starty' [-Wunused-variable]
int starty = pen_y;
^
main1.cpp:75:6: warning: unused variable 'startx' [-Wunused-variable]
int startx = pen_x; //startx與 starty需定義 ...
^
2 warnings generated.
在把.o檔轉成執行檔時跳出錯誤:
xxs4129-Aspire-5750G xxs4129 # clang++ -o main1 main1.o -stdlib=libc++
-std=c++11 -I/usr/include/c++/v1/ -I/usr/include/c++/v1/include/
`freetype-config --libs`
/usr/bin/ld: main1.o: undefined reference to symbol
'__cxa_free_exception@@CXXABI_1.3'
//usr/lib/x86_64-linux-gnu/libstdc++.so.6: error adding symbols: DSO missing
from command line
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
有去google過但還是看不懂如何解決
這是我用的 main1.cpp 跟原本的一樣只是自己為了讀懂多了蠻多註解
https://mega.co.nz/#!x4lR3Y6K!L8_Z5PmLnd_yYhewgQy1FZPsaDmU0MwqfUbffJs1wxQ
還請各位大大有空能幫忙看一下
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 124.6.19.51
※ 文章網址: https://www.ptt.cc/bbs/Linux/M.1427708166.A.FBA.html
※ 發信站: 批踢踢實業坊(ptt.cc)
※ 轉錄者: x049 (124.6.19.51), 03/30/2015 20:01:26
推
03/31 00:44, , 1F
03/31 00:44, 1F
→
03/31 00:45, , 2F
03/31 00:45, 2F
→
03/31 00:48, , 3F
03/31 00:48, 3F
→
03/31 01:06, , 4F
03/31 01:06, 4F
→
03/31 01:09, , 5F
03/31 01:09, 5F
→
03/31 15:32, , 6F
03/31 15:32, 6F
→
03/31 16:49, , 7F
03/31 16:49, 7F
→
04/01 03:04, , 8F
04/01 03:04, 8F
→
04/02 15:32, , 9F
04/02 15:32, 9F
→
04/06 21:15, , 10F
04/06 21:15, 10F
→
04/06 21:17, , 11F
04/06 21:17, 11F