LancePutnam / Gamma

Generic (Sound) Synthesis Library
Other
458 stars 54 forks source link

C++11 compatibility #42

Open mbrucher opened 8 years ago

mbrucher commented 8 years ago

There seems to be some issues in Gamma includes (scl.h) if cstdint is added afterwards. Lots of header inclusions seem also to be C related (math.h, sodlib.h...), and not C++. This means that the library cannot be mixed with proper C++ libraries that abide by the C++03/C++11 standard :/

LancePutnam commented 8 years ago

I'm well aware of the problems with math.h. I started a new c++11 branch to resolve those issues. Maybe you could give it a try and see if it works for you?

mavavilj commented 8 years ago

I'd try the C++11 branch, but I don't know how to build it on Windows and VS2013. Is using Mac/Linux the only option?

I also tried the builds here: https://github.com/AlloSphere-Research-Group/Gamma/

but using the devel branch CMake gives the error:

CMake Error at CMakeLists.txt:13 (message): The compiler C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/cl.exe has no C++11 support. Please use a different C++ compiler.

mbrucher commented 8 years ago

Visual Studio 2013 definitely has some C++11 support, and as the error is on the intxx_t types, it should work as well.

LancePutnam commented 8 years ago

Gamma works with Windows. I used to have a VS project, but I removed it due to lack of interest in maintaining it. The library is meant to be included from source in projects, so it should more or less straightforward to create your own VS project.

mbrucher commented 8 years ago

Obviously, it doesn't. Mixing Gamma with another C++ library that defines through the official standard way int32_t fails as #41 shows.

LancePutnam commented 8 years ago

I stated that poorly. You are right about the master branch, but there has been success compiling with MSVC with the c++11 branch as #37 shows. Replacing some of the C ".h" includes with their "c" C++ counterparts helped. There still might be an issue with including cstdint after/before pstdint.h, but I will need someone to test that. If there still is a problem, then the only solution I can think of is to remove pstdint.h in favor of cstdint (support for cstdint under MSVC was flakey in the past, hence pstdint.h).