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 on windows with vS2022 #109

Open
craouette opened this issue May 4, 2024 · 1 comment
Open

compiling on windows with vS2022 #109

craouette opened this issue May 4, 2024 · 1 comment

Comments

@craouette
Copy link

Hi,

In order to compile on windows with Visual studio 2022, I needed to:

  • comment line 81 of src/SeExpr2/Platform.h:

from
inline double log2(double x) { return log(x) * 1.4426950408889634; }
to
//inline double log2(double x) { return log(x) * 1.4426950408889634; }

  • change line 155 of src/demos/imageSynth/imageSynth.cpp:

from
const unsigned char* ptrs[height];
to
unsigned char** ptrs = new unsigned char*[height];

  • change line 302 of src/demos/imageSynth/imageSynthForPaint3d.cpp

from
const unsigned char* ptrs[height];
to
unsigned char** ptrs = new unsigned char*[height];

These changes should not impact other platform.

Pierre

@davvid
Copy link
Member

davvid commented Jun 1, 2024

Are there parts of this something you might be able to contribute behind some #if defined(WIN32) macro guards?

Why do you have to comment-out log2, btw? Is that name a windows-only thing or is it hitting some other compile error?

For the unsigned char** ptrs = new unsigned char*[height]; change -- that's a memory leak. I'd recommend storing it in a std::unique_ptr<unsigned char> instead so that it avoids the leak.

It is true that the current use of const unsigned char* ptrs[height]; is a GCC extension ("variable-length arrays"), so replacing that would be worth it IMO.

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

2 participants