qt for mac工程設定相關

2021-07-22 16:11:18 字數 1025 閱讀 3583

更新mac 10.9.2後,之前的qt程式執行出現以下錯誤:

[html]view plain

copy

undefined symbols for architecture x86_64:  

"___sincos_stret", referenced from:  

...  

"___sincos_stret", referenced from:  

...  

ld: symbol(s) not found for architecture x86_64  

clang: error: linker command failed with exit code 1 (use -v to see invocation)  

14:30:06: the process "/usr/bin/make" exited with code 2.  

error while building/deploying project ********mesh (kit: desktop qt 5.2.1 clang 64bit)  

when executing step 'make'  

14:30:06: elapsed time: 00:16.  

原因是編譯器和sdk版本不匹配,需要在專案中新增:

[html]view plain

copy

macx:qmake_macosx_deployment_target

= 10

.9  

macx:qmake_mac_sdk

=macosx10

.9  

注:如果qt出現編譯問題,可直接檢視生成的makefile檔案獲取錯誤資訊,本次錯誤狀態下,makefile檔案如下:

[html]view plain

copy

release:  =10

debug:  =10

macx 

VC工程編譯相關

error c4996 sprintf this function or variable may be unsafe 這不是語法的錯誤,而是ide預設禁止這種容易產生漏洞的舊函式,解決的方法,一種是替換為新的更安全的函式,另一種在預編譯出新增下面一行 pragma warning disable ...

setStyleSheet設定相關

setstylesheet函式的引數是字串 setstylesheet background blue 背景色 setstylesheet qframe 背景 qpushbutton mypushbutton setstylesheet 這種情況下,控制項自身的樣式表的優先順序高於父控制項或應用程式...

UIButton相關設定

1 設定frame btn.frame cgrectmake x,y,width,height 2 設定文字 btn settitle search forstate uicontrolstatenormal 3 設定按鈕上的自體的大小 btn.titlelabel.font uifont syst...