Bessel function

I have a strange problem. I need to use the Bessel function of first kind jnf(n, x), which should be available for Windows as _jn(n, x), but the compiler claims that it is not declared in this scope. Did anybody manage to use the Bessel function for a Windows build?

Thanks, Martin

OK. After some searching I found a solution, but I am not sure whether this is the correct way. Apparently, with mingw, one can only compile with jn(n, x), when using the compiler option -std=gnu++11 rather than the -std=c++11, which is predefined by the Rack Makefile. Does anybody know whether replacing this option causes some other problems later on, or whether it is acceptable to replace it?

Excuse my possible ignorance, but haven’t these been added to C++17?

e.g. std::sph_bessel, std::sph_besself, std::sph_bessell - cppreference.com

Yes, but afaik Rack is using only C++11. (see Plugin Development Tutorial - VCV Rack Manual)

By the way, it is possible to build your VCV Rack plugin using C++17. That’s what I do with my plugin Sapphire. I believe Surge XT uses C++17 also.

Here’s how to do it. Edit your Makefile to remove the C++11 option and replace it with C++17. Find where it does the include statement for plugin.mk and make the following CXXFLAGS updates before/after it, like this:

# Upgrade to C++17
CXXFLAGS += -std=c++17

# Include the Rack plugin Makefile framework
include $(RACK_DIR)/plugin.mk

# Remove C++11
CXXFLAGS := $(filter-out -std=c++11,$(CXXFLAGS))

Sapphire using C++17 works just fine on all hardware platforms (Windows, Mac, Linux).

2 Likes

Thanks. I will experiment with that. At the moment, the gnu++11 seems to do the trick.

Yeah, I do that, too.