Front Page › Forums › Installing and compiling › Adding new project to H3DAPI using CMAKE
- This topic has 8 replies, 2 voices, and was last updated 7 years, 10 months ago by Markus.
-
AuthorPosts
-
June 21, 2016 at 3:57 am #737408malikkkzParticipant
I have added H3D to visual studio 2010 project successfully and are working properly. But when I add a new file/project to this existing project, I am unable to call the headers/functions from existing projects.
Any solution to this problem.June 21, 2016 at 5:22 am #737409MarkusKeymasterDid you add it to the H3DWithToolkitsWin.sln file by using CMake or did you add it to that solution manually or do you have your own solution file?
If you have your own solution file, with no other projects in it, then the directories you need to add to find headers would be these locations when assuming a default
installation:
-c:H3DH3DUtilinclude
-c:H3DHAPIinclude
-c:H3DHAPIOpenHapticsRendererinclude
-c:H3DHAPIChai3DRendererinclude
-c:H3DH3DAPIincludeThe reference to OpenHapticsRenderer and Chai3DRenderer should only be needed if HAPI is built with support for those libraries (check HAPI.h for this).
If you are adding your project to the H3DWithToolkitsWin.sln file without using CMake then you need to add some additional locations from the directory in which you have the solution file. Relative to the solution file you will have
– H3DAPIinclude
– H3DAPIHAPIinclude
– H3DAPIHAPIH3DUtilincludeIf you are adding your project in the same solution file using CMake then you basically need to copy the setup for for example the UI project. Specifically the section that starts with
IF( H3D_USE_DEPENDENCIES_ONLY )If you want to use include files/classes from any of the toolkits project (UI/H3DPhysics/MedX3D) you need to add their directories as well, the location of their include directores follow the same pattern as above.
And finally, when you have added all this include directories the way to refer to the files are for example like this:
#include
#include
#include
#includeJune 21, 2016 at 6:23 am #737410malikkkzParticipantThanks Markus,
I have tried option no 1. i.e., adding directory to my own solution with no other project.
I am getting error in following statement
H3DNodeDatabase myproject::database( “myproject”,
&(newInstance), typeid( myproject ),
&X3DGeometryNode::database );
error is: expected a ‘)’June 21, 2016 at 12:24 pm #737411MarkusKeymasterTry putting:
using namespace H3D;
before the code you showed.
If that works, then decide if you want to use namespace or write H3D:: in all places required.June 22, 2016 at 5:30 am #737412malikkkzParticipantThe mentioned statement is already there i.e using namespace H3D; So its not working.
Following statement is also showing error
FIELDDB_ELEMENT( myproject, isovalue, INPUT_OUTPUT );
the error is
#define FIELDDB_ELEMENT(base,field,access)FIELDDBInsert field (access(&base::database,#field,&base::field));
error; no instance of function template “H3D::INPUT_OUTPUT” matches the argument list.June 22, 2016 at 7:37 am #737413MarkusKeymasterIs your class “myproject” inheriting from some node class (it looks like X3DGeometryNode) and does it have a member variable named isovalue that is declared something like this:
auto_ptr isovalue;June 22, 2016 at 8:05 am #737414malikkkzParticipantYes myproject is inherited from X3DGeometryNode, and it contains a member variable name
auto_ptr isovalue;June 22, 2016 at 9:48 am #737415MarkusKeymasterThen I don’t know.
Please just test one thing first.
Try adding those files (the cpp and header) directly into H3DAPI (if you have that solution file already somewhere). If you don’t then please share the code as it is right now. Header and src. Remember to use the code tag when posting so it formats properly (see options above when writing a new post).June 22, 2016 at 9:48 am #727869malikkkzParticipant -
AuthorPosts
- You must be logged in to reply to this topic.