January 25, 2018 at 3:25 am #737502
I wrote a new node and I’m attempting to recompile H3DAPI and HAPI to include in my next environment. I created a source file and header file for each program (HAPI, H3DAPI). As far as I understand, I followed instructions in the manual/wiki.
The problem comes when I try to recompile. I’m using Windows 10, CMake 3.10.2, and Visual Studio 2017. CMake gave DIR-NOTFOUND for all wxWidgets… but still produced a solution file. When I tried building in Studio, both ALL_BUILD and H3DAPI did not complete successfully. The first error, which seems to be referenced in most of the other errors was:
[quote]Error C2011 ‘timespec’: ‘struct’ type redefinition (compiling source file C:H3DH3DUtilsrcThreads.cpp) H3DUtil C:H3DExternalincludepthreadpthread.h 307 [/quote]
The error somehow does not point to the [i]other[/i] place timespec was defined, I am unsure how to proceed from here.
Help is much appreciated.
-YazJanuary 25, 2018 at 3:25 am #727896January 25, 2018 at 7:08 am #737503
The latest release will not compile with visual studio 2015 and 2017 unless you:
– Make some changes in the code to compile (fixing timespec issue for example) it is fixed in the latest trunk.
– Compile the external libraries with the desired compiler, or get the ones from subversion repository https://h3dapi.org:8090/External/vs2017
If you are going to use visual studio 2017 and you are comfortable with svn checkouts I would recommend to just checkout latest trunk for H3DWithToolkitsWin (see information in wiki) and replace the checked out External directory with the visual studio 2017 one above.
We have started the process of making a new release but due to time limitations it will not be done any time soon.
You could also get the latest source code from here ftp://www.h3dapi.org/pub/nightlybuilds/source/
but like I said, you still need the Visual studio 2017 externals.January 27, 2018 at 1:46 am #737504
Thank you Markus for the quick response and easy-to-follow instructions. Here’s what I did so far:
1- Reinstalled H3D 2.3.0 (to start clean)
2- Added my cpp and header files in the appropriate folders, then copied and replaced files with the new trunk H3D release you pointed me to. Finally, I deleted the old “External” directory and copied the new files from your link.
3- Re-ran CMake with [quote]C:H3D[/quote] failed, so I used [quote]C:H3Dbuild[/quote], that succeeded and produced a solution file (after changing configure settings to Studio 2017 x64)
4- Opened the solution file in Visual Studio 2017, changed from debug to release and built “ALL_BUILD”, that succeeded without errors (Thank you!)
5- Copied the few dll files it was looking for into the h3dload release folder and the h3dviewer release folder
6- created an x3d file with a sphere and my new node and ran it inside h3dviewer
Now, if I look at the console inside h3dviewer (under Advanced), it says it cannot find my node:
[quote]Warning: Could not create “X” node. It does not exist in the H3DNodeDatabase (C:H3DH3DAPIexamplesAllY.x3d line 14)[/quote]
(X and Y are stand-ins for the actual names)
How do I add the node that was compiled in the H3DNodeDatabase? I have the requisite
in my cpp file, and when you recompile, cmake just adds all the files in the source and include folders, right? Basically, the way I understand it, CMakeLists.txt adds folders, not individual files.
-YazJanuary 29, 2018 at 8:36 am #737505
Good that my instructions helped you to get it to compile at least.
[quote]cmake just adds all the files in the source and include folders, right?[/quote]
No this is not entirely true, it depends on the authors of the CMakeLists.txt. It is actually not recommended (if I remember correclty) to use the commands that add all files in directories to the project. It is much better to list the files. So you have a couple of choices.
1. Add the files manually to the generated project.
2. Modify H3DAPIbuildH3DAPISourceFiles.txt so that your files are added in the list (should be a fairly self explanatory file)
3. Create a completely different project in the style of MedX3D or UI that you can then import into your x3d files using the ImportLibrary nodes url field (see example x3d files in UI or MedX3D).February 2, 2018 at 10:32 pm #737506
Thank you! Adding the files to the existing solution in visual studio worked. Now the project is seeing (most) files and compiling at least. There are few issues with my code but those are not related to the compilation.
I have a small issue that popped up with two of the header files I wrote. The files are part of the H3DAPI project. The cpp files are seen and are compiling, but the first line is returning an error saying it cannot find the associated header files. the line in the cpp file is written as:
I also tried:
and, trying to follow the folder structure, I tired:
for some reason it still cannot find the header files. Am I missing something here? Should I just move the two offending header files (both of which I wrote) to the same folder as the cpp files under H3DAPI?
-YazFebruary 5, 2018 at 8:59 am #737507
if you have put the header files in the same location as the other H3D header files (H3DAPI/H3D/include) then you should use the H3D/X.h variant.
Just make sure that there is not any kind of case sensitivity going on. i.e are they named X.h or x.h? or perhaps Xy.h instead of XY.h.
If you have them in a completely different location than the other H3D headers just make sure that this include directory is added to the project settings.
If you can not figure it out put them with the source file and use “” instead of . Although it should just be a matter of writing the correct path.
As a final warning, not related to this issue, adding files to the existing solution will work fine as long as you never touch any of the CMakeLists.txt files or regenerate the solution using CMake because if you do that you have to readd them manually.. When you are set on what the files should be called then I would recommend that you add them in cmake so they are always in the solution file.February 21, 2018 at 5:25 am #737508
Thank you Markus, the instructions worked perfectly.
I deleted the new files from the project, changed the include statement to H3D/X.h and added them to the project again. Now the compiler sees all the files.
HAPI compiled successfully, had a few errors at first that I fixed without much trouble. H3DAPI is not compiling at all though.
I don’t know if this forum/thread is the appropriate place to ask about this, since it is related to the node I’m adding to H3D. The first error (sorted by line, the way I usually debug) states that one of my node elements is not a member of H3D::[Node name]. I thought the code in the header file will [i]define [/i]that node and its members, but it seems I’m missing something.February 21, 2018 at 6:39 am #737509
Really hard for me to help you with this without any kind of code.
If you do not want to share the code at this point could you at least just create a simple class that exhibits the behaviour?
Create some new files, name them something like TestClass or similar and add only one member and see if you can get the issue you are having.
You must be logged in to reply to this topic.