Tuesday, September 7, 2010
Friday, August 27, 2010
How to make shared library or static library?
http://wiki.kldp.org/wiki.php/DocbookSgml/Program-Library-HOWTO
Thursday, August 26, 2010
Wednesday, August 25, 2010
How to make Makefile for a shared library?
1.
CFLAGS = -g $(INC) -fPIC <- -fPIC
2.
TARGET = libio.so.1
all : $(TARGET)
$(TARGET) : $(OBJS)
$(CC) -shared -Wl,-soname,$@ -o $@ $(OBJS)
<- -shared -Wl,-soname,$@
CFLAGS = -g $(INC) -fPIC <- -fPIC
2.
TARGET = libio.so.1
all : $(TARGET)
$(TARGET) : $(OBJS)
$(CC) -shared -Wl,-soname,$@ -o $@ $(OBJS)
<- -shared -Wl,-soname,$@
Tuesday, August 24, 2010
Sample rate(샘플레이트)와 Bit rate (비트레이트)
출처:http://ospace.tistory.com/101?srchid=BR1http%3A%2F%2Fospace.tistory.com%2F101
Sample rate(샘플레이트)와 Bit rate (비트레이트)
작성자: 박재성(ospace114@empal.컴)
작성일: 2008.4.21
* 편의상 평어를 사용했습니다.
* 퍼갈때는 출처를 밝히는 센스 부탁해요.
아래 내용은 나름대로 여러 분에게 도움이 되고자 정리하였습니다. 그림까지 있으면 더 좋을텐데 시간 관계상 글로만 작성했습니다.
인터넷 상에서 샘플레이트와 비트레이트의 정의는 간혹 있다. 샘플레이트는 이해가 쉽지만, 비트레이트는 쉽게 와닫지않는다. 즉 알송달송하다. 비트레이트와 오디오 포멧에서 어떤 관계를 가지고 있는지 알 수 없다.
이에 대해서 실제 데이터 량인 파일 크기를 가지고 두 rate(레이트)간에 비료를 해두었다. 그리고 글의 내용은 오디오에 대해서 어느정도 지식을 가지고 있는 분들을 대상으로 작성하였다.
초보자분 들은 다른 곳에서 기본적인 용어와 지식을 찾아보길 바란다.
위의 단어는 오디오 다루면서 매우 많이 접하는 단어이다. 일단 간단하게 정리를 해보자.
먼저 sample(샘플)을 먼저 알아 보자.
샘플은 말그대로 샘플이다. 아날로그의 연속된 데이터를 디지털로 표현하기에는 한계가 있다. 아날로그의 연속된 값은 무한 대로 쪼갤 수 있기 때문이다. 그렇기에 그중에 대표적인 특정 값(샘플)을 추출해서 사용하게 된다. 다수의 샘플들 집합으로 소리를 표현할 수 있다.
Sample rate (샘플레이트)
이는 샘플의 빈도 수이다. 좀더 직접적으로 말하면, 1초당 추출되는 샘플 개수이다. 오디오에서 44.1KHz(44100Hz), 22KHz(22050Hz)를 말한다. 괄호안에 값은 좀더 정확하게 표현한 값이다.
예를 들어 44.1KHz는 1초동안에 사만사천백(44100)개로 등분해서 샘플을 추출한다. 값이 커질 수록 더욱더 세밀하게 등분해서 정확한 오디오 데이터를 추출할 수 있다. 그러나 너무 큰 값은 추출되는 데이터 크기를 너무 크게 만들어서 처리하기 힘들다. 보통 44.1KHz가 CD음질로 많이 사용되므로 이이상 추출하는 것의 특수한 경우를 제외하고 의미가 없다.
Bit rate (비트레이트)
초당 전송되는 데이터 양이다. 직접적으로 표현하면 1초당 전송되는 비트 수이다. 간혹 혼돈되는 내용이 평균 데이터 전송량(Avarage Byte Rate)이다. 즉 실제 갖고 있는 데이터 량으로 같은 포멧의 원본(PCM) 데이터 량과 틀리다. Bit rate가 나올 수 있는 것은 오디오 압축 기술이 나오면서 가능하게 되었다.
보통 192Kbps, 128Kbps, 56Kbps 등을 사용한다. 128Kbps정도면 음질은 CD음질정도 되면 192Kbps정도면 최상이다. 그 이상이 되면 용량이 들어날뿐 보통 음질을 잘 구분하지 못한다.
실제 간단한 예를 보면사 둘간의 상관관계를 살표보자.
아래는 샘플 파일 정보이다.
파일명: stop.mp3
재생시간: 4분 59초 (299초)
비트레이트: 56Kbps (CBR)
채널수: 2 ch
비트: 16 bit
샘플레이트:22050 Hz
크기: 2,094,939byte
파일명: stop.pcm
크기: 26,394,624 byte
MP3 파일 크기 계산
먼저 MP3 파일 크기를 계산해 보자. 이때 필요한 값이 재생시간과 비트레이트이다.
파일크기 = 재생시간 * 비트레이트 / 8
8를 나눠준 이유는 비트에서 바이트로 변환하기 위한 것이다.
299 * 56000 / 8 = 2,093,000 (byte)
실제 값과 약간의 오차가 있는 이는 재생 시간이 1초 이하의 시간을 고려하지 않았고, MP3의 테그와 헤더 정보를 고려하지 않았기 때문이다. 비트 레이트는 실제로 처리되는 데이터 크기이므로 실제 재생시간과 곱함으로서 실제 데이터 크리를 알아낼 수 있다.
PCM 데이터 처리량
원래 초당 데이터 량이 다음과 같이 처리된다고 알고 있을 것이다.
초당 데이터 량 = 샘플레이트 * 채널 수 * 비트
그러므로,
22050 * 2 * 16 = 705,600 (bit)
즉, 약 705Kbps가 된다. 바로 이 값이 실제 PCM에서 처리되는 데이터 량이다. 그러나 MP3로 되면서 705Kbps값이 56Kbps 값으로 약 12배 차이가 난다.
PCM 파일 크기 계산
PCM 파일 계산에서는 비트 레이트가 없다. PCM 자체에 모든 데이터를 저장하고 있기 때문이다. 즉 앞에서 구한 PCM 데이터 처리량을 이용해서 구하면 된다.
PCM 파일 크기 = PCM 데이터 처리량 * 재생시간 / 8
8로 나눈이유는 비트를 바이트로 변경하기 위해서이다.
705,000 * 299 / 8 = 26,349,375 (byte)
실제 크기인 26,394,624와 약간의 차이가 있다. 이는 위의 계산시 1초 이하의 시간을 고려하지 않았기 때문이다.
마무리
즉 다시 말하면 PCM 파일에서 bit rate는 pcm 데이터 처리량과 같다. 이를 계산 식으로 변경하면,
비트 레이트 = 샘플 레이트 * 채널 수 * 비트
그러나 MP3인 경우는 위 식이 맞지 않는다.
실제 파일 크기 차리를 보아도 10배 이상의 차이가 발생한다. 이 차이가 MP3와 PCM의 비트레이트 차이와 비슷하다. 그리고 MP3 자체 음질도 나쁘지 않기에 MP3 파일을 사용하게 된다.
위의 MP3 샘플은 음질을 많이 저하시켰기 때문에 음악 감상용으로 적합하지 않지만, 온라인상에서 간단히 재생하는 목적이라면 적합한 포멧이다. 즉 적절히 원하는 용도로 음질을 조절해서 사용할 수 있으면 그만큼 처리되는 데이터 량을 조절할 수 있게 된다.
주의할 것은 bit rate를 CBR(Constant Bit Rate)만 다루었다. 실제는 다음과 같은 것이 추가로 있다.
•VBR(Variable Bit Rate): 가변 전송율
•ABR(Average Bit Rate): 평균 전송율
•SBC(Smart Bit Rate): 스마트 전송율
위의 용어 정의는 다른 사이트를 검색해보면 쉽게 찾을 수 있다. 위의 전송율 방식에 따라서 실제 파일 길이도 차이가 발생하므로 앞에서 계산한 식이 절대적이라고 말할 수 없다.
위의 내용은 MP3를 다루었지만 OGG나 다른 포멧에서도 동일하게 적용된다.
이상으로 마치겠다.
덧글
우리가 알고 있는 WAV가 PCM으로 착각할 수 있는데, 동일 하지 않는다. WAV는 PCM외에 다른 인코딩 방식도 지원하고 있다. 즉 WAV가 PCM를 저장할 수 있는 포멧이다. 자체가 PCM이 아니다.
PCM는 순수 데이터만 저장하고 있다. 그렇기에 PCM파일을 불러오는 경우 샘플 레이트, 채널 수, 비트 수를 직접 입력해야한다. 즉, 헤더 정보가 없다.
추가로 PCM 파일을 재생할 수 있는 프로그램은 Cool Edit를 사용하면 된다.
출처:
인터넷에서 기본적인 용어 정의
내 두뇌~~
Sample rate(샘플레이트)와 Bit rate (비트레이트)
작성자: 박재성(ospace114@empal.컴)
작성일: 2008.4.21
* 편의상 평어를 사용했습니다.
* 퍼갈때는 출처를 밝히는 센스 부탁해요.
아래 내용은 나름대로 여러 분에게 도움이 되고자 정리하였습니다. 그림까지 있으면 더 좋을텐데 시간 관계상 글로만 작성했습니다.
인터넷 상에서 샘플레이트와 비트레이트의 정의는 간혹 있다. 샘플레이트는 이해가 쉽지만, 비트레이트는 쉽게 와닫지않는다. 즉 알송달송하다. 비트레이트와 오디오 포멧에서 어떤 관계를 가지고 있는지 알 수 없다.
이에 대해서 실제 데이터 량인 파일 크기를 가지고 두 rate(레이트)간에 비료를 해두었다. 그리고 글의 내용은 오디오에 대해서 어느정도 지식을 가지고 있는 분들을 대상으로 작성하였다.
초보자분 들은 다른 곳에서 기본적인 용어와 지식을 찾아보길 바란다.
위의 단어는 오디오 다루면서 매우 많이 접하는 단어이다. 일단 간단하게 정리를 해보자.
먼저 sample(샘플)을 먼저 알아 보자.
샘플은 말그대로 샘플이다. 아날로그의 연속된 데이터를 디지털로 표현하기에는 한계가 있다. 아날로그의 연속된 값은 무한 대로 쪼갤 수 있기 때문이다. 그렇기에 그중에 대표적인 특정 값(샘플)을 추출해서 사용하게 된다. 다수의 샘플들 집합으로 소리를 표현할 수 있다.
Sample rate (샘플레이트)
이는 샘플의 빈도 수이다. 좀더 직접적으로 말하면, 1초당 추출되는 샘플 개수이다. 오디오에서 44.1KHz(44100Hz), 22KHz(22050Hz)를 말한다. 괄호안에 값은 좀더 정확하게 표현한 값이다.
예를 들어 44.1KHz는 1초동안에 사만사천백(44100)개로 등분해서 샘플을 추출한다. 값이 커질 수록 더욱더 세밀하게 등분해서 정확한 오디오 데이터를 추출할 수 있다. 그러나 너무 큰 값은 추출되는 데이터 크기를 너무 크게 만들어서 처리하기 힘들다. 보통 44.1KHz가 CD음질로 많이 사용되므로 이이상 추출하는 것의 특수한 경우를 제외하고 의미가 없다.
Bit rate (비트레이트)
초당 전송되는 데이터 양이다. 직접적으로 표현하면 1초당 전송되는 비트 수이다. 간혹 혼돈되는 내용이 평균 데이터 전송량(Avarage Byte Rate)이다. 즉 실제 갖고 있는 데이터 량으로 같은 포멧의 원본(PCM) 데이터 량과 틀리다. Bit rate가 나올 수 있는 것은 오디오 압축 기술이 나오면서 가능하게 되었다.
보통 192Kbps, 128Kbps, 56Kbps 등을 사용한다. 128Kbps정도면 음질은 CD음질정도 되면 192Kbps정도면 최상이다. 그 이상이 되면 용량이 들어날뿐 보통 음질을 잘 구분하지 못한다.
실제 간단한 예를 보면사 둘간의 상관관계를 살표보자.
아래는 샘플 파일 정보이다.
파일명: stop.mp3
재생시간: 4분 59초 (299초)
비트레이트: 56Kbps (CBR)
채널수: 2 ch
비트: 16 bit
샘플레이트:22050 Hz
크기: 2,094,939byte
파일명: stop.pcm
크기: 26,394,624 byte
MP3 파일 크기 계산
먼저 MP3 파일 크기를 계산해 보자. 이때 필요한 값이 재생시간과 비트레이트이다.
파일크기 = 재생시간 * 비트레이트 / 8
8를 나눠준 이유는 비트에서 바이트로 변환하기 위한 것이다.
299 * 56000 / 8 = 2,093,000 (byte)
실제 값과 약간의 오차가 있는 이는 재생 시간이 1초 이하의 시간을 고려하지 않았고, MP3의 테그와 헤더 정보를 고려하지 않았기 때문이다. 비트 레이트는 실제로 처리되는 데이터 크기이므로 실제 재생시간과 곱함으로서 실제 데이터 크리를 알아낼 수 있다.
PCM 데이터 처리량
원래 초당 데이터 량이 다음과 같이 처리된다고 알고 있을 것이다.
초당 데이터 량 = 샘플레이트 * 채널 수 * 비트
그러므로,
22050 * 2 * 16 = 705,600 (bit)
즉, 약 705Kbps가 된다. 바로 이 값이 실제 PCM에서 처리되는 데이터 량이다. 그러나 MP3로 되면서 705Kbps값이 56Kbps 값으로 약 12배 차이가 난다.
PCM 파일 크기 계산
PCM 파일 계산에서는 비트 레이트가 없다. PCM 자체에 모든 데이터를 저장하고 있기 때문이다. 즉 앞에서 구한 PCM 데이터 처리량을 이용해서 구하면 된다.
PCM 파일 크기 = PCM 데이터 처리량 * 재생시간 / 8
8로 나눈이유는 비트를 바이트로 변경하기 위해서이다.
705,000 * 299 / 8 = 26,349,375 (byte)
실제 크기인 26,394,624와 약간의 차이가 있다. 이는 위의 계산시 1초 이하의 시간을 고려하지 않았기 때문이다.
마무리
즉 다시 말하면 PCM 파일에서 bit rate는 pcm 데이터 처리량과 같다. 이를 계산 식으로 변경하면,
비트 레이트 = 샘플 레이트 * 채널 수 * 비트
그러나 MP3인 경우는 위 식이 맞지 않는다.
실제 파일 크기 차리를 보아도 10배 이상의 차이가 발생한다. 이 차이가 MP3와 PCM의 비트레이트 차이와 비슷하다. 그리고 MP3 자체 음질도 나쁘지 않기에 MP3 파일을 사용하게 된다.
위의 MP3 샘플은 음질을 많이 저하시켰기 때문에 음악 감상용으로 적합하지 않지만, 온라인상에서 간단히 재생하는 목적이라면 적합한 포멧이다. 즉 적절히 원하는 용도로 음질을 조절해서 사용할 수 있으면 그만큼 처리되는 데이터 량을 조절할 수 있게 된다.
주의할 것은 bit rate를 CBR(Constant Bit Rate)만 다루었다. 실제는 다음과 같은 것이 추가로 있다.
•VBR(Variable Bit Rate): 가변 전송율
•ABR(Average Bit Rate): 평균 전송율
•SBC(Smart Bit Rate): 스마트 전송율
위의 용어 정의는 다른 사이트를 검색해보면 쉽게 찾을 수 있다. 위의 전송율 방식에 따라서 실제 파일 길이도 차이가 발생하므로 앞에서 계산한 식이 절대적이라고 말할 수 없다.
위의 내용은 MP3를 다루었지만 OGG나 다른 포멧에서도 동일하게 적용된다.
이상으로 마치겠다.
덧글
우리가 알고 있는 WAV가 PCM으로 착각할 수 있는데, 동일 하지 않는다. WAV는 PCM외에 다른 인코딩 방식도 지원하고 있다. 즉 WAV가 PCM를 저장할 수 있는 포멧이다. 자체가 PCM이 아니다.
PCM는 순수 데이터만 저장하고 있다. 그렇기에 PCM파일을 불러오는 경우 샘플 레이트, 채널 수, 비트 수를 직접 입력해야한다. 즉, 헤더 정보가 없다.
추가로 PCM 파일을 재생할 수 있는 프로그램은 Cool Edit를 사용하면 된다.
출처:
인터넷에서 기본적인 용어 정의
내 두뇌~~
Wednesday, August 18, 2010
Monday, August 2, 2010
What is tmake?
tmake is made by TrollTech. originally it is made to make Makefile for Qt programs.
$ tmake test.pro -o Makefile
$ tmake test.pro -o Makefile
Thursday, July 29, 2010
Summary for Installation of Qt/Embedded!
QT 4.6.0 from Sources
Extra Dependencies
(I installed gcc, kernel-headers and GNU Make as dependencies for the VirtualBox Guest Additions, since this is the snapshot I returned to, I don't have to reinstall these)
We know from previous attempts that we need these:
# apt-get install g++
# apt-get build-dep qt4-qmake
then, get it and build it.
$ wget http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.6.0.tar.gz
$ tar xvfz qt-everywhere-opensource-src-4.6.0.tar.gz
$ cd qt-everywhere-opensource-src-4.6.0
$ ./configure
(about 10 minutes on this VM)
$ make
(about 4 hours on this VM!)
# make install
(and we're at 4.6.0), OpenSSL ("default" for etch - and we're at - OMG! - 0.9.8g - Oct 2007),
Extra Dependencies
(I installed gcc, kernel-headers and GNU Make as dependencies for the VirtualBox Guest Additions, since this is the snapshot I returned to, I don't have to reinstall these)
We know from previous attempts that we need these:
# apt-get install g++
# apt-get build-dep qt4-qmake
then, get it and build it.
$ wget http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.6.0.tar.gz
$ tar xvfz qt-everywhere-opensource-src-4.6.0.tar.gz
$ cd qt-everywhere-opensource-src-4.6.0
$ ./configure
(about 10 minutes on this VM)
$ make
(about 4 hours on this VM!)
# make install
(and we're at 4.6.0), OpenSSL ("default" for etch - and we're at - OMG! - 0.9.8g - Oct 2007),
How to install Qt/E correctly?
I'm using Ubuntu and I have installed Qt/X11 from qt.nokia.com.
when I install Qt/E I have met the error: XLib test failed after "./configure".
Basic XLib functionality test failed!
You might need to modify the include and library search paths by editing
QMAKE_INCDIR_X11 and QMAKE_LIBDIR_X11 in /home/lolveley/bin/qt-x11-opensource-src-4.5.1/mkspecs/linux-g++.
SOLUTION:
sudo apt-get build-dep qt4-qmake
when I install Qt/E I have met the error: XLib test failed after "./configure".
Basic XLib functionality test failed!
You might need to modify the include and library search paths by editing
QMAKE_INCDIR_X11 and QMAKE_LIBDIR_X11 in /home/lolveley/bin/qt-x11-opensource-src-4.5.1/mkspecs/linux-g++.
SOLUTION:
sudo apt-get build-dep qt4-qmake
Wednesday, July 28, 2010
Tuesday, July 27, 2010
Why does it say "Test Mode Windows 7 Build 7600" in bottom right corner?
If it is you can try this:
Open a cmd window with administrator rights and run this command:
Bcdedit.exe -set TESTSIGNING OFF
Reboot the PC and the test mode should go away.
Open a cmd window with administrator rights and run this command:
Bcdedit.exe -set TESTSIGNING OFF
Reboot the PC and the test mode should go away.
Monday, July 26, 2010
Sunday, July 25, 2010
Saturday, July 24, 2010
How to uncompress tar file?
To uncompress
$ tar zxvf file-name
To compress
$ tar zcvf file-name 'filelist to compress'
-z: gzip processing
-x: extraction
-c: compress
-v: view
-f: tar rile
remember otpion with image of keyboard position z x c v f
$ tar zxvf file-name
To compress
$ tar zcvf file-name 'filelist to compress'
-z: gzip processing
-x: extraction
-c: compress
-v: view
-f: tar rile
remember otpion with image of keyboard position z x c v f
Friday, July 23, 2010
What is the Qtopia?
Qtopia
GUI App Development Environment for Qtopia
On Linux PC
. Install Qt/X11
. Install Qt/E Library
. Setup Tmake
. Install Qtopia
On Target Board
. Install Qt/E Library
. Setup ARM Tmake
. Install ARM Qtopia
GUI App Development Environment for Qtopia
On Linux PC
. Install Qt/X11
. Install Qt/E Library
. Setup Tmake
. Install Qtopia
On Target Board
. Install Qt/E Library
. Setup ARM Tmake
. Install ARM Qtopia
Thursday, July 22, 2010
Ubuntu equivalent of Windows’ autoexec.bat
edit /etc/fstab file.
but this method is not working correctly.
when boot mount error occurred.
the following link is same with my wondering.
http://www.mangoorange.com/2007/08/30/ubuntu-equivalent-of-windows-autoexecbat/
but this method is not working correctly.
when boot mount error occurred.
the following link is same with my wondering.
http://www.mangoorange.com/2007/08/30/ubuntu-equivalent-of-windows-autoexecbat/
Writing your First C++ Program in Eclipse
Step 0: Launch Eclipse
Start Eclipse by running "eclipse.exe". Choose an appropriate directory for your workspace (i.e., where you wish to save your work). If the "welcome" screen shows up, close the "welcome" screen by clicking the "Close" button.
Step 1: Create a new C++ Project
From "File" menu ⇒ New ⇒ Project... ⇒ C++ ⇒ C++ project ⇒ Next ⇒ In "Project Name", enter "Hello". In the "Project Types" box, select "Executable" ⇒ Empty Project. In the "Toolchain" box, select "Cygwin GCC" ⇒ Next ⇒ Finish.
Step 2: Write a C++ Program
Right-click on the "Hello" project (or "src" folder) (or from the "File" menu), select "New" ⇒ Source File ⇒ In "Name", enter "test.cpp" ⇒ Finish.
Enter the following source code in the "test.cpp" editor panel (double-click on "test.cpp" to open the editor panel if necessary).
#include
using namespace std;
int main() {
cout << "Hello, world!" << endl;
}
Note: If error "unresolved inclusion" appears next to #include statement, the "include paths for headers" are not set properly. Right click the project ⇒ Property ⇒ C/C++ General ⇒ Paths and Symbols ⇒ Includes ⇒ GNU C ⇒ Add... ⇒ Enter "$CYGWIN_HOME\usr\include" where $CYGWIN_HOME is the Cygwin installed directory ⇒ GNU C++ ⇒ Add... ⇒ Enter "$CYGWIN_HOME\lib\gcc\i686-pc-cygwin\3.4.4\include\c++. (To find the header paths, do a search on headers such as "stdio.h" and "iostream" under the Cygwin installed folder.)
Step 3: Compile/Build
From the "Project" menu, choose "Build All" to compile and link the program.
Step 4: Run
To run the program, right-click anywhere on the source "test.cpp" (or from the "Run" menu) ⇒ Run As ⇒ Local C/C++ Application ⇒ (if ask, choose Cygwin's gdb debugger) ⇒ Observe the output "Hello, world!" on the "Console" panel.
Note: You should create a new C++ for each of your programming problems.
Start Eclipse by running "eclipse.exe". Choose an appropriate directory for your workspace (i.e., where you wish to save your work). If the "welcome" screen shows up, close the "welcome" screen by clicking the "Close" button.
Step 1: Create a new C++ Project
From "File" menu ⇒ New ⇒ Project... ⇒ C++ ⇒ C++ project ⇒ Next ⇒ In "Project Name", enter "Hello". In the "Project Types" box, select "Executable" ⇒ Empty Project. In the "Toolchain" box, select "Cygwin GCC" ⇒ Next ⇒ Finish.
Step 2: Write a C++ Program
Right-click on the "Hello" project (or "src" folder) (or from the "File" menu), select "New" ⇒ Source File ⇒ In "Name", enter "test.cpp" ⇒ Finish.
Enter the following source code in the "test.cpp" editor panel (double-click on "test.cpp" to open the editor panel if necessary).
#include
using namespace std;
int main() {
cout << "Hello, world!" << endl;
}
Note: If error "unresolved inclusion" appears next to #include statement, the "include paths for headers" are not set properly. Right click the project ⇒ Property ⇒ C/C++ General ⇒ Paths and Symbols ⇒ Includes ⇒ GNU C ⇒ Add... ⇒ Enter "$CYGWIN_HOME\usr\include" where $CYGWIN_HOME is the Cygwin installed directory ⇒ GNU C++ ⇒ Add... ⇒ Enter "$CYGWIN_HOME\lib\gcc\i686-pc-cygwin\3.4.4\include\c++. (To find the header paths, do a search on headers such as "stdio.h" and "iostream" under the Cygwin installed folder.)
Step 3: Compile/Build
From the "Project" menu, choose "Build All" to compile and link the program.
Step 4: Run
To run the program, right-click anywhere on the source "test.cpp" (or from the "Run" menu) ⇒ Run As ⇒ Local C/C++ Application ⇒ (if ask, choose Cygwin's gdb debugger) ⇒ Observe the output "Hello, world!" on the "Console" panel.
Note: You should create a new C++ for each of your programming problems.
How to Install Eclipse C/C++ Development Tool (CDT)?
Step 0: Install Cygwin
To use Eclipse for C/C++ programming, you need to first install Cygwin's C/C++ Development Tools (for compiling and debugging C/C++ programs). Read "Cygwin - How to Install". Make sure that you select "gcc", "g++", "gdb", and "make" packages under the "Devel" (Development) category, since these packages are not part of the default installation.
Step 1: Install Eclipse C/C++ Development Tool (CDT)
Two ways to install CDT, depending on whether you have previously installed an Eclipse runtime:
If you have installed "Eclipse for Java Developers" or other Eclipse packages, you could install the CDT plug-in from http://www.eclipse.org/cdt/downloads.php. Follow the installation instructions. (Launch Eclipse ⇒ Help ⇒ Install New Software... ⇒ Add... ⇒ in "Archive...", enter the CDT update site URL, e.g., http://download.eclipse.org/tools/cdt/releases/galileo.)
If you did not install any Eclipse package, you could download "Eclipse IDE for C/C++ Developers" from http://www.eclipse.org/downloads, and unzip the downloaded file into a directory of your choice.
To use Eclipse for C/C++ programming, you need to first install Cygwin's C/C++ Development Tools (for compiling and debugging C/C++ programs). Read "Cygwin - How to Install". Make sure that you select "gcc", "g++", "gdb", and "make" packages under the "Devel" (Development) category, since these packages are not part of the default installation.
Step 1: Install Eclipse C/C++ Development Tool (CDT)
Two ways to install CDT, depending on whether you have previously installed an Eclipse runtime:
If you have installed "Eclipse for Java Developers" or other Eclipse packages, you could install the CDT plug-in from http://www.eclipse.org/cdt/downloads.php. Follow the installation instructions. (Launch Eclipse ⇒ Help ⇒ Install New Software... ⇒ Add... ⇒ in "Archive...", enter the CDT update site URL, e.g., http://download.eclipse.org/tools/cdt/releases/galileo.)
If you did not install any Eclipse package, you could download "Eclipse IDE for C/C++ Developers" from http://www.eclipse.org/downloads, and unzip the downloaded file into a directory of your choice.
How to install in Ubuntu
$ sudo apt-get install eclipse
after install process you can find eclipse in Program>Developmemnt.
you can also install CDT plug-in.
download cdt-plugin from www.eclipse.org/cdt.
and then click
after install process you can find eclipse in Program>Developmemnt.
you can also install CDT plug-in.
download cdt-plugin from www.eclipse.org/cdt.
and then click
Wednesday, July 21, 2010
How to see variable with gdb?
Use p command to view indivisual variable and use info xxxx comand to see the values.
$ p variable-name
$ p/format variable-name
$ p variable@size-of-array
$ info locals
$ info variables
$ info registers
$ display vaiable
$ undisplay display_number
$ enable display display-number.
$ disable display display-number.
$ p variable-name
$ p/format variable-name
$ p variable@size-of-array
$ info locals
$ info variables
$ info registers
$ display vaiable
$ undisplay display_number
$ enable display display-number.
$ disable display display-number.
Tuesday, July 20, 2010
How to set data break point?
Data break point is call watch break point in gdb.
use watch command with variable name like this:
watch [variable-name]
this command have gdb to stop the execution every time variable-name's value is changed.
use watch command with variable name like this:
watch [variable-name]
this command have gdb to stop the execution every time variable-name's value is changed.
How to break point with gdb?
Use b command with one of the following:
b function_name
b line_number
b filename:function_name
b filename:line_number
b *0xAddress
b line_number if var==0
b +2
b -2
Monday, July 19, 2010
How to use GNU debugger - gdb?
This is the GNU debugger. Usage:
gdb [options] [executable-file [core-file or process-id]]
gdb [options] --args executable-file [inferior-arguments ...]
Options:
--args Arguments after executable-file are passed to inferior
-b BAUDRATE Set serial port baud rate used for remote debugging.
--batch Exit after processing options.
--batch-silent As for --batch, but suppress all gdb stdout output.
--return-child-result
GDB exit code will be the child's exit code.
--cd=DIR Change current directory to DIR.
--command=FILE, -x Execute GDB commands from FILE.
--eval-command=COMMAND, -ex
Execute a single GDB command.
May be used multiple times and in conjunction
with --command.
--core=COREFILE Analyze the core dump COREFILE.
--pid=PID Attach to running process PID.
--dbx DBX compatibility mode.
--directory=DIR Search for source files in DIR.
--epoch Output information used by epoch emacs-GDB interface.
--exec=EXECFILE Use EXECFILE as the executable.
--fullname Output information used by emacs-GDB interface.
--help Print this message.
--interpreter=INTERP
Select a specific interpreter / user interface
-l TIMEOUT Set timeout in seconds for remote debugging.
--nw Do not use a window interface.
--nx Do not read .gdbinit file.
--quiet Do not print version number on startup.
--readnow Fully read symbol files on first access.
--se=FILE Use FILE as symbol file and executable file.
--symbols=SYMFILE Read symbols from SYMFILE.
--tty=TTY Use TTY for input/output by the program being debugged.
--tui Use a terminal user interface.
--version Print version information and then exit.
-w Use a window interface.
--write Set writing into executable and core files.
--xdb XDB compatibility mode.
At startup, GDB reads the following init files and executes their commands:
* system-wide init file: /etc/gdb/gdbinit
gdb [options] [executable-file [core-file or process-id]]
gdb [options] --args executable-file [inferior-arguments ...]
Options:
--args Arguments after executable-file are passed to inferior
-b BAUDRATE Set serial port baud rate used for remote debugging.
--batch Exit after processing options.
--batch-silent As for --batch, but suppress all gdb stdout output.
--return-child-result
GDB exit code will be the child's exit code.
--cd=DIR Change current directory to DIR.
--command=FILE, -x Execute GDB commands from FILE.
--eval-command=COMMAND, -ex
Execute a single GDB command.
May be used multiple times and in conjunction
with --command.
--core=COREFILE Analyze the core dump COREFILE.
--pid=PID Attach to running process PID.
--dbx DBX compatibility mode.
--directory=DIR Search for source files in DIR.
--epoch Output information used by epoch emacs-GDB interface.
--exec=EXECFILE Use EXECFILE as the executable.
--fullname Output information used by emacs-GDB interface.
--help Print this message.
--interpreter=INTERP
Select a specific interpreter / user interface
-l TIMEOUT Set timeout in seconds for remote debugging.
--nw Do not use a window interface.
--nx Do not read .gdbinit file.
--quiet Do not print version number on startup.
--readnow Fully read symbol files on first access.
--se=FILE Use FILE as symbol file and executable file.
--symbols=SYMFILE Read symbols from SYMFILE.
--tty=TTY Use TTY for input/output by the program being debugged.
--tui Use a terminal user interface.
--version Print version information and then exit.
-w Use a window interface.
--write Set writing into executable and core files.
--xdb XDB compatibility mode.
At startup, GDB reads the following init files and executes their commands:
* system-wide init file: /etc/gdb/gdbinit
Sunday, July 18, 2010
What is ld-linux.so.2?
this name seems to be maded ramdomly. I hate this name because it is difficult to remember. why this name is maded like this?
http://www.ibm.com/developerworks/kr/library/l-shlibs.html
http://www.ibm.com/developerworks/kr/library/l-shlibs.html
How to use man for manual in linux?
if you want to see the ls command's usage.
$ man ls
$ ls --help
Usually man pages are saved in /usr/man or /usr/share/man.
contents of man page are regular. it consists of name, synopsis, description, example and See Also.
for more information refer to:
http://www.ibm.com/developerworks/aix/library/au-spunix_manpages/index.html
$ man ls
$ ls --help
Usually man pages are saved in /usr/man or /usr/share/man.
contents of man page are regular. it consists of name, synopsis, description, example and See Also.
for more information refer to:
http://www.ibm.com/developerworks/aix/library/au-spunix_manpages/index.html
What is different beteen single - and double -- option?
- option is following only one character.
-- is more user friendly option.
for example of man --help
-V, --version both are the same option.
-- is more user friendly option.
for example of man --help
-V, --version both are the same option.
Which optimization option can I choose?
You can use O1, O2, O3, Os.
But I prefer to use Os for size optimization and recommend it to you.
But I prefer to use Os for size optimization and recommend it to you.
How to enable all of the warning in gcc?
Use -W and -Wall options together.
It is same with Waring level 4 in VisualStudio compiler.
If you want to disable specific waring number you can use -Wno-[warning number to disable].
If you want to disable all of the warning message Use the -w lowcase W option.
It is same with Waring level 4 in VisualStudio compiler.
If you want to disable specific waring number you can use -Wno-[warning number to disable].
If you want to disable all of the warning message Use the -w lowcase W option.
How to create C++ code style in gcc compile with no error?
How to create C++ code style in gcc compile with no error?
: use -std=c99 option
you can use C++ style coding like the following
int main()
{
printf("Use C99\n");
int a = 0;
for( int i = 0; i < 10; i++ )
{
printf("i = %d\n");
}
}
: use -std=c99 option
you can use C++ style coding like the following
int main()
{
printf("Use C99\n");
int a = 0;
for( int i = 0; i < 10; i++ )
{
printf("i = %d\n");
}
}
Saturday, July 17, 2010
Ubuntu 10.04 Inputting Korean Characters with SCIM
I wanted to find out how to input Korean characters with Ubuntu. At first, I thought it was as easy as going to System> Preferences> Keyboard. I clicked on the Layouts tab and tried to add the Korean keyboard layout. Unfortunately, the Korean keyboard layout is just a regular QWERTY keyboard and does not have any Korean letters at all.
I found a post in ubuntuforums.org that explained how to enable Korean input.
1. Enable Korean language support by going to System> Administration> Language Support. Click on Install / Remove Languages, select Korean from the list and Apply Changes. Select scim as the Keyboard input method system.
2. Go to Applications> Ubuntu Software Center and search for scim-hangul and install Hangul Input Method Engine for SCIM.
3. On my computer SCIM was installed by default, but if not you can install it in the Ubuntu Software Center. It is called SCIM Input Method Setup. After it is installed you can find it under System> Preferences> SCIM Input Method Setup.
4. Restart your computer.
5. Activate SCIM by inputting ctrl + space bar. You should see a floating menu on the bottom right corner and/or a keyboard icon in the upper right corner. Both allow you to switch between Korean and English.
My preferred font for reading Korean text is Baekmuk Dotum and Baekmuk Gulim which are nicely legible. These can be installed through the Ubuntu Software Center by searching for Baekmuk series TrueType fonts. Then in Firefox, you can enable them by going to Edit> Preferences. Select the Content tab and select Advanced and then you can choose the fonts for Korean.
http://newtoubuntu.wordpress.com/2010/07/03/ubuntu-10-04-inputting-korean-characters-with-scim/
I found a post in ubuntuforums.org that explained how to enable Korean input.
1. Enable Korean language support by going to System> Administration> Language Support. Click on Install / Remove Languages, select Korean from the list and Apply Changes. Select scim as the Keyboard input method system.
2. Go to Applications> Ubuntu Software Center and search for scim-hangul and install Hangul Input Method Engine for SCIM.
3. On my computer SCIM was installed by default, but if not you can install it in the Ubuntu Software Center. It is called SCIM Input Method Setup. After it is installed you can find it under System> Preferences> SCIM Input Method Setup.
4. Restart your computer.
5. Activate SCIM by inputting ctrl + space bar. You should see a floating menu on the bottom right corner and/or a keyboard icon in the upper right corner. Both allow you to switch between Korean and English.
My preferred font for reading Korean text is Baekmuk Dotum and Baekmuk Gulim which are nicely legible. These can be installed through the Ubuntu Software Center by searching for Baekmuk series TrueType fonts. Then in Firefox, you can enable them by going to Edit> Preferences. Select the Content tab and select Advanced and then you can choose the fonts for Korean.
http://newtoubuntu.wordpress.com/2010/07/03/ubuntu-10-04-inputting-korean-characters-with-scim/
How to complile only hello.c with gcc?
: use -c option to say not to run the linker.
: ex) gcc -c hello.c
gcc uses cpp0, cc1, as, collect2.
cpp0 = pre-processor,
cc1 = compiler,
as = assembler,
collect2 = linker.
What is the extension of shared library and static library?
: static library is .a
: shared library is .so
: use -c option to say not to run the linker.
: ex) gcc -c hello.c
gcc uses cpp0, cc1, as, collect2.
cpp0 = pre-processor,
cc1 = compiler,
as = assembler,
collect2 = linker.
What is the extension of shared library and static library?
: static library is .a
: shared library is .so
Subscribe to:
Posts (Atom)