-
Notifications
You must be signed in to change notification settings - Fork 241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"initializer is not a constant" error in Visual Studio. #34
Comments
I don't have VS installed right now, so this is only a wild guess, but what would happen if you replace |
It would be pretty sad if windows C compiler cannot solve that into a constant expression... It could also be that we are not feeding a size to that array. If all else fails, we might have to have |
@codeplea Hi, I actually modified the original code a bit. |
@codeplea I tried changing "ceil" and "floor" to "ceill" and "floorl" and the error no longer occurred. |
I could totally fix this error by creating separate static functions like how For example for And then call it when initializing the I did this to all the elements of |
@cuinjune What version of Visual Studio are you using? Here is a discussion where someone else is having the same problem almost 10 years ago. There are a few workaround ideas there too. |
@codeplea Hey I just tried your link and I could fix the issue by simply adding the below two lines anywhere above
Now it works without the problem and it is a lot simpler than my above solution. You can close this issue if you want. |
As I got hit with the same issue when compiling tinyexpr on Windows with QtCreator (that itself was calling Visual C++ 2017 in the background) and realized that there was a solution in the issue's thread but no fix in the source code, I've implemented it (wrapped with ifdef to prevent warnings on other platforms).
Hi, I tried to build tinyexpr using Visual Studio on Windows 10 but an error occurs saying "initializer is not a constant".
If I remove all elements in functions[] array, the error no longer occurred.
Could someone please teach me how to fix this error?
Thank you so much in advance!
The text was updated successfully, but these errors were encountered: