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!"));
}