2014년 9월 8일 월요일

clang version 3.5.0 Visual Studio Build 현재 상태.



clang version 3.5.0  Visual Studio Build 현재 상태.


Visual Studio 2012 로 빌드한, clang 3.5 는 현재,

윈도우즈에서 간단한 C++ 코드조차, 컴파일 하지 못한다.

간단한 C 코드는 컴파일 가능하다.







D:\>cd D:\DEV_LANG\Work_1

D:\DEV_LANG\Work_1>dir
 D 드라이브의 볼륨: Data
 볼륨 일련 번호: 0AA4-E023

 D:\DEV_LANG\Work_1 디렉터리

2014-09-08  오후 02:11    <DIR>          .
2014-09-08  오후 02:11    <DIR>          ..
2014-09-07  오전 08:42                76 a.c
2014-09-08  오후 02:11            39,387 a.exe
2014-09-07  오전 10:32                62 bb.cpp
2014-09-08  오후 07:23               564 clang-build-1.bat
2014-09-08  오후 02:07               454 clang-build-2.bat
               5개 파일              40,543 바이트
               2개 디렉터리  148,957,941,760 바이트 남음

D:\DEV_LANG\Work_1>
D:\DEV_LANG\Work_1>
D:\DEV_LANG\Work_1>type a.c
#include <stdio.h>
int main() {
  printf("hello world\n");
  return 0;
}
D:\DEV_LANG\Work_1>clang --version
clang version 3.5.0 (tags/RELEASE_350/final)
Target: i686-pc-windows-msvc
Thread model: posix

D:\DEV_LANG\Work_1>clang a.c

D:\DEV_LANG\Work_1>dir
 D 드라이브의 볼륨: Data
 볼륨 일련 번호: 0AA4-E023

 D:\DEV_LANG\Work_1 디렉터리

2014-09-08  오후 09:43    <DIR>          .
2014-09-08  오후 09:43    <DIR>          ..
2014-09-07  오전 08:42                76 a.c
2014-09-08  오후 02:11            39,387 a.exe
2014-09-08  오후 09:43            57,344 a.out
2014-09-07  오전 10:32                62 bb.cpp
2014-09-08  오후 07:23               564 clang-build-1.bat
2014-09-08  오후 02:07               454 clang-build-2.bat
               6개 파일              97,887 바이트
               2개 디렉터리  148,957,884,416 바이트 남음

D:\DEV_LANG\Work_1>a.exe
hello world

D:\DEV_LANG\Work_1>dir
 D 드라이브의 볼륨: Data
 볼륨 일련 번호: 0AA4-E023

 D:\DEV_LANG\Work_1 디렉터리

2014-09-08  오후 09:43    <DIR>          .
2014-09-08  오후 09:43    <DIR>          ..
2014-09-07  오전 08:42                76 a.c
2014-09-08  오후 02:11            39,387 a.exe
2014-09-08  오후 09:43            57,344 a.out
2014-09-07  오전 10:32                62 bb.cpp
2014-09-08  오후 07:23               564 clang-build-1.bat
2014-09-08  오후 02:07               454 clang-build-2.bat
               6개 파일              97,887 바이트
               2개 디렉터리  148,957,884,416 바이트 남음

D:\DEV_LANG\Work_1>type bb.cpp
#include <iostream>

int main() {
    std::cout << "hi";
}
D:\DEV_LANG\Work_1>clang bb.cpp
In file included from bb.cpp:1:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INC
LUDE\iostream:6:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INC
LUDE\istream:6:
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\ostream:796:3: error:
      cannot compile this try statement yet
                _TRY_IO_BEGIN
                ^~~~~~~~~~~~~
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\ostream:19:24: note:
      expanded from macro '_TRY_IO_BEGIN'
 #define _TRY_IO_BEGIN  _TRY_BEGIN      /* begin try block */
                        ^
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\xstddef:30:21: note:
      expanded from macro '_TRY_BEGIN'
 #define _TRY_BEGIN     try {
                        ^
