{"_id":"550963c0dd77250d007369c1","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"},"__v":10,"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"},"project":"55093b151c38c50d00611894","user":"55093bd84510200d00adf3c7","updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-03-18T11:38:40.037Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":2,"body":"# Setting up your project #\n\nWelcome to _the first tutorial_ !\n\nThis example teaches you how to set up your VS project to link to the ISKN API.\n\nBefore you start, be sure you have your development environment set up (Visual Studio).\n \n## 1. Create a new project\n\n+ To create a C++ app that will use the __ISKN API__ , choose __File__,__New__,__Project__ on the menu bar.\n\n+ In the left pane, select __Win32__ under __Visual C++ Templates__ options.\n\n+ In the center pane, select __Win32 Console Application__.\n\n+ Specify names for your project and your solution in the Name box, for example MyFirstTest.Next, press __OK__.\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/WnI1xMuyTJKBiPsoh13B_VS_New_Project.PNG\",\n        \"VS_New_Project.PNG\",\n        \"955\",\n        \"582\",\n        \"#435781\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n\n+ On the Overview page of the Win32 Application Wizard dialog box, choose the __Next__.\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/n2WICQpgRgS11jMnmFMk_Win32_AppWizard.PNG\",\n        \"Win32_AppWizard.PNG\",\n        \"685\",\n        \"531\",\n        \"#b7573e\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n\n+ On the Application Settings page, under Application type, select __Console application__.\n\n+ On the Application Settings page, under __Additional options__, clear the __Precompiled header__ check box.\n\n+ Press __Finish__ to create the project.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/PG7SbOSlR9mi0XlgwZlO_Win32_AppWizardFINISH.PNG\",\n        \"Win32_AppWizardFINISH.PNG\",\n        \"685\",\n        \"531\",\n        \"#b75840\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n## 2.Link the DLL to the project\n\n+ Once a new console app is made, an empty program is automatically created. \nThe name of the source file is the same as the name that you chose earlier.\nIn this example, it is named MyFirstTest.cpp.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/V9XT0sH3TBKx9Sky4fqb_Solution_Explorer.PNG\",\n        \"Solution_Explorer.PNG\",\n        \"349\",\n        \"430\",\n        \"#156eae\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n+ In order to include the header files you need to give the compiler a specific directory containing these files.\nTo do so, go to: __Project Properties->Configuration Properties->C/C++->General__ and give the path of this directory into __Additional Include Directories__\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/8tTACGbKQju2XSqSBXD5_Include_Files.PNG\",\n        \"Include_Files.PNG\",\n        \"766\",\n        \"445\",\n        \"#a0433c\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n+ Link the DLL to your project.\nSince you are using a native DLL only adding __New Reference__ will not work.\nTo link the DLL you must add the file with the .lib extension. So _ISKN_API.lib_ is your label.\nIf you add this to your project as a linker input then your project will find the symbols defined inside your DLL and compile properly.\nTo do this, go to __Project Properties->Configuration Properties->Linker->Input__ and look for __Additional dependencies__.\nIf you put the name of the .lib file (including the extension) the project will automatically try to link the DLL.\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/ud8TsfuR2mIi0e2dnz5A_Linker_Input_AddiDependencies.PNG\",\n        \"Linker_Input_AddiDependencies.PNG\",\n        \"766\",\n        \"445\",\n        \"#3e9ff4\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nYou also need to put the .lib file in place where the linker will find it,\neither in the same directory as the project file or into another directory using __Additional Library Directories__ under __General__.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/30PWLa4kRCG8ImexGYqf_Additional_Library_Directories.PNG\",\n        \"Additional_Library_Directories.PNG\",\n        \"766\",\n        \"445\",\n        \"#3e9ff6\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n+ Get the compiler to see the DLL.\nPlacing the DLL file into the same folder as the executable is by far the simplest solution.\nThis is the default search path for dependencies, so you won't need to do anything special with that option.\n\n## 3.Test the project\nNow that everything is set up, go to the \"MyFirstTest.cpp\" file, include the ISKN_API.h and add the ISKN_API namespace.\n\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]\nTo test the project go to the main function and 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]\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]\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    }\n  ]\n}\n[/block]\n## You're now ready to use the ISKN API!\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/akLOokU1TJK3mz2RVqqD_VS_Console.PNG\",\n        \"VS_Console.PNG\",\n        \"843\",\n        \"111\",\n        \"#be5350\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n[Next example](magicbeep-example-on-vs)","excerpt":"","slug":"getting-started-with-iskn-api-on-vs","type":"basic","title":"Getting started with ISKN API on VS"}

