Assalamualaikum
Untuk melancarkan penggunaan webservices yang banyak menggunakan json dalam kod program qt4.8, adalah perlu untuk kita kompil dan rujuk fail librari ini secara manual.
Untuk lebih mudah, gunakan qt versi 5 keatas kerana sokongan untuk json ini telah sedia install.
Keperluan
1. Muat turun dan install
https://github.com/flavio/qjson
- unzipkan fail ke dalam satu folder
3. Setkan Environment Path dalam windows anda
-- The C compiler identification is GNU 5.3.0
-- The CXX compiler identification is GNU 5.3.0
-- Check for working C compiler: C:/MinGW/bin/gcc.exe
-- Check for working C compiler: C:/MinGW/bin/gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/MinGW/bin/g++.exe
-- Check for working CXX compiler: C:/MinGW/bin/g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Deprecation Warning at CMakeLists.txt:11 (cmake_policy):
The OLD behavior for policy CMP0020 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
Qt5 not found, searching for Qt4
-- Looking for Q_WS_X11
-- Looking for Q_WS_X11 - not found
-- Looking for Q_WS_WIN
-- Looking for Q_WS_WIN - found
-- Looking for Q_WS_QWS
-- Looking for Q_WS_QWS - not found
-- Looking for Q_WS_MAC
-- Looking for Q_WS_MAC - not found
-- Found Qt4: C:/Qt/4.8.6/bin/qmake.exe (found suitable version "4.8.6", minimum required is "4.5")
Enable QStringBuilder
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/user2/qjson-master/build
9. Setelah selesai, masukkan arahan berikut pula
[ 8%] Generating moc_serializerrunnable.cxx
[ 16%] Generating moc_parserrunnable.cxx
Scanning dependencies of target qjson
[ 25%] Building CXX object src/CMakeFiles/qjson.dir/parser.cpp.obj
[ 33%] Building CXX object src/CMakeFiles/qjson.dir/qobjecthelper.cpp.obj
[ 41%] Building CXX object src/CMakeFiles/qjson.dir/json_scanner.cpp.obj
[ 50%] Building CXX object src/CMakeFiles/qjson.dir/json_parser.cc.obj
[ 58%] Building CXX object src/CMakeFiles/qjson.dir/parserrunnable.cpp.obj
[ 66%] Building CXX object src/CMakeFiles/qjson.dir/serializer.cpp.obj
[ 75%] Building CXX object src/CMakeFiles/qjson.dir/serializerrunnable.cpp.obj
[ 83%] Building CXX object src/CMakeFiles/qjson.dir/moc_parserrunnable.cxx.obj
[ 91%] Building CXX object src/CMakeFiles/qjson.dir/moc_serializerrunnable.cxx.obj
[100%] Linking CXX shared library libqjson.dll
[100%] Built target qjson
[100%] Built target qjson
Install the project...
-- Install configuration: ""
-- Installing: C:/Program Files (x86)/qjson/lib/cmake/qjson/QJSONTargets.cmake
-- Installing: C:/Program Files (x86)/qjson/lib/cmake/qjson/QJSONTargets-noconfig.cmake
-- Installing: C:/Program Files (x86)/qjson/lib/cmake/qjson/QJSONConfig.cmake
-- Installing: C:/Program Files (x86)/qjson/lib/cmake/qjson/QJSONConfigVersion.cmake
-- Installing: C:/Program Files (x86)/qjson/lib/libqjson.dll.a
-- Installing: C:/Program Files (x86)/qjson/bin/libqjson.dll
-- Installing: C:/Program Files (x86)/qjson/include/qjson/parser.h
-- Installing: C:/Program Files (x86)/qjson/include/qjson/parserrunnable.h
-- Installing: C:/Program Files (x86)/qjson/include/qjson/qobjecthelper.h
-- Installing: C:/Program Files (x86)/qjson/include/qjson/serializer.h
-- Installing: C:/Program Files (x86)/qjson/include/qjson/serializerrunnable.h
-- Installing: C:/Program Files (x86)/qjson/include/qjson/qjson_export.h
Untuk melancarkan penggunaan webservices yang banyak menggunakan json dalam kod program qt4.8, adalah perlu untuk kita kompil dan rujuk fail librari ini secara manual.
Untuk lebih mudah, gunakan qt versi 5 keatas kerana sokongan untuk json ini telah sedia install.
Keperluan
1. Muat turun dan install
- qt4.8, https://download.qt.io/archive/qt/4.8/ => installkan ke C:\Qt
- cmake for windows, https://cmake.org/download/
- installkan ke folder C:\Program Files\CMake
- minGW, https://downloads.sourceforge.net/project/mingw/Installer/mingw-get-setup.exe
- installkan ke folder C:\MinGW
https://github.com/flavio/qjson
- unzipkan fail ke dalam satu folder
3. Setkan Environment Path dalam windows anda
- Select Start, select Control Panel. double click System, and select the Advanced tab.
- Click Environment Variables. ...
- In the Edit System Variable (or New System Variable) window, specify the value of the PATH environment variable. ...
masukkan dalam path:
- C:\Qt\4.8.6\bin
- C:\MinGW\bin
- C:\Program Files\CMake\bin
4. Buka Command Prompt sebagai administrator
-> klik kanan pada butang windows start, pilih command prompt (Admin)
5. Selusur ke folder qjson yang telah di unzip
- guna arahan cd untuk buka folder
7. buka folder build
- cd build
cmake -G "MinGW Makefiles" ..C:\Users\user2\qjson-master\build>cmake -G "MinGW Makefiles" ..
-- The C compiler identification is GNU 5.3.0
-- The CXX compiler identification is GNU 5.3.0
-- Check for working C compiler: C:/MinGW/bin/gcc.exe
-- Check for working C compiler: C:/MinGW/bin/gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/MinGW/bin/g++.exe
-- Check for working CXX compiler: C:/MinGW/bin/g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Deprecation Warning at CMakeLists.txt:11 (cmake_policy):
The OLD behavior for policy CMP0020 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
Qt5 not found, searching for Qt4
-- Looking for Q_WS_X11
-- Looking for Q_WS_X11 - not found
-- Looking for Q_WS_WIN
-- Looking for Q_WS_WIN - found
-- Looking for Q_WS_QWS
-- Looking for Q_WS_QWS - not found
-- Looking for Q_WS_MAC
-- Looking for Q_WS_MAC - not found
-- Found Qt4: C:/Qt/4.8.6/bin/qmake.exe (found suitable version "4.8.6", minimum required is "4.5")
Enable QStringBuilder
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/user2/qjson-master/build
9. Setelah selesai, masukkan arahan berikut pula
makeC:\Users\user2\qjson-master\build>make
[ 8%] Generating moc_serializerrunnable.cxx
[ 16%] Generating moc_parserrunnable.cxx
Scanning dependencies of target qjson
[ 25%] Building CXX object src/CMakeFiles/qjson.dir/parser.cpp.obj
[ 33%] Building CXX object src/CMakeFiles/qjson.dir/qobjecthelper.cpp.obj
[ 41%] Building CXX object src/CMakeFiles/qjson.dir/json_scanner.cpp.obj
[ 50%] Building CXX object src/CMakeFiles/qjson.dir/json_parser.cc.obj
[ 58%] Building CXX object src/CMakeFiles/qjson.dir/parserrunnable.cpp.obj
[ 66%] Building CXX object src/CMakeFiles/qjson.dir/serializer.cpp.obj
[ 75%] Building CXX object src/CMakeFiles/qjson.dir/serializerrunnable.cpp.obj
[ 83%] Building CXX object src/CMakeFiles/qjson.dir/moc_parserrunnable.cxx.obj
[ 91%] Building CXX object src/CMakeFiles/qjson.dir/moc_serializerrunnable.cxx.obj
[100%] Linking CXX shared library libqjson.dll
[100%] Built target qjson
10. Akhir sekali, masukkan arahan ini
make installC:\Users\user2\qjson-master\build>make install
[100%] Built target qjson
Install the project...
-- Install configuration: ""
-- Installing: C:/Program Files (x86)/qjson/lib/cmake/qjson/QJSONTargets.cmake
-- Installing: C:/Program Files (x86)/qjson/lib/cmake/qjson/QJSONTargets-noconfig.cmake
-- Installing: C:/Program Files (x86)/qjson/lib/cmake/qjson/QJSONConfig.cmake
-- Installing: C:/Program Files (x86)/qjson/lib/cmake/qjson/QJSONConfigVersion.cmake
-- Installing: C:/Program Files (x86)/qjson/lib/libqjson.dll.a
-- Installing: C:/Program Files (x86)/qjson/bin/libqjson.dll
-- Installing: C:/Program Files (x86)/qjson/include/qjson/parser.h
-- Installing: C:/Program Files (x86)/qjson/include/qjson/parserrunnable.h
-- Installing: C:/Program Files (x86)/qjson/include/qjson/qobjecthelper.h
-- Installing: C:/Program Files (x86)/qjson/include/qjson/serializer.h
-- Installing: C:/Program Files (x86)/qjson/include/qjson/serializerrunnable.h
-- Installing: C:/Program Files (x86)/qjson/include/qjson/qjson_export.h
kompil selesai.. selamat mencoba..
Ulasan
Catat Ulasan
Comment