Compiling Opennubs with makefile in a Windows environment - how to resolve errors?


(Antonig) #1

Hi all,

I have been wanting to use opennurbs within the context of a greater application as an option for a fileformat output.

My problem is that I am not a visual studio user and am having huge issues trying to get the makefile to compile correctly, currently using a Windows environment.

Given that it is tested as last working on 4.2.1, I have set both my gcc and g++ versions to this.

I have been receiving a huge number of errors. Many of them have been enumerated here: Patches for Opennurbs 6 under gcc-5.2 in linux.

Some of the simpler ones, such as using deleted functions or certain #include orders can be easily fixed with some quick syntactic fixes sometimes specific to windows. My main goal was to eventually compile a working Windows ready pull request as I was fixing small errors that were in the same files as this pull request from the poster of the above forum post: https://github.com/mcneel/opennurbs/pull/1

However, I have reached the point where I cannot make due to an overwhelming number of “variable _ not declared in this scope” errors in opennurbs_file_utilities.cpp, such as:

opennurbs_file_utilities.cpp:1705:3: error: 'KNOWNFOLDERID' was not declared in this scope
   KNOWNFOLDERID platform_path_id;

opennurbs_file_utilities.cpp:1716:41: error: 'FOLDERID_Desktop' was not declared in this scope
     ON_INTERNAL_SET_LOCAL_DIRECTORY_ID( FOLDERID_Desktop, NSDesktopDirectory );

opennurbs_file_utilities.cpp:1719:41: error: 'FOLDERID_Documents' was not declared in this scope
     ON_INTERNAL_SET_LOCAL_DIRECTORY_ID( FOLDERID_Documents, NSDocumentDirectory );

opennurbs_file_utilities.cpp:1722:41: error: 'FOLDERID_Downloads' was not declared in this scope
     ON_INTERNAL_SET_LOCAL_DIRECTORY_ID( FOLDERID_Downloads, NSDownloadsDirectory );

opennurbs_file_utilities.cpp:1734:25: error: 'KF_FLAG_DEFAULT' was not declared in this scope
   const DWORD dwFlags = KF_FLAG_DEFAULT;

opennurbs_file_utilities.cpp:1737:24: error: '::SHGetKnownFolderPath' has not been declared
   const HRESULT hr = ::SHGetKnownFolderPath(

opennurbs_file_utilities.cpp:1738:5: error: 'platform_path_id' was not declared in this scope
     platform_path_id,

opennurbs_file_utilities.cpp:1747:5: error: 'CoTaskMemFree' was not declared in this scope
     CoTaskMemFree(windows_path);

opennurbs_file_utilities.cpp: In constructor 'ON_DirectoryIteratorImpl::ON_DirectoryIteratorImpl()':
opennurbs_file_utilities.cpp:2169:11: error: 'm_dirent_name_buffer' was not declared in this scope
   memset(&m_dirent_name_buffer[0],0,sizeof(m_dirent_name_buffer));

And so forth. I know this is quite complicated, but I am just looking to figure out how to resolve this errors and create a working build. I would be very grateful if anyone has some help or a direction they can point me in to resolve this because these scope errors are opaque to me.


(Dale Fugier) #2

Hi @antonig,

OpenNURBS builds with the free Visual Studio 2017 Community. There isn’t to building the solution - you just open it in Visual Studio and poke the build button.

Would having pre-built binaries help you?

– Dale


(Nathan 'jesterKing' Letwory) #3

@antonig if you want to build with GCC on Windows you’ll have to make the necessary adaptations so that the combination is understood. I’m guessing not all necessary header paths are set up properly - and you’ll probably have to ensure that at the end all the linking is handled properly (I think you need for instance -lole32 for CoTaskMemFree).


(Nathan 'jesterKing' Letwory) #4

Out of curiosity: what MinGW build have you installed, and from where? Original mingw.org, or mingw-w64.org?