In file included from bb.cpp:1:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INC
LUDE\iostream:6:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INC
LUDE\istream:6:
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\ostream:171:3: error:
      cannot compile this try statement yet
                _TRY_BEGIN
                ^~~~~~~~~~
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\xstddef:30:21: note:
      expanded from macro '_TRY_BEGIN'
 #define _TRY_BEGIN     try {
                        ^
In file included from bb.cpp:1:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INC
LUDE\iostream:6:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INC
LUDE\istream:6:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INC
LUDE\ostream:6:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INC
LUDE\ios:6:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INC
LUDE\xlocnum:10:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INC
LUDE\streambuf:6:
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\xiosbase:306:4: error:
      cannot compile this throw expression yet
                        _RERAISE;
                        ^~~~~~~~
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\xstddef:36:19: note:
      expanded from macro '_RERAISE'
 #define _RERAISE       throw
                        ^~~~~
In file included from bb.cpp:1:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INC
LUDE\iostream:6:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INC
LUDE\istream:6:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INC
LUDE\ostream:6:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INC
LUDE\ios:6:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INC
LUDE\xlocnum:10:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INC
LUDE\streambuf:6:
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\xiosbase:308:4: error:
      cannot compile this throw expression yet
                        _THROW_NCEE(failure, "ios_base::badbit set");
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\xstddef:46:30: note:
      expanded from macro '_THROW_NCEE'
   #define _THROW_NCEE(x, y)    throw x(y)
                                ^~~~~~~~~~
In file included from bb.cpp:1:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INC
LUDE\iostream:6:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INC
LUDE\istream:6:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INC
LUDE\ostream:6:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INC
LUDE\ios:6:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INC
LUDE\xlocnum:10:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INC
LUDE\streambuf:6:
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\xiosbase:310:4: error:
      cannot compile this throw expression yet
                        _THROW_NCEE(failure, "ios_base::failbit set");
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\xstddef:46:30: note:
      expanded from macro '_THROW_NCEE'
   #define _THROW_NCEE(x, y)    throw x(y)
                                ^~~~~~~~~~
In file included from bb.cpp:1:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INC
LUDE\iostream:6:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INC
LUDE\istream:6:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INC
LUDE\ostream:6:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INC
LUDE\ios:6:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INC
LUDE\xlocnum:10:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INC
LUDE\streambuf:6:
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\xiosbase:312:4: error:
      cannot compile this throw expression yet
                        _THROW_NCEE(failure, "ios_base::eofbit set");
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\xstddef:46:30: note:
      expanded from macro '_THROW_NCEE'
   #define _THROW_NCEE(x, y)    throw x(y)
                                ^~~~~~~~~~
In file included from bb.cpp:1:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INC
LUDE\iostream:6:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INC
LUDE\istream:6:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INC
LUDE\ostream:6:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INC
LUDE\ios:6:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INC
LUDE\xlocnum:10:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INC
LUDE\streambuf:6:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INC
LUDE\xiosbase:6:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INC
LUDE\xlocale:8:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INC
LUDE\stdexcept:7:
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\xstring:2195:3: error:
      cannot compile this try statement yet
                _TRY_BEGIN
                ^~~~~~~~~~
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\xstddef:30:21: note:
      expanded from macro '_TRY_BEGIN'
 #define _TRY_BEGIN     try {
                        ^
7 errors generated.

D:\DEV_LANG\Work_1>

2013년 11월 6일 수요일

C++ 컴파일러 선택의 문제.



C++ 컴파일러 선택의 문제.


   32bit 인가. 64bit 인가.
   Exception handling 은 무엇인가? ( SJLJ, DWARF, and SEH )
   Threading model 은 posix thread 인가 win32 threaad 인가.
   MinGW 인가 TDM-GCC 인가.



