壞掉了
2026年8月9日 星期日
2026年7月30日 星期四
Install Qt6 in Ubuntu 22.04
Install:
1. sudo apt install qtcreator
2. sudo apt install qtcreator-data qtcreator-doc
3. sudo apt install qt6-base-dev
4. which qmake6 (Get qmake6 location)
Env settings:
Qt Creator: Tools->Options->Kits->Kits
Manul->Desktop(Default)->Qt version: Qt 6.2.4(System)
Qt Creator: Tools->Options->Kits->Qt Versions
qmake path: /usr/bin/qmake6
2026年7月28日 星期二
Library 降版(Dangerous)
The behavior is dangerous.
始因:Ubuntu 22.04,安裝gtkmm 3.0出現,lib版本不相容問題。
例:
sudo apt install libgtkmm-3.0-dev
The following packages have unmet dependencies:
libpango1.0-dev : Depends: gir1.2-pango-1.0 (= 1.50.6+ds-2) but 1.50.6+ds-2ubuntu1 is to be installed
Depends: libpango-1.0-0 (= 1.50.6+ds-2) but 1.50.6+ds-2ubuntu1 is to be installed
.....
需要從1.50.6+ds-2ubuntu1,降版1.50.6+ds-2
1. 更新apt資料庫
sudo apt update
2. 檢查是否有此library
apt-cache policy gir1.2-pango-1.0
3. 降版本(可能有多個library需要降版)
sudo apt install gir1.2-pango-1.0=1.50.6+ds-2 --allow-downgrades
sudo apt install libpango-1.0-0=1.50.6+ds-2 --allow-downgrades
4. 降版完成,安裝gtkmm
sudo apt install libgtkmm-3.0-dev
2026年7月26日 星期日
Library:static、shared與dynamically loaded in Linux
Static libraries :
Static 程式庫用於靜態連結,把一堆 object 檔,用 ar (archiver) 包裝集合起來,檔名以 `.a' 結尾。
優點:執行效能快,且因靜態連結,不易發生執行時找不到 library 或版本問題。
缺點:檔案較大,維護度較低
Shared libraries :
Shared library 程式執行起始時載入,而不是執行中用到才載入。連結階段需要有該程式庫才能進行連結。
優點:維護彈性較好。
soname:library 的名稱,例: libmylib.so.1
real name:實際放有library程式的檔案名稱,例:libmylib.so.1.0.0
linker name:連結時的名稱,通常是不含版號,例: libmylib.so。
使用範例:
* Complie :
# gcc -c -fPIC hello.c world.c
-fPIC 產生 position-independent code。也可以用 -fpic 參數。
# gcc -shared -Wl,-soname,libmylib.so.1 hello.o world.o -o libmylib.so.1.0.0
-shared 表示要編譯成 shared library
-Wl 用於參遞參數給linker,-soname與libmylib.so.1會被傳給linker處理。-soname 用來指名 soname 為 limylib.so.1
library 會被輸出成 libmylib.so.1.0.0(real name), 若不指定 soname 的話,在編譯結連後的執行檔會以連時的library檔名為 soname,並載入他。否則是載入 soname 指定的 library 檔案。
* 用 ln 來建立 soname 與 linker name 兩個檔案 :
# ln -s libmylib.so1.0.0 libmylib.so.1
* 使用 : 與 static library 同 :
# gcc main_mylib.c libmylib.so
or
# gcc main_mylib.c -L. -lmylib
如果目錄下同時有 static 與 shared library 的話,會以 shared 為主,可以使用 -static 參數可以避免使用shared連結。
版本號:
第1碼:原介面有移除或改變,與舊版不相容時。
第2碼:有新增加介面,但相舊介面沒改變,所以與舊版本相容。
第3碼:用於程式內容的修正,介面完全沒有改變。
Dynamically loaded libraries :
像 windows 所用的 DLL ,在使用到時才載入,編譯連結時不需要相關的 library。動態載入庫常被用於像 plug-ins 的應用.
動態載入是透過一套 dl function來處理,預設 API如下 :
void *dlopen(const char *filename, int flag); //開啟載入 filename 指定的 library。
void *dlsym(void *handle, const char *symbol); //取得 symbol 指定的symbol name在library被載入的記憶體位址。
int dlclose(void *handle); //關閉dlopen開啟的handle。
char *dlerror(void); //傳回最近所發生的錯誤訊息。
使用方法:
Compile:
gcc test.c -ldl -o test
執行:
./test
Ref:
Supermium(Chromium支援Window 7, XP)
Chrome 已停止支援Windows 7,或更舊系統。
Supermium 是由 Shane Fournier 開發的自由及開放原始碼網頁瀏覽器( Chromium 的一個分支)。
介紹(From Wiki):特點是支援已不再受 Chromium 支援的舊版 Microsoft Windows,包括所有 Windows 10 之前的版本,最早可支援 Windows XP。
路徑:https://github.com/win32ss/supermium
Thorium Browser 是一個基於 Chromium 的高效能開源網頁瀏覽器,其特色為極致效能與編譯優化。
Ref: https://www.mobile01.com/topicdetail.php?f=300&t=6720648
2026年7月22日 星期三
Linux Man(Manual) Page - (線上手冊)
章節分類(Sections):
1. 可執行的程式或是 shell 指令
2. 系統呼叫(system calls,Linux 核心所提供的函數)
3. 一般函式庫函數
4. 特殊檔案(通常位於 /dev)
5. 檔案格式與協定,如 /etc/passwd
6. 遊戲
7. 雜項(巨集等,如 man(7)、groff(7))
8. 系統管理者指令(通常是管理者 root 專用的)
9. Kernel routines(非標準)
線上查詢:
https://man7.org/linux/man-pages/index.html
Program部份:
gcc : https://man7.org/linux/man-pages/man1/gcc.1.html
g++: https://man7.org/linux/man-pages/man1/g++.1.html
參考網址:
第六章、Linux 檔案與目錄管理 - 鳥哥 - 基礎學習篇 - CentOS 7.x
善用 man 指令查詢 Linux 線上手冊(Man Page)
Visual Studio Code(VS Code) tutorial
1. install VS code
Download the corresponding version
https://code.visualstudio.com/download?_exp_download=fb315fc982
sudo apt install ./<file>.deb
Ref:
https://code.visualstudio.com/docs/setup/linux
https://code.visualstudio.com/docs/setup/windows
2. install extension for C/C++ or other
Start app
Enter extensions and install: C/C++, C/C++ Extension Pack, C/C++ DevTools, Bookmarks by Alessandro
Ref:
https://code.visualstudio.com/docs/languages/cpp
3. first program(Hello World) and do debug
Please check the under link.
.vscode -- some setting file
tasks.json (compiler build settings)
launch.json (debugger settings)
c_cpp_properties.json (compiler path and IntelliSense settings)
Debug:
a. Open main.cpp in VS code.
b. Add a breakpoint in source code
c. Press the play button(in the right-up location), select Debug C/C++ File in the drop-down
Ref:
https://code.visualstudio.com/docs/cpp/config-linux
4. Debugging with Multiple Files
Previous step will generate tasks.json. Modify task.json.
Replease
"${file}",
to
"file1.cpp",
"file2.cpp",
Ref:
http://antares.cs.kent.edu/~csi/blog/vscodemultiple.html