This page provides information on problems that might occur when trying to run / compile MIDACO.

For general questions, please see the FAQ page.



MIDACO returns some IFLAG Error Message ?

See here for a detailed list of IFLAG-Messages.

Using MIDACO without the templates ?

In general, it is recommended to use MIDACO in combination with the provided templates (e.g. example_MINLPc.m) and to adopt the template step by step to a user specific application. If MIDACO should be used without the here provided templates, it is recommended that MIDACO is called within a reverse communication loop similar to this (C/C++ pseudo code):


call MIDACO_PRINT( 1,...)

while( ISTOP == 0)


   evaluate PROBLEM_FUNCTION( F, G, X)



   call MIDACO( P, N, NI,...)

   call MIDACO_PRINT( 2,...)


evaluate PROBLEM_FUNCTION( F, G, X)     <--- This line is important

call MIDACO_PRINT( 3,...)


Using MIDACO without the here provided templates might cause problems with:

1) Printing wrong or inconsistent information (e.g. infeasible solutions)

2) Not working stopping criteria

3) Numerical crashes and runtime errors

Strange errors and inconsistent data reported ?

When using MIDACO without the here provided templates (e.g. example_MINLPc.cpp) various numerical problems might occur, in esp. inconsistent reporting of MIDACO on the feasibility of the final solution. To avoid such problems, it is recommended to use the templates and adopt them step by step to a user specific problem. In case, MIDACO should be used without the here provided templates, user should carefully check, if all relevant code elements from the templates are implemented into their own program, from which MIDACO is called.

Can't open MIDACO_SOLUTION.TXT file during runtime ?

Windows user may experience the problem that the text output files "MIDACO_SCREEN.TXT" and "MIDACO_SOLUTION.TXT" are blocked from access (by Windows file management) during MIDACO runtime. A simple workaround to still be able to open those files (and check the current solution in detail) is to create a copy of those files and open the copy instead.

Problem with displaying 'MIDACO_SCREEN.TXT' and 'MIDACO_SOLUTION.TXT'

In some cases (e.g. Matlab-Windows), the files 'MIDACO_SCREEN.TXT' and 'MIDACO_SOLUTION.TXT' are not displayed correctly with a simple editor (e.g. Notepad). Open the txt-files with another editor (e.g. Notepad++ or the Matlab Editor) to avoid this problem. 

Problem with displaying full PlotTool menu

In some cases (e.g. Windows 7) the PlotTool menu is not fully displayed (not showing the bottom entries). In such case an enlarged version of the PlotTool can be downloaded here:

PlotTool_XL.exe  [50 MB]

The PlotTool_XL version has a larger screen window and should fully display all options.

Matlab Error:   No C/C++ compiler found for MEX 

In some cases (in esp. Windows 64bit), Matlab does not provide a default C/C++ MEX compiler. In such case, the compiler must be installed manually by the user. One possible solution is to use the following free C/C++ compiler (64bit) distributed by Microsoft:

Microsoft Visual C++ 2010 Redistributable Package (x64)

Download and install above package. Then reboot your computer and start a fresh Matlab session. The type "mex -setup" in the command window. If above installation of the C/C++ compiler was successful, Matlab will automatically recognize the compiler and give the user some compiler option menu to choose from. Note that any supported mex compiler that is supported by Matlab can be used with MIDACO. Further reading: Matlab Search: mex compiler

Matlab Error:   ??? Undefined function or method 'midaco'...

To avoid this error, download "midaco.m" and include it in the Matlab path.

Matlab Error:   ??? Undefined function or method 'midacox'...

This error means, that Matlab did not found the MIDACO mex file. To avoid this error, download the C/C++ source code file "midacox.c" and generate the mex file from it (include the file in the Matlab path and type "mex midacox.c" and press Enter). Then make sure, that the generated mex file (e.g. "midacox.dll", "midacox.mexw32" or "midacox.mexglx") is included in the Matlab path.

C/C++ Error:   undefined reference to 'sqrt' 

This error (along with 'undefined reference to 'pow' and 'undefined reference to 'floor') occurs when compiling with gcc and the math library was not linked to the objectives. To solve this problem, add the flag "-lm" at the very end of the linkage command. For example: gcc -o example.o midaco.o -lm 

C/C++ Error:   'x' was not declared in this scope 

This error (along with 'expected ',' or ';' before 'doublereal' and 'expected unqualified-id before '{' token') occurs when trying to compile 'midaco.c' with g++. The 'midaco.c' file does not compile with g++. However, all MIDACO example files can be compiled with g++ (see this Makefile). Compiling 'midaco.c' with gcc (or another c-compiler) fixes this issue. 

Note that this error also occurs, when compiling 'midaco.c' in MS Visual Studio with pre-compiled headers.


C/C++ Error:   Segmentation fault (core dumped)

When executing MIDACO parallel templates (e.g. openMP and MPI) the stack size might be increased on some systems. This can be done be executing the command line:

ulimit -s unlimited

before executing the actual run command for the MIDACO templates.


C/C++ Error:   LNK2019 (MS Visual Studio)

In case the following error appears when building a MS Visual Studio solution:

LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup


it can be easily fixed by changing VS: Properties -> Linker -> System -> SubSystem from Windows to Console


(/SUBSYSTEM:WINDOWS)   >>>---change---to--->>>    (/SUBSYSTEM:CONSOLE)


C/C++ Error:   fopen (MS Visual Studio)

Some MS Visual Studio versions treat the  fopen  command as error and expect  fopen_s instead. A small modification in the  midaco.c   source code is then required to compile MIDACO in MS Visual Studio. In the   midaco.c   file,   change the   fopen   command to   fopen_s  by commenting out line 5002 and enabling line 5003 instead. The result should look like following:



Makefile Error:   *** No targets specified and no makefile found 

When downloading the 'Makefile', most web-browsers automatically add the extension ".txt" to the Makefile. Renaming "Makefile.txt" to "Makefile" on your system should solve this problem.

Python Error:   OSError: Permission denied

When running Python under Cygwin, the pre-compiled MIDACO library "" might produce this error. Manually creating the MIDACO library from its source "midacopy.c" fixes this issue. How to create the library can be found on the Python download site.


Python Error:   WindowsError: [Error 126]

 This error occurs, if the MIDACO DLL "midacopy.dll" was created with MS Visual Studio, but the current computer has no MS Visual Studio installed.
 To resolve this error, either install MS Visual Studio or create the "midacopy.dll" with MinGW.


Python Error:   TypeError: bytes or integer address expected instead of str instance

 This error occurs, if Python 3.x is used instead of Python 2.x. To resolve this issue, change the declaration of the license key:


as follows (insert a "b" in front of the string):


For more info on this issue, visit stackoverflow.

Octave Error:   @problem_function: no function and no method found

 When running MIDACO in Octave, the "problem_function" must be stored as separate file "problem_function.m". Alternatively, remove the "clear all" command in the example file.


Octave Error:   'matlabpool' undefined

MIDACO uses the 'parfor' approach for parallelization under Matlab. This feature is unfortunatly currently not available in Octave.



Fortran Error:   Compiling with Silverfrost FTN95 

When compiling MIDACO with Silverfrost FTN95 some minor modifications regarding the printing must be done  to the "midaco.f" file. This is commenting or deleting the "FLUSH( IOUT )" command in line 2449 and changing all screen printing units from 0 to 5.

For example in line 1985, change:





If you experience any problem, that is not listed here, please contact us.