http://qt-project.org/wiki/MinGW-64-bit

http://tdm-gcc.tdragon.net/quirks

http://mingw-w64.sourceforge.net/




2013년 10월 19일 토요일

LLVM Introduction


Introduction to the LLVM Compiler System.

http://llvm.org/pubs/2008-10-04-ACAT-LLVM-Intro.pdf


2008 년 문서로 추정된다.

LLVM 에대한 개념을 설명한 문서다.














LLVM Project 란 무엇인가?

New compiler architecture built with reusable components.

다음과 같은 여러가지 컴파일러 기술로 이루어져있다.
- Optimizer , Code Generator
- llvm-gcc, Clang Front ends
- 그외 기타등등...


http://llvm.org





그런데, 왜?

그런데, 왜 이 시점에 뜬금없이 C 컴파일러를 또 만든단 말인가?

이미 세상에는 GCC, Xcode, Visual Studio ... 등등 수 많은 C 컴파일러가 있는데..

왜. 하필이면. 또 C 컴파일러란 말인가?




그 이유는.


1. 기존 오픈소스 C Compiler 가 침체되었다고 보기 때문이다.

그렇게 보는 이유는 다음과 같다.

- 수십년된 code generation 기술을 기반으로 한다.
- cross-file optimization 과 같은 현대적 기술을 사용하지 않는다.
- code base 가 오래되서, 배우기 어렵고, 대대적인 변경이 어렵다.
- 다른 응용프로그램에서 컴파일러기술을 재사용하기 어렵다.
- 새로운 버전이 릴리스될때마다 속도가 더욱 느려진다.


(음... 일리 있네..)


그래서 현대적기술을 사용하여 컴파일러 요소기술을 만들었고,

이것을 모듈화 시킨것이 LLVM 이다.


이것이 좋다는것을 증명하려면, 이 요소기술위에서 돌아가는 컴파일러가 있어야 한다.

그래서, LLVM 개발자는 LLVM-GCC 4.2 를 만들었다.





LLVM-GCC 4.2 는 다음과 같은 특징을 가진다.

- C, C++, Objective C, Ada and Fortran
- Standard GCC command line option
- ....






즉, LLVM-GCC 4.2 는 C Front-end 는 GCC 4.2 를 쓰고, Optimizer 와 Code Generator 는 LLVM 을 쓰는 물건이다.


( 이걸 왜 이렇게 복잡하게 섞어 놓는거지..? )



이걸 이렇게 섞어서 LLVM 을 쓰면 다음과 같은 좋은 점이 생긴다.


1. 기존에는 없었던, Link Time Optimization 이라는 새로운 기능이 가능해진다.

2. 컴파일 시간이 줄어든다.



3. 실행시간이 빨라진다.





결론은 장점이 분명 존재한다.


기타 다음과 같은 LLVM 의 특징과 장점이 있다.

- 새로운 언어를 만들때 LLVM 을 target 으로 쓸수있다.
- Just-In-Time optimization 과 compillation 을 제공한다.
- Better tools for source level analysis of C/C++ program







LLVM 기술로 만들어진것중에 Clang 이란것이 있다.

Clang 은 이런것이다.
- C, Objective-C, and C++ front-end.
- GCC 와 호환성 유지.
- 컴파일 속도 향상.
- 알아보기 편한, 컴파일러 에러메시지.

( 별거아니네. 뭐야, GCC 랑 똑같은건가..? )





컴파일 속도는 GCC 보다 Clang 이 좀 빠른가 보네.








