[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: RE: "undefined reference" error message when using mkoctfile to crea

From: Tatsuro MATSUOKA
Subject: Re: RE: "undefined reference" error message when using mkoctfile to create oct file
Date: Wed, 22 Feb 2017 10:00:12 +0900 (JST)

----- Original Message -----

> From: Yan Zhang 
> To: "help-octave
> Cc: 
> Date: 2017/2/22, Wed 07:21
> Subject: RE: RE: "undefined reference" error message when using mkoctfile to 
> create oct file
> I tried the "-L." flag but got the same message:
> ---------------------------------------------
>>>  mkoctfile -L. -lusbdll
> ./usbdll.lib: error adding symbols: File in wrong format
> collect2.exe: error: ld returned 1 exit status
> warning: mkoctfile exited with failure status
> warning: called from
>     mkoctfile at line 171 column 5
> ---------------------------------------------
>> I guess the "lib" file I created using Visual Studio 2015 is not 
> recognized by mkoctfile.

Sorry my confusion.

You probably made library file using MS Visual Studio related tool.
However, octave for window uses MinGW w64 GCC.

I have experienced to make library file for GCC from windows dll libraries.
I used  pexports and dlltool on MinGW.

Tool preparation

dlltool is fortunately shipped with octave distribution but pexports is not 
Therefore pexports should be downloaded.

The binary archivied in tar.xz

Therefore you need un-archive software which can handle tar.xz.
I use 7-zip application which can download from

extract pexport.exe (is located in bin folder in archived file)
copy it to the folder where target dll file is located or 
octave bin folder (typical location C:\octave\Octave-4.0.0\bin)

make library file for dll

* Start octave

* Octave prompt
>> cd <path to the folder where dll file located>
>> system bash

The you see the bash prompt

On bash prompt (please change xxx to your situation)
bash-3.1$  pexports xxx.dll > libxxx.def

bash-3.1$  dlltool -D xxx.dll -d libxxx.def -l libxxx.dll.a

Useally library file lib(name).dll.a is used for MinGW environments.


Note that the above from my experience.
It is possible that you will not get successful result.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]