Getting started with ISKN API on VS


# Setting up your project # Welcome to _the first tutorial_ ! This example teaches you how to set up your VS project to link to the ISKN API. Before you start, be sure you have your development environment set up (Visual Studio). ## 1. Create a new project + To create a C++ app that will use the __ISKN API__ , choose __File__,__New__,__Project__ on the menu bar. + In the left pane, select __Win32__ under __Visual C++ Templates__ options. + In the center pane, select __Win32 Console Application__. + Specify names for your project and your solution in the Name box, for example MyFirstTest.Next, press __OK__. [block:image] { "images": [ { "image": [ "https://files.readme.io/WnI1xMuyTJKBiPsoh13B_VS_New_Project.PNG", "VS_New_Project.PNG", "955", "582", "#435781", "" ] } ] } [/block] + On the Overview page of the Win32 Application Wizard dialog box, choose the __Next__. [block:image] { "images": [ { "image": [ "https://files.readme.io/n2WICQpgRgS11jMnmFMk_Win32_AppWizard.PNG", "Win32_AppWizard.PNG", "685", "531", "#b7573e", "" ] } ] } [/block] + On the Application Settings page, under Application type, select __Console application__. + On the Application Settings page, under __Additional options__, clear the __Precompiled header__ check box. + Press __Finish__ to create the project. [block:image] { "images": [ { "image": [ "https://files.readme.io/PG7SbOSlR9mi0XlgwZlO_Win32_AppWizardFINISH.PNG", "Win32_AppWizardFINISH.PNG", "685", "531", "#b75840", "" ] } ] } [/block] ## 2.Link the DLL to the project + Once a new console app is made, an empty program is automatically created. The name of the source file is the same as the name that you chose earlier. In this example, it is named MyFirstTest.cpp. [block:image] { "images": [ { "image": [ "https://files.readme.io/V9XT0sH3TBKx9Sky4fqb_Solution_Explorer.PNG", "Solution_Explorer.PNG", "349", "430", "#156eae", "" ] } ] } [/block] + In order to include the header files you need to give the compiler a specific directory containing these files. To do so, go to: __Project Properties->Configuration Properties->C/C++->General__ and give the path of this directory into __Additional Include Directories__ [block:image] { "images": [ { "image": [ "https://files.readme.io/8tTACGbKQju2XSqSBXD5_Include_Files.PNG", "Include_Files.PNG", "766", "445", "#a0433c", "" ] } ] } [/block] + Link the DLL to your project. Since you are using a native DLL only adding __New Reference__ will not work. To link the DLL you must add the file with the .lib extension. So _ISKN_API.lib_ is your label. If you add this to your project as a linker input then your project will find the symbols defined inside your DLL and compile properly. To do this, go to __Project Properties->Configuration Properties->Linker->Input__ and look for __Additional dependencies__. If you put the name of the .lib file (including the extension) the project will automatically try to link the DLL. [block:image] { "images": [ { "image": [ "https://files.readme.io/ud8TsfuR2mIi0e2dnz5A_Linker_Input_AddiDependencies.PNG", "Linker_Input_AddiDependencies.PNG", "766", "445", "#3e9ff4", "" ] } ] } [/block] You also need to put the .lib file in place where the linker will find it, either in the same directory as the project file or into another directory using __Additional Library Directories__ under __General__. [block:image] { "images": [ { "image": [ "https://files.readme.io/30PWLa4kRCG8ImexGYqf_Additional_Library_Directories.PNG", "Additional_Library_Directories.PNG", "766", "445", "#3e9ff6", "" ] } ] } [/block] + Get the compiler to see the DLL. Placing the DLL file into the same folder as the executable is by far the simplest solution. This is the default search path for dependencies, so you won't need to do anything special with that option. ## 3.Test the project Now that everything is set up, go to the "MyFirstTest.cpp" 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 go to the main function and 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": [] } ] } [/block] ## You're now ready to use the ISKN API! [block:image] { "images": [ { "image": [ "https://files.readme.io/akLOokU1TJK3mz2RVqqD_VS_Console.PNG", "VS_Console.PNG", "843", "111", "#be5350", "" ] } ] } [/block] [Next example](magicbeep-example-on-vs)