Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8608919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:44:26+00:00 2026-06-12T03:44:26+00:00

I am trying to compile a basic c++ .mex and .oct file using the

  • 0

I am trying to compile a basic c++ .mex and .oct file using the octave environment. The .mex file is just mexcpp.cpp file from matlab which you can get in MATLAB using

edit([matlabroot '/extern/examples/mex/mexcpp.cpp']);

The .oct file is the simple c++ example on found [here].(http://www.gnu.org/software/octave/doc/interpreter/Getting-Started-with-Oct_002dFiles.html)

I struggled for a bit with getting the visual studio compiler to setup all of the environment variables as documented on the octave wiki using vcvarsall.bat. Before the compiler environment variables were set up I could issue the mkoctfile -v --mex mexcpp.cpp command without any errors but no files were created.

Instead I had to specify the environment (I used x86) like so:

"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86

Now the real problem I have been having is getting my .mex and .oct files to compile. When I try to compile the file I get:

cc-msvc -d -c -D_WIN32 -DWIN32 -D__WIN32__  -IC:\Octave-3.6.2\include\octave-3.6.2\octave\.. -IC:\Octave-3.6.2\include\octave-3.6.2\octave -IC:\Octave-3.6.2\include -Ic:/Software/VC10Libs/include -Ic:/Software/VC10Libs/include/freetype2 -Ic:/Software/VC10Libs/include -Ic:/Software/VC10Libs/include   -O2 -MD -EHsc -wd4244 -fp:strict -fp:except-   -I.  mexcpp.cpp -o mexcpp.o
cl -nologo -c -D_WIN32 -DWIN32 -D__WIN32__ -IC:\Octave-3.6.2\include\octave-3.6.2\octave\.. -IC:\Octave-3.6.2\include\octave-3.6.2\octave -IC:\Octave-3.6.2\include -Ic:/Software/VC10Libs/include -Ic:/Software/VC10Libs/include/freetype2 -Ic:/Software/VC10Libs/include -Ic:/Software/VC10Libs/include -O2 -MD -EHsc -wd4244-fp:strict -fp:except- -I. mexcpp.cpp -Fomexcpp.o mexcpp.cpp
C:\Octave-3.6.2\include\math.h(74) : fatal error C1083: Cannot open include file: 'c:/Program Files/Microsoft Visual Studio 10.0/VC/include/math.h': No such file or directory cc-msvc -d -shared  -o mexcpp.mex  mexcpp.o   -Wl,-export:mexFunction -LC:\Octave-3.6.2\lib\octave\3.6.2 -LC:\Octave-3.6.2\lib -loctinterp -loctave -lcruft link -nologo -DLL -out:mexcpp.mex mexcpp.o -LIBPATH:C:\Octave-3.6.2\lib\octave\3.6.2 -LIBPATH:C:\Octave-3.6.2\lib octinterp.lib octave.lib cruft.lib -export:mex Function dirent.lib msvcmath.lib
LINK : fatal error LNK1181: cannot open input file 'mexcpp.o'

My Visual C++ directory is located in c:/Program Files (x86)/Microsoft Visual Studio 10.0/VC so I am not sure why it is looking in c:/Program Files/Microsoft Visual Studio 10.0/VC?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T03:44:27+00:00Added an answer on June 12, 2026 at 3:44 am

    I found that that the problem was in Octaves ‘math.h’ file. on line 74 the path to the include file is hardcoded to c:/Program Files/Microsoft Visual Studio 10.0/VC/include/math.h.
    I solved the issue by just changing to c:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/include/math.h. I tried compiling both the .mex and the .oct files and they now work!

    Edit:

    On another note I noticed that octave is also including hardcoded paths for some visual studio paths that don’t exist.

    -Ic:/Software/VC10Libs/include -Ic:/Software/VC10Libs/include/freetype2 -Ic:/Software/VC10Libs/include -Ic:/Software/VC10Libs/include
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to dynamically compile source code using the CodeDom.Compiler stuff, which means I
I'm trying to compile some code for basic USB HID functionality. I'm using a
I'm trying to compile this .ccp file. I got it from https://github.com/loarabia/Clang-tutorial . //
I am trying to compile my Visual Basic .NET project named Myproject.sln via command
When trying to compile this code: #include <iostream> #include <vector> using namespace std; class
While trying to compile a 64 bit linux kernel using gcc, I see the
I am trying to compile the multiple_sources.cpp to compile on my computer. I am
I am trying to do some basic file parsing within a directory in Python
I'm trying to compile the basic tutorial program at http://doc.trolltech.com/4.4/mainwindows-application.html and running into a
I have the following code which i m trying to compile: #include <boost/filesystem/convenience.hpp> #include

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.