- C++11 support 에서도 Clang 은 뛰어나다.

    C++11 compiler support shootout: Visual Studio, GCC, Clang, Intel
   ( http://cpprocks.com/c11-compiler-support-shootout-visual-studio-gcc-clang-intel/ )









- 이렇게 좋은 Clang 인데... Visual Studio 에서는, MinGW 에서는...

   ...  Windows 에서는 아직 찬밥이라는 현실.





http://llvm.org/docs/GettingStarted.html )







Windows8 에서 MinGW64 로는 빌드가 되지 않는다.

(  MinGW32 로는 빌드가 된다. )











- LLVM, Clang 은 완료된 프로젝트가 아니다.
  현재, 개발 진행중인 프로젝트다.
  뭔가, 안되거나 없으면 정상이다.

  예를 들어 Clang 링커가 없다면, 정상이다.
  지금 개발 중이다.


The lld project aims to to be the built-in linker for clang/llvm. 
Currently, clang must invoke the system linker to produce executables.

현재로서는, MinGW 에 있는 링커 또는 Visual Studio 에 있는 링커를 써야한다.







2012년 7월 2일 월요일

작업실





MinGW         - 컴파일러(GCC)
Qt Creator    - IDE
COM            - gcc 에서 COM 사용

Boost            - open-source cross-platform
 library ( thread, ipc ... )
Qt                 - open-source cross-platform ui library








2012년 5월 21일 월요일






wxWidgets 2.8.12

"Hello world!" 프로그램이 종료되지 않는다......!




2012년 5월 20일 일요일

Code::Block 빌드 성공


참조:
1. http://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Windows





MinGW 를 설치하고,

wxWidget-2.8.12 소스코드를 빌드하고,

Code::Block 소스코드를 빌드하는데 성공했다.





















Plugin 을 빌드하는 즐거움도 느낄수 있다.

Plugin 을 빌드한후, update.bat 을 다시한번 실행시켜 주어야 한다.









개발자가 개발도구( IDE )를 빌드할 수 있다는것이 어떤의미인가.

그로인한 효과는 무엇인가.

이것으로 무엇이 가능한가.



<Code::Block 빌드>가 모든것의 출발점이다.




2012년 5월 19일 토요일

wxWidget 빌드 에러 ( wxMSW-2.8.12 )

































wxWidgets ("wxMSW-2.8.12")  를 MinGW 로 빌드하다가 "Memory exhausted" 에러가 났다.





이 오류는 다음과 같이 CFLAGS, CXXFLAGS 를 추가하면 해결된다.

MinGW, TDM-GCC 둘다 이 방법으로 wxWidgets 을 빌드할 수 있다.




D:\DEV\wxMSW-2.8.12\build\msw>


mingw32-make.exe -f makefile.gcc CFLAGS=-fno-keep-inline-dllexport CXXFLAGS=-fno-keep-inline-dllexport SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=1 clean


mingw32-make.exe -f makefile.gcc CFLAGS=-fno-keep-inline-dllexport CXXFLAGS=-fno-keep-inline-dllexport SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=1




mingw32-make.exe -f makefile.gcc CFLAGS=-fno-keep-inline-dllexport CXXFLAGS=-fno-keep-inline-dllexport SHARED=1 MONOLITHIC=1 BUILD=debug UNICODE=1 clean


mingw32-make.exe -f makefile.gcc CFLAGS=-fno-keep-inline-dllexport CXXFLAGS=-fno-keep-inline-dllexport SHARED=1 MONOLITHIC=1 BUILD=debug UNICODE=1







참조:
1. http://wiki.wxwidgets.org/Compiling_wxWidgets_with_MinGW
2. TDM-GCC ( http://tdm-gcc.tdragon.net/ )



(from README-gcc-tdm.txt)


>>>>> USAGE NOTES

*** Inline member functions and DLLs ***

[[[ IMPORTANT NOTE:
[[[ You will probably need to use "-fno-keep-inline-dllexport" when building
[[[ large DLLs with lots of inline member functions, such as the "wxWidgets"
[[[ library's monolithic DLL.

The GCC 4.5 series introduced a change in the way inline functions that are
members of classes are handled in DLLs. Before the 4.5 series, inline member
functions were *not* emitted in DLLs by default; in the 4.5 series and later,
they are.

Unfortunately, this change in behavior led to link-time problems with large
libraries (such as wxWidgets) that use precompiled headers and many inline
member functions, where the linker would run out of memory while trying to
generate the DLL.

In the GCC 4.6 series, therefore, the flag "-fno-keep-inline-dllexport" was
introduced, which allows you to disable the emission of inline functions in DLLs
and return to the old behavior.








2012년 5월 18일 금요일

boost 를 MinGW 로 빌드하기

boost 를 MinGW 로 빌드하기



참조:

http://www.boost.org/

http://sourceforge.net/apps/trac/mingw-w64/wiki/Building%20Boost

http://www.boost.org/doc/libs/1_32_0/tools/build/v1/mingw-tools.html

http://www.boost.org/doc/libs/1_49_0/more/getting_started/windows.html





boost root 에서 다음내용의 batch 파일을 만들고 실행시키면,

"D:\DEV\boost_1_49_0\boost_1_49_0\stage\libgcc32" 디렉토리에

boost header 와 library 가 생성된다.







ECHO make sure bjam.exe is available (build if this not the case)
IF NOT EXIST "bjam.exe" (
   CALL bootstrap.bat
)


bjam --prefix=D:\DEV\boost_1_49_0\boost_1_49_0\stage\libgcc32 ^
 --toolset=gcc address-model=32 variant=debug,release link=static,shared ^
 threading=multi install









MinGW 64 버전으로도 한번 해볼까.






Code::Block 빌드



참조: Installing Code::Blocks from source on Windows

http://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Windows





Code::Block 을 빌드해보자.

우선 소스코드를 내려받아야 한다.




다음 위치를 입력하여 코드를 적당한 디렉토리에 내려받자.

svn://svn.berlios.de/codeblocks/trunk






















내려받기가 끝났다.



지금부터 할일은 Code::Block 으로 Code::Block 을 빌드하는 일이다.


설치된 Code::Block 을 실행하고, 다음 프로젝트 파일을 연다.

CodeBlocks_wx29.cbp








전역변수 wx29 의 위치를 입력해준다.









빌드 버튼을 누른다.





빌드가 잘되고 있다.

빌드가 끝났으면 이전에 빌드해두었던 다음 파일을

%WX_DIR%\wxWidgets-2.9.3\lib\gcc_dll\wxmsw293u_gcc_custom.dll


다음 위치로 복사하자.

%CB_DIR%\src\devel29


그리고나서 update29.bat 를 실행시켜준다.


zip.exe 가 없는 경우는 다음 사이트에서 다운받고,
실행시킬수 있도록 시스템 환경변수 Path 를 설정해주자.

http://sourceforge.net/projects/gnuwin32/files/zip/2.3-3/zip-2.3-3-bin.zip/download









wxWidgets 빌드




wxWidgets 는 소스코드형태로 제공되므로, C++ 개발자가 빌드해야한다.


wxWidgets 의 압축을 풀고, 그 아래의 "\build\msw" 디렉토리로 이동한다.


내 컴퓨터에서 디렉토리위치는 다음과 같이 표현된다.

"D:\DEV\wxWidgets-2.9.3\build\msw"





빌드작업은 콘솔창에서 make 를 사용한다.

MinGW 에서 make 의 파일이름은 mingw32-make.exe 이다.





이전 빌드된 임시파일을 지운다.

mingw32-make.exe -f makefile.gcc SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=1 clean



빌드한다.

mingw32-make.exe -f makefile.gcc SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=1









빌드가 잘 되고 있다.



debug 버전에 대해서도 위 작업을 한번 더 해준다.



mingw32-make.exe -f makefile.gcc SHARED=1 MONOLITHIC=1 BUILD=debug UNICODE=1 clean


mingw32-make.exe -f makefile.gcc SHARED=1 MONOLITHIC=1 BUILD= debug UNICODE=1









이렇게 해서, 나는 wxWidgets 를 MinGW 로 빌드해본 프로그래머가 되었다.



SVN client 설치



Code::Block 소스를 내려받기위해서,

다음 사이트에서 TortoiseSVN 을 설치한다.

http://tortoisesvn.net/








이것도 역시 Next 를 여러번 누르면 설치가 끝난다.




MinGW 설치




C++ 프로그래머에게 컴파일러는 생명이다.

Windows 에서 open-source, free-license 의 특성을 가진 컴파일러는 MinGW 뿐이다.

처음에는 VisualStudio 의 명성과 편리함에 가려서 MinGW 가 잘 보이지 않았다.

http://www.mingw.org/ 를 통해 설치하자.

나는 현재 최신버전인 "mingw-get-inst-20120426.exe" 를 다운받았다.

실행시켜보자.





그렇다. Next 만 계속누르면 최신 C++ 컴파일러인 MinGW 를 설치할 수 있다.







"Download latest repository catalogues" 를 선택하도록 하자.









설치할 디렉토리도 적절히 정해주자.









설치하려는 "C++ Compiler" 를 반드시 선택하자.









뭔가 다운받는 과정을 볼수 있다.









드디어 설치가 시작되었다.








아.... 오래걸린다....








끝났다.




환경변수에 bin, mingw32\bin 경로를 넣어주자.

%MINGW_ROOT%\bin
%MINGW_ROOT%\mingw32\bin




내 컴퓨터에서 환경변수는 다음과 같이 추가된다.

D:\DEV\MinGW\bin;D:\DEV\MinGW\mingw32\bin;


































설치가 잘되었는지. 환경변수는 설정이 제대로 되었는지. 콘솔창에서 다음명령으로 설치된 도구의 버전을 확인해보자.

mingw32-make -v












나는 지금 최신기종의 C++ 컴파일러를 설치했다.
신상이다.
무료다.

겉보기와는 달리, MinGW 는 상용 컴파일러와 비교해도 절대 밀리지 않는다.

모든 언어는 C/C++ 로 회귀한다.
모든 라이브러리는 C/C++로 회귀한다.

C++ 로 무엇이 가능한가.
모든것이 가능하다.
가서 세상을 다 가지면된다.

2012년 5월 16일 수요일




RPC -> ORB -> CORBA -> D-Bus




log


C++ 프로젝트를 시작할때, logging 을 먼저 준비하는것이 중요하다.



Log for C++


http://log4cpp.sourceforge.net/


log4cplus
http://log4cplus.sourceforge.net/


log4cxx
http://logging.apache.org/log4cxx/


Pantheios
http://www.pantheios.org/


MinGW 에서 COM 사용 - (COM Wrapper)



MinGW           - open-source 컴파일러(GCC)
Code::Block   - open-source IDE
boost            - open-source cross-platform 라이브러리 ( thread, ipc ... )
wxWidgets     - open-source cross-platform UI 라이브러리


위 조합으로 윈도우 응용프로그램을 개발할때,
매끄럽게 해결되지 않는 부분이 COM 에대한 지원이다.

COM 을 사용하기위해서 컴파일러를 VS2008 로 바꾸는 결정을 하기도 했다.

그러나 open-source 의 매력은 참으로 강렬하다.
장기간 진행될 프로젝트를 GCC 로 해보고 싶은 욕망이 사라지지 않는다.



MinGW 에서 COM 을 사용하기 위한 방법을 검색해보았다.



VOLE 
( A Neat C++ COM/Automation Driver )
http://vole.sourceforge.net/
http://sourceforge.net/projects/vole/




DispHelper

http://disphelper.sourceforge.net/





결론은, GCC 로 COM 을 사용할 수 있는 방법이 존재한다.

실제로 사용해보니, 안된다!







2012년 5월 11일 금요일

wxWidget



wxWidget
http://www.wxwidgets.org/ )



main 함수가 보이지 않는다.
앞으로 어찌해야 하나.



















// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"


#include "wx/wx.h"


#include "wx/app.h"
#include "wx/grid.h"
#include "wx/treectrl.h"
#include "wx/spinctrl.h"
#include "wx/artprov.h"
#include "wx/clipbrd.h"
#include "wx/image.h"
#include "wx/colordlg.h"
#include "wx/wxhtml.h"
#include "wx/imaglist.h"
#include "wx/dataobj.h"
#include "wx/dcclient.h"
#include "wx/bmpbuttn.h"
#include "wx/menu.h"
#include "wx/toolbar.h"
#include "wx/statusbr.h"
#include "wx/msgdlg.h"
#include "wx/textdlg.h"






// Declare the application class
class MyApp : public wxApp
{
public:
// Called on application startup
virtual bool OnInit();
};
// Declare our main frame class
class MyFrame : public wxFrame
{
public:
// Constructor
MyFrame(const wxString& title);
// Event handlers
void OnQuit(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event);
private:
// This class handles events
DECLARE_EVENT_TABLE()
};






// Implements MyApp& GetApp()
DECLARE_APP(MyApp)
// Give wxWidgets the means to create a MyApp object
IMPLEMENT_APP(MyApp)
// Initialize the application
bool MyApp::OnInit()
{
// Create the main application window
MyFrame *frame = new MyFrame(wxT("Minimal wxWidgets App"));
// Show it
frame->Show(true);
// Start the event loop
return true;
}


// Event table for MyFrame
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(wxID_ABOUT, MyFrame::OnAbout)
EVT_MENU(wxID_EXIT, MyFrame::OnQuit)
END_EVENT_TABLE()
void MyFrame::OnAbout(wxCommandEvent& event)
{
wxString msg;
msg.Printf(wxT("Hello and welcome to %s"),
wxVERSION_STRING);




wxMessageBox(msg, wxT("About Minimal"),
wxOK | wxICON_INFORMATION, this);
}
void MyFrame::OnQuit(wxCommandEvent& event)
{
// Destroy the frame
Close();
}






#include "sample.xpm"




MyFrame::MyFrame(const wxString& title)
: wxFrame(NULL, wxID_ANY, title)
{
// Set the frame icon
// SetIcon(wxIcon(mondrian_xpm));
SetIcon(wxIcon(sample_xpm));
// Create a menu bar
wxMenu *fileMenu = new wxMenu;
// The “About” item should be in the help menu
wxMenu *helpMenu = new wxMenu;

helpMenu->Append(wxID_ABOUT, wxT("&About...\tF1"),


wxT("Show about dialog"));
fileMenu->Append(wxID_EXIT, wxT("E&xit\tAlt-X"),
wxT("Quit this program"));
// Now append the freshly created menu to the menu bar...
wxMenuBar *menuBar = new wxMenuBar();
menuBar->Append(fileMenu, wxT("&File"));
menuBar->Append(helpMenu, wxT("&Help"));
// ... and attach this menu bar to the frame
SetMenuBar(menuBar);
// Create a status bar just for fun
CreateStatusBar(2);
SetStatusText(wxT("Welcome to wxWidgets!"));
}






2011년 11월 19일 토요일

googletest



C++ 에서 Unit Test 라도 한번 해보려고 하면 머리가 아프다.






Google's framework for writing C++ tests


http://code.google.com/p/googletest/








#include "stdafx.h"
#include <gtest/gtest.h>


TEST( MyTest, Test1)
{
int a1 = 3;
int a2 = 3;
ASSERT_EQ( a1, a2);
}




TEST( MyTest, Test2)
{
int a1 = 1;
int a2 = 2;
ASSERT_EQ( a1, a2);
}




int _tmain(int argc, _TCHAR* argv[])
{
testing::InitGoogleTest( &argc, argv);

RUN_ALL_TESTS();


return 0;
}



C++







C++ 이 진리다.