mexcpp icon indicating copy to clipboard operation
mexcpp copied to clipboard

Have you ever gotten this to work on Windows with MSVC?

Open pst2154 opened this issue 9 years ago • 4 comments

MSVC seems to not like many of the statements. I'm no c++ expert (which is why i was trying to use this header file obviously). Wonder if you know how to fix?

c:\users\user\documents\github\mexcpp\mexcpp.h(52) : error C2079: 'mexcpp::SigintHandler::sa' uses undefined struct 'mexcpp::sigaction' c:\users\user\documents\github\mexcpp\mexcpp.h(52) : error C2079: 'mexcpp::SigintHandler::osa' uses undefined struct 'mexcpp::sigaction' c:\users\user\documents\github\mexcpp\mexcpp.h(63) : error C2228: left of '.sa_handler' must have class/struct/union type is 'int' c:\users\user\documents\github\mexcpp\mexcpp.h(64) : error C2514: 'mexcpp::sigaction' : class has no constructors c:\users\user\documents\github\mexcpp\mexcpp.h(52) : see declaration of 'mexcpp::sigaction' c:\users\user\documents\github\mexcpp\mexcpp.h(68) : error C2514: 'mexcpp::sigaction' : class has no constructors c:\users\user\documents\github\mexcpp\mexcpp.h(52) : see declaration of 'mexcpp::sigaction' c:\users\user\documents\github\mexcpp\mexcpp.h(363) : error C2057: expected constant expression c:\users\user\documents\github\mexcpp\mexcpp.h(363) : error C2466: cannot allocate an array of constant size 0 c:\users\user\documents\github\mexcpp\mexcpp.h(363) : error C2133: 'fns' : unknown size

pst2154 avatar Sep 10 '15 14:09 pst2154

Hi,

I have not tried compiling this with MSVC. I do use C++11 features and signal handling to catch Ctrl-C which only works on Unix.

If you are still interested in getting this to work, you could

  • Make sure your compiler is configured to compile C++11 correctly;
  • Comment out the code regarding signal handling for Ctrl-C

Best of luck! Let me know what works so we can post it here so others can refer to it later.

  • Kui

On Sep 10, 2015, at 10:56, pst2154 [email protected] wrote:

MSVC seems to not like many of the statements. I'm no c++ expert (which is why i was trying to use this header file obviously). Wonder if you know how to fix?

c:\users\user\documents\github\mexcpp\mexcpp.h(52) : error C2079: 'mexcpp::SigintHandler::sa' uses undefined struct 'mexcpp::sigaction' c:\users\user\documents\github\mexcpp\mexcpp.h(52) : error C2079: 'mexcpp::SigintHandler::osa' uses undefined struct 'mexcpp::sigaction' c:\users\user\documents\github\mexcpp\mexcpp.h(63) : error C2228: left of '.sa_handler' must have class/struct/union type is 'int' c:\users\user\documents\github\mexcpp\mexcpp.h(64) : error C2514: 'mexcpp::sigaction' : class has no constructors c:\users\user\documents\github\mexcpp\mexcpp.h(52) : see declaration of 'mexcpp::sigaction' c:\users\user\documents\github\mexcpp\mexcpp.h(68) : error C2514: 'mexcpp::sigaction' : class has no constructors c:\users\user\documents\github\mexcpp\mexcpp.h(52) : see declaration of 'mexcpp::sigaction' c:\users\user\documents\github\mexcpp\mexcpp.h(363) : error C2057: expected constant expression c:\users\user\documents\github\mexcpp\mexcpp.h(363) : error C2466: cannot allocate an array of constant size 0 c:\users\user\documents\github\mexcpp\mexcpp.h(363) : error C2133: 'fns' : unknown size

— Reply to this email directly or view it on GitHub.

kuitang avatar Oct 30 '15 21:10 kuitang

@kuitang Hello, I met same question. And I use 'Microsoft Visual C++ 2013 Professional' compiler, but it does not work. Error lists are as follows:

Building with 'Microsoft Visual C++ 2013 Professional'.
Error using mex
fv_cache.cc
E:\Projects\160325pedestrain_detection\code\voc-release5\fv_cache\fv_cache.cc(47) : error C2079: 'context::act' uses undefined
struct 'sigaction'
E:\Projects\160325pedestrain_detection\code\voc-release5\fv_cache\fv_cache.cc(47) : error C2079: 'context::matlab_act' uses
undefined struct 'sigaction'
E:\Projects\160325pedestrain_detection\code\voc-release5\fv_cache\fv_cache.cc(69) : error C2514: 'sigaction' : class has no
constructors
        E:\Projects\160325pedestrain_detection\code\voc-release5\fv_cache\fv_cache.cc(47) : see declaration of 'sigaction'
E:\Projects\160325pedestrain_detection\code\voc-release5\fv_cache\fv_cache.cc(253) : warning C4800: 'double' : forcing value
to bool 'true' or 'false' (performance warning)
E:\Projects\160325pedestrain_detection\code\voc-release5\fv_cache\fv_cache.cc(254) : warning C4800: 'double' : forcing value
to bool 'true' or 'false' (performance warning)
E:\Projects\160325pedestrain_detection\code\voc-release5\fv_cache\fv_cache.cc(264) : warning C4244: 'argument' : conversion
from '__int64' to 'double', possible loss of data
E:\Projects\160325pedestrain_detection\code\voc-release5\fv_cache\fv_cache.cc(309) : warning C4244: 'initializing' :
conversion from '__int64' to 'int', possible loss of data
E:\Projects\160325pedestrain_detection\code\voc-release5\fv_cache\fv_cache.cc(456) : warning C4244: '=' : conversion from
'size_t' to 'double', possible loss of data
E:\Projects\160325pedestrain_detection\code\voc-release5\fv_cache\fv_cache.cc(612) : warning C4244: 'argument' : conversion
from '__int64' to 'double', possible loss of data
E:\Projects\160325pedestrain_detection\code\voc-release5\fv_cache\fv_cache.cc(678) : warning C4267: 'initializing' :
conversion from 'size_t' to 'int', possible loss of data
E:\Projects\160325pedestrain_detection\code\voc-release5\fv_cache\fv_cache.cc(783) : error C2228: left of '.sa_mask' must have
class/struct/union
        type is 'int'
E:\Projects\160325pedestrain_detection\code\voc-release5\fv_cache\fv_cache.cc(783) : error C3861: 'sigemptyset': identifier
not found
E:\Projects\160325pedestrain_detection\code\voc-release5\fv_cache\fv_cache.cc(784) : error C2228: left of '.sa_handler' must
have class/struct/union
        type is 'int'
E:\Projects\160325pedestrain_detection\code\voc-release5\fv_cache\fv_cache.cc(785) : error C2228: left of '.sa_flags' must
have class/struct/union
        type is 'int'
E:\Projects\160325pedestrain_detection\code\voc-release5\fv_cache\fv_cache.cc(786) : error C2514: 'sigaction' : class has no
constructors
        E:\Projects\160325pedestrain_detection\code\voc-release5\fv_cache\fv_cache.cc(47) : see declaration of 'sigaction'
E:\Projects\160325pedestrain_detection\code\voc-release5\fv_cache\fv_cache.cc(799) : error C2514: 'sigaction' : class has no
constructors
        E:\Projects\160325pedestrain_detection\code\voc-release5\fv_cache\fv_cache.cc(47) : see declaration of 'sigaction'

VS2013 support C++11, but why does not it work?

Ocxs avatar May 02 '16 14:05 Ocxs

Hi Xuson,

The errors you below are related to the SigintHandler class. It is code to catch sigint (Ctrl-C) on Unix machines. This enables interrupting the middle of a computation. This code requires compiling on a Unix machine.

However, this class is optional to use, and provided only as a convenience.

To compile on a Windows machine, you can simply comment out this class definition as well as the #include <signal.h> line.

  • Kui

