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

Msvc9 build errors #2

Closed
cgohlke opened this issue Feb 29, 2012 · 3 comments
Closed

Msvc9 build errors #2

cgohlke opened this issue Feb 29, 2012 · 3 comments

Comments

@cgohlke
Copy link
Contributor

cgohlke commented Feb 29, 2012

Hi Luis,

thank you for creating this project! It will be very useful also for a number of other packages.

I get the following compile errors with Visual Studio 2008:

_imread.cpp
X:\imread-git\imread\lib/file.h(17) : error C2039: 'close' : is not a member of '`global namespace''
X:\imread-git\imread\lib/file.h(17) : error C3861: 'close': identifier not found
X:\imread-git\imread\lib/file.h(20) : error C2039: 'read' : is not a member of '`global namespace''
X:\imread-git\imread\lib/file.h(20) : error C2660: 'fd_source_sink::read' : function does not take 3 arguments
X:\imread-git\imread\lib/file.h(23) : error C2039: 'lseek' : is not a member of '`global namespace''
X:\imread-git\imread\lib/file.h(23) : error C3861: 'lseek': identifier not found
X:\imread-git\imread\lib/file.h(24) : error C2039: 'lseek' : is not a member of '`global namespace''
X:\imread-git\imread\lib/file.h(24) : error C3861: 'lseek': identifier not found
X:\imread-git\imread\lib/file.h(25) : error C2039: 'lseek' : is not a member of '`global namespace''
X:\imread-git\imread\lib/file.h(25) : error C3861: 'lseek': identifier not found
X:\imread-git\imread\lib/file.h(29) : error C2039: 'write' : is not a member of '`global namespace''
X:\imread-git\imread\lib/file.h(29) : error C2660: 'fd_source_sink::write' : function does not take 3 arguments
X:\imread-git\imread\lib/numpy.h(71) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
error: Command "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG  -IX:\Python27\lib\site-packages\numpy\core\include -IX:\Python27\include -IX:\Python27\PC /Tpimread/_imread.cpp /Fobuild\
temp.win32-2.7\Release\imread/_imread.obj /Zm1000" failed with exit status 2
@luispedro
Copy link
Owner

Thank you for your report!

Can you try this branch:

https://github.com/luispedro/imread/tree/msvc-compile

Let me know if it works.

@cgohlke
Copy link
Contributor Author

cgohlke commented Feb 29, 2012

Thank you. It works with this change to include the O_RDONLY etc identifiers:

--- a/imread/lib/base.h
+++ b/imread/lib/base.h
@@ -9,6 +9,7 @@

 #if defined(_MSC_VER)
  #include <io.h>
+ #include <fcntl.h> 
 #else
  #include <unistd.h>
 #endif

There are a number of warnings that close, lseek, read, and write are deprecated POSIX names that should be replaced with C++ conform _close, _lseek, _read, and _write.

On my system the link libraries are named libpng15_static, jpeg, libtiff, libwebp_a. Maybe this could go into a site.cfg file?

@luispedro
Copy link
Owner

Thanks. I merged into master. I am going to delete that branch as I used a bit of history rewriting (master was always clean, though).

site.cfg file sounds good. I'll look up how to do it exactly.
Alternative is to have a platform check in the setup.py.

Which one do you think is better?

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