tags:

views:

371

answers:

1

I got this weird error when I was trying to compile matlab to C++ using the following command:

'mcc -W lib:cshared -d ' clibdir ' -T link:lib ' mfile

The error I got was:

fatal error C1083: Cannot open include file: 'windows.h': No such file or directory

Now, I was using lcc as my compiler ( instead of the Visual Studio one), and I made sure that Windows.h was inside the lcc\include directory (C:\Program Files\MATLAB\R2006a\sys\lcc\include), and yet, I still got the missing windows.h error even though I do have it inside the include folder.

Anyone has any idea why this is so?

Note: I have read similar questions at SO, and found that those problems are related to include folders not set etc. But I do have the include path set, I believe

+2  A: 

The error message you quote comes from Visual C++, so you're clearly not using lcc, and thus it won't make any difference what files you put in lcc's directories. Try running mbuild -setup to configure Matlab to use a different compiler command.

If you (or Matlab, on your behalf) are going to run the Visual C++ command-line compiler, then you should run it in a command prompt with all the right environment variables set up, such as the include path. Visual Studio should have put an item on your Start menu for that, or else you can run the vsvars32.bat file from within some other console window.

Rob Kennedy