목록프로그래밍일반 (16)
웹프로그래밍
파이썬 모듈을 C, C++ 에서 호출하는 과정에서 겪은 시행착오를 기록 하였으며 마지막 부분에서는 실제 동작하는 코드와 컴파일 방법을 제시합니다. 작업환경 파이썬 : 2.6.5 운영체제 : Linux Fedora 12 커널 : 2.6.32 gcc : 4.3.3 파이썬에대한 문법적, 개념적 지식이 없더라도 소스를 보시면 쉽게 이해할 수 있을거라 생각합니다.컴파일 옵션중 라이브러리 관련 부분은 자신의 경로에 맞게 수정해야 합니다.결과부터 보고싶다면 9번섹션만 보아도 무방하며 링크 오류 발생시에는 1번부터 따라가며 자신에 맞는 컴파일 옵셙을 찾아내야 합니다. 다음 코드는 국내 블로거 한분이 파이썬의 내장함수를 C언어에서 사용하는 방법을 제시한 것이며 이 코드로 부터 시작합니다. 출처 : http://mc787..
1. 이클립스에 파이썬 기능 추가하기 http://mcchae.egloos.com/10479233 2. 디버깅하기 http://pydev.org/manual_101_run.html 단축키 요약 F9 : Run F11 : Debugging Ctrl+F10 : Break point F5: Step into F6: Step over F7: Step return F8: Resume execution
다음 이슈들은 발생한 순서에 따라 번호가 증가한다. 이슈1 : 파이썬을 빌드할 때 binascii 모듈의 빌드를 실패했 기 때문에 트위터api를 사용하면 binascii모듈을 import할 수 없다는 에러메시지 발생함. 대처 : 파이썬2.2.1. 버전을 빌드할 때 만들어진 binascii.so를 2.6.5버전 디렉터리에 복사해 넣어봄 결과 : 버전관련 경고가 뜨지만 어쨋든 import는 가능함. 이슈2 : 위의 문제를 해결하고 나니 simplejason모듈이 없다는 에러가 발생 대처 : python-twitter의 simplejason폴더를 Python2.6.5의 lib디렉터리에 복사 결과 : 에러 없어짐 이슈3 : 2.6.5버전의 binascii.c를 공유라이브러리(binsascii.so)로 따로 빌드..
Issue1. 빌드옵션, 스레드, 파이썬사용. gcc main.c -I/usr/include/python2.6 -pthread -lm -ldl -lutil /usr/lib/libpython2.6.so -DREENTRANT -lpthread `pkg-config --cflags --libs directfb` Issue2. 타겟보드 빌드export PKG_CONFIG_PATH=/opt/nfsroot/opt/dfb/lib/pkgconfig해당 경로의 directfb.pc 파일의 prefix수정빌드옵션 : mipsel-linux-g++ main.cpp -I/usr/include/python2.6 -pthread -lm -ldl -lutil /opt/nfsroot/Python-2.6.5/_install/lib/l..
Issue1: emit()을 할 수 있는 객체는 signal을 선언한 객체가 아니라 connect()를 한 객체이다.Issue2: 슬롯의 argument가 없을 때에는 다음과 같이 시그널을 생성한다. sigc::signal sig_a_signal;
Issue1 :-L옵션으로 필요한 라이브러리의 경로를 지정해 주는것 만으로는 부족하다.-l 옵션으로 라이브러리 파일의 이름까지 지정해 주어야 한다. Issue2:pkg-config를 사용하기 전에 *.pc파일을 열어서 올바른 경로를 지정하고 있는지 확인할 필요가 있다. 이번 건의 경우 헤더 파일의 경로가 엉뚱한 곳을 가리키고 있었다. 그래서 결국 pkg-config를 사용하지 않고 -L옵션으로 올바른 경로를 지정해 주었다.만약 pkg-config경로가 올바르게되어 있었다면 Issue1도 발생하지 않았을 것이다.