Skip to content
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

Compiling error : initializer is not a constant #77

Open
shawneeshaw opened this issue Apr 15, 2021 · 7 comments
Open

Compiling error : initializer is not a constant #77

shawneeshaw opened this issue Apr 15, 2021 · 7 comments

Comments

@shawneeshaw
Copy link

I used visual studio 2015 to compile tinyexpr, but I got two compile errors(initializer is not a constant) when meet
{"ceil", ceil, TE_FUNCTION1 | TE_FLAG_PURE, 0} and {"floor", floor, TE_FUNCTION1 | TE_FLAG_PURE, 0} line.
It only happens under release, but there is nothing happed under debug mode.

@codeplea
Copy link
Owner

Does it work if you just remove those two lines? i.e. compile without the ceil and floor functions?

@shawneeshaw
Copy link
Author

yes, it works if I removed this two lines.

@codeplea
Copy link
Owner

Is it possible that you're compiling this as C++ instead of C? I think that may be the issue here.

@shawneeshaw
Copy link
Author

Oh, yes, I used it in my C++ project. But I didn't change the file extension from .c to .cpp, the compiler(vs 2015) supposes to compile it as C, right?

@codeplea
Copy link
Owner

I'm not sure about that. It probably depends on the project settings. You could add some C++ code to the file to check if it is indeed compiling as C++ or not.

@equilibr
Copy link

Look at this commit: 085d678
It seems to have a fix for your problem in tinyepr.c:173

@bavay
Copy link
Contributor

bavay commented Oct 4, 2021

This has been fixed in commit 96b85c1 (closing issue #34 that was exactly the same as this one).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants