5월, 2018의 게시물 표시

C 프로젝트에서 MQTT, JSON 사용하기

1. MQTT -> paho.mqtt.c 다운로드 받아서 컴파일해서 나오는 build/output/lib관련 파일을 makefile에 추가 해주면된다. 단 실행 파일 구동시 공유 파일로 되어있어야 되기 때문에 /usr/local/lib에 파일을 추가해주고 LD_LIBARY_PATH로 잡아줘야 한다. 2. JSON -> cJSON-master 다운받아서 컴파일해서 나오는 lib 파일을 makefile에 추가 해주면 된다. 단 실행 파일 구동시 공유 파일로 되어있어야 되기 때문에 /usr/local/lib에 파일을 추가해주고 LD_LIBARY_PATH로 잡아줘야 한다. *make 가 안될때 1.fatal error: openssl/ssl.h: - sudo apt - get install libssl - dev 2. nfs 상태의 파일을 컴파일하면 심볼릭 링크가 안된다. 윈도우와 리눅스 파일 시스템이 다르기 때문이다. 따라서 작업은 home 디렉토리 밑에서 해야한다. 3.cp -d : 심볼릭 링크 그대로 복사하기를 해야한다ㄴ 4. 링크 설정 : /usr/local/lib 에 복사해 놓으면    export LD_LIBRARY_PTAH=/usr/local/lib    이후 적용을 위해 ldconfig 를 실행한다.

linux error "cannot open shared object file:No such file or directory"

linux error "cannot open shared object file:No such file or directory"  (1 ) Find where the library is placed if you don't know it. sudo find / -name the_name_of_the_file.so (2) Check for the existence of the dynamic library path environment variable(LD_LIBRARY_PATH) $ echo $LD_LIBRARY_PATH if there is nothing to be displayed, add a default path value (or not if you wish to) $ LD_LIBRARY_PATH=/usr/local/lib (3) We add the desire path, export it and try the application. Note that the path should be the directory where the path.so.something is. So if path.so.something is in /my_library/path.so.something it should be : $ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/my_library/ $ export LD_LIBRARY_PATH $ ./my_app