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

For general questions, see the FAQ page.



MIDACO returns some IFLAG Error Message ?

See here for a detailed list of IFLAG-Messages.

Can't open MIDACO_SOLUTION.TXT file during runtime ?

Windows user may experience the problem that the text output files MIDACO_SCREEN.TXT, MIDACO_SOLUTION.TXT or MIDACO_HISTORY.TXT are blocked from access (by Windows file management) during MIDACO runtime. A simple workaround 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. Sublime, AtomNotepad++ or the Matlab Editor) to avoid this problem.

MacOS Warning: Library file ( ) can't be opened

Mac users might need to change the attributes of the MIDACO library file (e.g. in order to allow it's execution, because Apple cannot check it for malicious software. To do so, open a terminal, navigate to the location where the MIDACO library file is located and execute following command:


xattr -d


 For other programming languages (e.g. R, Julia or C#) the command works identical:


xattr -d

xattr -d midacoJL.dll

xattr -d midacocs.dll


 See here for further information.


General Error:  Segmentation fault (core dumped)


This problem can likely be fixed by increasing the default stack size of the console. On Mac / Linux this can be done by executing the following command in the console:


ulimit -s unlimited


This problem may occur, if the array size of RW or PF is too large or if the the problem dimension is very large (in esp. large-scale problems). This problem may also occur when executing MIDACO in parallel (e.g. openMP and MPI).


Another way to resolve this issue in   C/C++  programs, is to use a dynamic (malloc) memory allocation, rather than the static memory allocation for the RW, IW and PF arrays provided in the example templates. Following is an example using dynamic workspace allocation:






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 may also occurs, when compiling 'midaco.c' in MS Visual Studio with pre-compiled headers.

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:   WindowsError: [Error 193] %1 is not a valid Win32 application

This error occurs when a 64bit DLL file is used with a 32bit Python installation. In order to fix this error, use the 32bit "midacopy.dll" library file instead of the 64bit one.

Python Error:   wrong ELF class: ELFCLASS32

To fix this error, use the 32bit library version, instead of the 64bit one.

Python Error:   ValueError: Can only assign sequence of same size

This error occurs, when the problem dimension declaration of the number of objectives does not agree with the return argument dimension of array containing the objectives in the problem_function subroutine. To fix this error, ensure that the number of objectives (and constraints) is set correctly in both: the main file and the problem function subroutine. (Note that for unconstrained problems, the "g" array is a dummy argument of size one)

Octave Error:   'matlabpool' undefined

MIDACO uses the 'parfor' approach for parallelization under Matlab. This feature is unfortunately currently not (yet) 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 at the very bottom of the "midaco.f" file and changing all screen printing units from 0 to 5.

For example, change:




Fortran Error:   Unknown IFLAG values

Fortran can be nasty. If multi-objective problems are solved and the pre-allocated array size of F() is too small, you might receive unknown IFLAG values or other strange reports. To fix those issues, ensure that all pre-allocated arrays are sufficiently large.

Julia Error:   LoadError: error compiling midacoLIB: could not load library

This error may occur, when the path to the MIDACO library file (midacoJL.dll) is not working correctly or if a wrong library file (e.g. 64bit instead of 32bit) is used. To fix this error, make sure the correct library file version is used and open midaco.jl with a text editor, got to end of the file and manually enter the path where midacoJL.dll is stored.

Alternatively: To load the library file from the current directory, without specifying the full path,

enter the following shortened path:


".\\midacoJL.dll"   (Windows)

"./midacoJL.dll"    (Mac and Linux)


Java Error:   java.lang.UnsatisfiedLinkError


This error indicates that the MIDACO library file "midacoj.dll" is not working correctly. In Eclipse the complete error message might look something  like this:

Exception in thread "main" java.lang.UnsatisfiedLinkError: 'void Example.Midaco.runmidaco(int, int, int, int, int, int, int, double[], double[], double[], double[], double[], int[], int[], double[], double[], int, int[], int, double[], int, java.lang.String, int, int, int, int)'


There are two possible reasons for this error:


1) The "midacoj.dll" file was not found at the expected path. If this is the case, the above error message was preceded by the following error message:

ERROR: MIDACO DLL library file not found

To fix this error, make sure that the "midacoj.dll" file is located at the current working directory. The current working directory can be printed in Java as following (see Line 176 of

System.out.println("Working directory: " + System.getProperty("user.dir"));

Or specify a fixed path to a user specified location on your computer (see end of


2) If the "midacoj.dll" file was found at the path, but original error persists, this indicates that the naming of the Eclipse (or other IDE) project did not match the "midacoj.dll" file, which works only with the name "Example" by default. If this is the case, the original error message will display this as follows:

java.lang.UnsatisfiedLinkError: 'void SomeOtherName.Midaco.runmidaco(

where SomeOtherName is likely the name(s) of the current Eclipse project. To fix this error, please contact us and we will create a "midacoj.dll" file that works with the user specified project name.


Java Error:   Could not find or load main class Example_MO...


This error occurs if the the execution command of the example is incorrect.

The correct execution command for all examples (e.g. NLP, MINLPc or MO) is:


java Example


rather than incorrect specified commands like: 

  java Example_NLP, java Example_MINLPc  or  java Example_MO

C# Error:   BadImageFormatException AccessViolation (HRESULT: 0x8007000B)

This error may occur if a wrong project setting is used within MS-Visual Studio.

To fix this error, specify "x64" instead of "AnyCPU" in the Compiler-Run project settings.

More details available here:

R Error:   NA/NaN/Inf in foreign function call (arg 9)

This error occurs in case of unconstrained problems, where no dummy argument is returned as g[] array. To fix this error, include a dummy argument as g[] array in the problem_function, like this:

# Dummy g[1] = 0.0

output <- list(f,g) return(output)



If you experience a problem, that is not listed here, please feel free to contact us.