Gamma icon indicating copy to clipboard operation
Gamma copied to clipboard

C++11 compatibility

Open mbrucher opened this issue 8 years ago • 6 comments

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 :/

mbrucher avatar Apr 22 '16 16:04 mbrucher

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?

LancePutnam avatar Apr 22 '16 23:04 LancePutnam

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.

mavavilj avatar Apr 24 '16 19:04 mavavilj

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

mbrucher avatar Apr 24 '16 19:04 mbrucher

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.

LancePutnam avatar Apr 25 '16 16:04 LancePutnam

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

mbrucher avatar Apr 25 '16 16:04 mbrucher

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).

LancePutnam avatar May 01 '16 11:05 LancePutnam