On May 2, 2016, at 10:37, Xusong Chen [email protected] wrote:

@kuitang https://github.com/kuitang Hello, I met same question. And I use 'Microsoft Visual C++ 2013 Professional' compiler, but it does not work. Error lists are as follows:

Building with 'Microsoft Visual C++ 2013 Professional'. Error using mex fv_cache.cc E:\Projects\160325pedestrain_detection\code\voc-release5\fv_cache\fv_cache.cc(47) : error C2079: 'context::act' uses undefined struct 'sigaction' E:\Projects\160325pedestrain_detection\code\voc-release5\fv_cache\fv_cache.cc(47) : error C2079: 'context::matlab_act' uses undefined struct 'sigaction' E:\Projects\160325pedestrain_detection\code\voc-release5\fv_cache\fv_cache.cc(69) : error C2514: 'sigaction' : class has no constructors E:\Projects\160325pedestrain_detection\code\voc-release5\fv_cache\fv_cache.cc(47) : see declaration of 'sigaction' E:\Projects\160325pedestrain_detection\code\voc-release5\fv_cache\fv_cache.cc(253) : warning C4800: 'double' : forcing value to bool 'true' or 'false' (performance warning) E:\Projects\160325pedestrain_detection\code\voc-release5\fv_cache\fv_cache.cc(254) : warning C4800: 'double' : forcing value to bool 'true' or 'false' (performance warning) E:\Projects\160325pedestrain_detection\code\voc-release5\fv_cache\fv_cache.cc(264) : warning C4244: 'argument' : conversion from '__int64' to 'double', possible loss of data E:\Projects\160325pedestrain_detection\code\voc-release5\fv_cache\fv_cache.cc(309) : warning C4244: 'initializing' : conversion from '__int64' to 'int', possible loss of data E:\Projects\160325pedestrain_detection\code\voc-release5\fv_cache\fv_cache.cc(456) : warning C4244: '=' : conversion from 'size_t' to 'double', possible loss of data E:\Projects\160325pedestrain_detection\code\voc-release5\fv_cache\fv_cache.cc(612) : warning C4244: 'argument' : conversion from '__int64' to 'double', possible loss of data E:\Projects\160325pedestrain_detection\code\voc-release5\fv_cache\fv_cache.cc(678) : warning C4267: 'initializing' : conversion from 'size_t' to 'int', possible loss of data E:\Projects\160325pedestrain_detection\code\voc-release5\fv_cache\fv_cache.cc(783) : error C2228: left of '.sa_mask' must have class/struct/union type is 'int' E:\Projects\160325pedestrain_detection\code\voc-release5\fv_cache\fv_cache.cc(783) : error C3861: 'sigemptyset': identifier not found E:\Projects\160325pedestrain_detection\code\voc-release5\fv_cache\fv_cache.cc(784) : error C2228: left of '.sa_handler' must have class/struct/union type is 'int' E:\Projects\160325pedestrain_detection\code\voc-release5\fv_cache\fv_cache.cc(785) : error C2228: left of '.sa_flags' must have class/struct/union type is 'int' E:\Projects\160325pedestrain_detection\code\voc-release5\fv_cache\fv_cache.cc(786) : error C2514: 'sigaction' : class has no constructors E:\Projects\160325pedestrain_detection\code\voc-release5\fv_cache\fv_cache.cc(47) : see declaration of 'sigaction' E:\Projects\160325pedestrain_detection\code\voc-release5\fv_cache\fv_cache.cc(799) : error C2514: 'sigaction' : class has no constructors E:\Projects\160325pedestrain_detection\code\voc-release5\fv_cache\fv_cache.cc(47) : see declaration of 'sigaction' VS2013 support C++11, but why does not it work?

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/kuitang/mexcpp/issues/3#issuecomment-216252760

kuitang avatar May 04 '16 00:05 kuitang

@kuitang Thanks ! :+1:

Ocxs avatar May 06 '16 15:05 Ocxs