{"_id":"55094202961f17170070abbe","project":"55093b151c38c50d00611894","user":"55093a63a4ae180d00c0eaf5","version":{"_id":"55093b161c38c50d00611897","project":"55093b151c38c50d00611894","__v":4,"createdAt":"2015-03-18T08:45:10.369Z","releaseDate":"2015-03-18T08:45:10.368Z","categories":["55093b161c38c50d00611898","55093ee2961f17170070abb9","55093ee9961f17170070abba","55093ef52ee8bf2b00491916"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"__v":3,"category":{"_id":"55093ef52ee8bf2b00491916","project":"55093b151c38c50d00611894","version":"55093b161c38c50d00611897","__v":9,"pages":["55094202961f17170070abbe","5509437a368a5617004146da","550963c0dd77250d007369c1","55096a172dd6a11900e6e774","5509811add77250d00736a1f","5509815f4ba6432d00bb7875","5509913ca2b4750d00a2341e","5509916add77250d00736a55","551923b0337285170047f861"],"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-03-18T09:01:41.604Z","from_sync":false,"order":3,"slug":"code-examples","title":"Code Examples"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-03-18T09:14:42.895Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":0,"body":"# Setting up your first project #\n\nWelcome to _the first tutorial_ !\n\nThis example teaches you how to set up your Qt project to link to the ISKN API.\n\nBefore you start, be sure you have your development environment set up (Qt (last version)).\n\n## 1. Create a new project\n\n+ To create a C++ project that will reference and use the ISKN API, choose __New File or Project__ under __File__ on the menu bar:\n\n+ In the left pane, under __Projects__, select __Applications__.\n\n+ In the center pane, select __Qt Console Application__ and press __Choose__.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/kOvc6PwlRA2LRypS4eyA_Qt_new_project.PNG\",\n        \"Qt_new_project.PNG\",\n        \"898\",\n        \"567\",\n        \"\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n\n\n+ Specify a name for the project, for example MyFirstTest, in the Name box:\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/Jl0YCWCmS6GBUoN8RHB3_Qt_new_project2.PNG\",\n        \"Qt_new_project2.PNG\",\n        \"918\",\n        \"402\",\n        \"#7a92bb\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n\n\nSelect __Desktop Qt x.x.x MinGW 32bit__ kit under the __Kit Selection__ options and press __Next__.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/w7ZDBUuSp2KGaMXUURtJ_Qt_kit_Selection.PNG\",\n        \"Qt_kit_Selection.PNG\",\n        \"918\",\n        \"497\",\n        \"#7a92b9\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n\n\nPress __Finish__:\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/dh5Atxc4TxSVFzHofrUZ_Qt_new_project3.PNG\",\n        \"Qt_new_project3.PNG\",\n        \"918\",\n        \"449\",\n        \"#7a92ba\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n\n\n## 2. Link the DLL to the project \n\nAfter you create a console app, an empty program is created for you. \nYou will find the main source file 'main.cpp' added automatically to the project. \n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/bZ9FFgmjRGqAsfyXJWNm_Qt_Projects_Window.PNG\",\n        \"Qt_Projects_Window.PNG\",\n        \"351\",\n        \"404\",\n        \"#2a98d5\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n\n\n+ To add the __ISKN API__ library: Right click on your project, and select __Add Library__ \n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/l53GclI1TwaFMfVchljI_add_library.png\",\n        \"add_library.png\",\n        \"502\",\n        \"490\",\n        \"#5fb2a4\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n\n\n+ Select __External library__ under __Library Type__ options and press __Next__.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/KTPTx3gHRZOHROFKDpBD_add_library_2.png\",\n        \"add_library_2.png\",\n        \"523\",\n        \"378\",\n        \"#7c514e\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n\n\n+ Specify the library to link and the include path. Then select __Dynamic__ under __Linkage__ options. \nFinally you can press the __Finish__.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/eYUPkuJqQ26KtMAvcCq9_add_library_3.png\",\n        \"add_library_3.png\",\n        \"598\",\n        \"561\",\n        \"#c9997a\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n\n\n## Enabling C++ 11 support in Qt :\n\nThe ISKN API uses some features of the c++11 language.\nSince the support of most the new features of the C++11 language standard is quite spread in most of recent C++ compilers ,\nstill several of such compilers need command line options to enable C++11 support. While using qmake as your build system,\nyou can add the following line to your qmake project file in order to produce a make file\nwith suitable options for your compiler: \"CONFIG += c++11\".\n\nMyFirstTest.pro:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"CONFIG += c++11\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\n\n\nor you can add :\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"QMAKE_CFLAGS = -std=c++11  \\nQMAKE_CXXFLAGS = -std=c++11  \\nQMAKE_LFLAGS = -std=c++11  \",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\n\n\n## Test the project:\n\nNow that everything is set up, go to the main file, include the ISKN_API.h and add the ISKN_API namespace.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"#include \\\"ISKN_API.h\\\"\\nusing namespace ISKN_API;\",\n      \"language\": \"cplusplus\"\n    }\n  ]\n}\n[/block]\n\n\nTo test the project add a __Hello World__ message: \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"cout << \\\"Hello world !\\\" << endl;\",\n      \"language\": \"cplusplus\"\n    }\n  ]\n}\n[/block]\n\n\nDon't forget to add the __iostream__ class and the __std__ namespace to use the standard output stream (cout):\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"#include <iostream>\\nusing namespace std;\",\n      \"language\": \"cplusplus\"\n    }\n  ]\n}\n[/block]\n\n\nYou can now run the project. You should have the text \"Hello World !\" printed to a console screen.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/eBLRb0R3SpakogOexG4h_Qt_Console.PNG\",\n        \"Qt_Console.PNG\",\n        \"843\",\n        \"111\",\n        \"#c05351\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n\n\n## You're now ready to use the ISKN API in a Qt project!\n\n[Next example](slate-theremin-example-on-qt)","excerpt":"","slug":"getting-started-with-iskn-api-on-qt","type":"basic","title":"Getting started with ISKN API on Qt"}

Getting started with ISKN API on Qt


# Setting up your first project # Welcome to _the first tutorial_ ! This example teaches you how to set up your Qt project to link to the ISKN API. Before you start, be sure you have your development environment set up (Qt (last version)). ## 1. Create a new project + To create a C++ project that will reference and use the ISKN API, choose __New File or Project__ under __File__ on the menu bar: + In the left pane, under __Projects__, select __Applications__. + In the center pane, select __Qt Console Application__ and press __Choose__. [block:image] { "images": [ { "image": [ "https://files.readme.io/kOvc6PwlRA2LRypS4eyA_Qt_new_project.PNG", "Qt_new_project.PNG", "898", "567", "", "" ] } ] } [/block] + Specify a name for the project, for example MyFirstTest, in the Name box: [block:image] { "images": [ { "image": [ "https://files.readme.io/Jl0YCWCmS6GBUoN8RHB3_Qt_new_project2.PNG", "Qt_new_project2.PNG", "918", "402", "#7a92bb", "" ] } ] } [/block] Select __Desktop Qt x.x.x MinGW 32bit__ kit under the __Kit Selection__ options and press __Next__. [block:image] { "images": [ { "image": [ "https://files.readme.io/w7ZDBUuSp2KGaMXUURtJ_Qt_kit_Selection.PNG", "Qt_kit_Selection.PNG", "918", "497", "#7a92b9", "" ] } ] } [/block] Press __Finish__: [block:image] { "images": [ { "image": [ "https://files.readme.io/dh5Atxc4TxSVFzHofrUZ_Qt_new_project3.PNG", "Qt_new_project3.PNG", "918", "449", "#7a92ba", "" ] } ] } [/block] ## 2. Link the DLL to the project After you create a console app, an empty program is created for you. You will find the main source file 'main.cpp' added automatically to the project. [block:image] { "images": [ { "image": [ "https://files.readme.io/bZ9FFgmjRGqAsfyXJWNm_Qt_Projects_Window.PNG", "Qt_Projects_Window.PNG", "351", "404", "#2a98d5", "" ] } ] } [/block] + To add the __ISKN API__ library: Right click on your project, and select __Add Library__ [block:image] { "images": [ { "image": [ "https://files.readme.io/l53GclI1TwaFMfVchljI_add_library.png", "add_library.png", "502", "490", "#5fb2a4", "" ] } ] } [/block] + Select __External library__ under __Library Type__ options and press __Next__. [block:image] { "images": [ { "image": [ "https://files.readme.io/KTPTx3gHRZOHROFKDpBD_add_library_2.png", "add_library_2.png", "523", "378", "#7c514e", "" ] } ] } [/block] + Specify the library to link and the include path. Then select __Dynamic__ under __Linkage__ options. Finally you can press the __Finish__. [block:image] { "images": [ { "image": [ "https://files.readme.io/eYUPkuJqQ26KtMAvcCq9_add_library_3.png", "add_library_3.png", "598", "561", "#c9997a", "" ] } ] } [/block] ## Enabling C++ 11 support in Qt : The ISKN API uses some features of the c++11 language. Since the support of most the new features of the C++11 language standard is quite spread in most of recent C++ compilers , still several of such compilers need command line options to enable C++11 support. While using qmake as your build system, you can add the following line to your qmake project file in order to produce a make file with suitable options for your compiler: "CONFIG += c++11". MyFirstTest.pro: [block:code] { "codes": [ { "code": "CONFIG += c++11", "language": "text" } ] } [/block] or you can add : [block:code] { "codes": [ { "code": "QMAKE_CFLAGS = -std=c++11 \nQMAKE_CXXFLAGS = -std=c++11 \nQMAKE_LFLAGS = -std=c++11 ", "language": "text" } ] } [/block] ## Test the project: Now that everything is set up, go to the main file, include the ISKN_API.h and add the ISKN_API namespace. [block:code] { "codes": [ { "code": "#include \"ISKN_API.h\"\nusing namespace ISKN_API;", "language": "cplusplus" } ] } [/block] To test the project add a __Hello World__ message: [block:code] { "codes": [ { "code": "cout << \"Hello world !\" << endl;", "language": "cplusplus" } ] } [/block] Don't forget to add the __iostream__ class and the __std__ namespace to use the standard output stream (cout): [block:code] { "codes": [ { "code": "#include <iostream>\nusing namespace std;", "language": "cplusplus" } ] } [/block] You can now run the project. You should have the text "Hello World !" printed to a console screen. [block:image] { "images": [ { "image": [ "https://files.readme.io/eBLRb0R3SpakogOexG4h_Qt_Console.PNG", "Qt_Console.PNG", "843", "111", "#c05351", "" ] } ] } [/block] ## You're now ready to use the ISKN API in a Qt project! [Next example](slate-theremin-example-on-qt)