[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: RE: "undefined reference" error message when using mkoctfile to crea
From: |
Yan Zhang |
Subject: |
RE: RE: "undefined reference" error message when using mkoctfile to create oct file |
Date: |
Tue, 21 Feb 2017 18:15:23 -0800 |
Thanks a lot for the kind help. I tried the dlltool and pexports and
successfully got a new lib file which I renamed as "usbdllnew.lib".
Unfortunately, I still couldn't make it work. Following are the messages I got:
-----------------------------------------------------
>> mkoctfile PowerMeter.cc -L. -lusbdllnew
PowerMeter.o: In function `Z12CloseDevicesv':
C:\Users\yan\Desktop\TestCam_Project\Oct_Src\cc/PowerMeter.cc:20: undefined
reference to address@hidden'
PowerMeter.o: In function `Z11OpenDevicesi':
C:\Users\yan\Desktop\TestCam_Project\Oct_Src\cc/PowerMeter.cc:30: undefined
reference to address@hidden'
C:\Users\yan\Desktop\TestCam_Project\Oct_Src\cc/PowerMeter.cc:31: undefined
reference to address@hidden'
PowerMeter.o: In function `Z4ReadiPciPm':
C:\Users\yan\Desktop\TestCam_Project\Oct_Src\cc/PowerMeter.cc:41: undefined
reference to address@hidden'
PowerMeter.o: In function `Z5WriteiPc':
C:\Users\yan\Desktop\TestCam_Project\Oct_Src\cc/PowerMeter.cc:67: undefined
reference to address@hidden'
collect2.exe: error: ld returned 1 exit status
warning: mkoctfile exited with failure status
warning: called from
mkoctfile at line 171 column 5
-----------------------------------------------------
-----------------------------------------------------
>> mkoctfile PowerMeter.cc -L. -l usbdllnew.lib
c:/users/yan/downloads/octave-4.0.0_0/octave-4.0.0/bin/../lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/bin/ld.exe:
cannot find -l-LC
:\Users\yan\Downloads\octave-4.0.0_0\octave-4.0.0\lib\octave\4.0.0
c:/users/yan/downloads/octave-4.0.0_0/octave-4.0.0/bin/../lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/bin/ld.exe:
cannot find -loct
interp
c:/users/yan/downloads/octave-4.0.0_0/octave-4.0.0/bin/../lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/bin/ld.exe:
cannot find -loct
ave
collect2.exe: error: ld returned 1 exit status
warning: mkoctfile exited with failure status
warning: called from
mkoctfile at line 171 column 5
-----------------------------------------------------
Thanks,
Yan
-----Original Message-----
From: Tatsuro MATSUOKA [mailto:address@hidden
Sent: Tuesday, February 21, 2017 5:00 PM
To: Yan Zhang; address@hidden
Subject: Re: RE: "undefined reference" error message when using mkoctfile to
create oct file
----- 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 PowerMeter.cc -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
shiped.
Therefore pexports should be downloaded.
https://sourceforge.net/projects/mingw/files/MinGW/Extension/pexports/pexports-0.47/pexports-0.47-mingw32-bin.tar.xz/download
The binary archivied in tar.xz
pexports-0.47-mingw32-bin.tar.xz
Therefore you need un-archive software which can handle tar.xz.
I use 7-zip application which can download from
http://www.7-zip.org/
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
bash-3.1$
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.
Tatsuro
- RE: "undefined reference" error message when using mkoctfile to create oct file, address@hidden, 2017/02/17
- Re: RE: "undefined reference" error message when using mkoctfile to create oct file, address@hidden, 2017/02/19
- Re: RE: "undefined reference" error message when using mkoctfile to create oct file, address@hidden, 2017/02/21
- Re: RE: "undefined reference" error message when using mkoctfile to create oct file, address@hidden, 2017/02/21
- RE: RE: "undefined reference" error message when using mkoctfile to create oct file, Yan Zhang, 2017/02/21
- Re: RE: "undefined reference" error message when using mkoctfile to create oct file, Tatsuro MATSUOKA, 2017/02/21
- RE: RE: "undefined reference" error message when using mkoctfile to create oct file,
Yan Zhang <=
- Re: RE: "undefined reference" error message when using mkoctfile to create oct file, Tatsuro MATSUOKA, 2017/02/21
- Re: RE: "undefined reference" error message when using mkoctfile to create oct file, Tatsuro MATSUOKA, 2017/02/22
- Re: RE: "undefined reference" error message when using mkoctfile to create oct file, Tatsuro MATSUOKA, 2017/02/22
- Re: RE: "undefined reference" error message when using mkoctfile to create oct file, Tatsuro MATSUOKA, 2017/02/23
- RE: RE: "undefined reference" error message when using mkoctfile to create oct file, Yan Zhang, 2017/02/23
- Re: RE: "undefined reference" error message when using mkoctfile to create oct file, Tatsuro MATSUOKA, 2017/02/23
- RE: RE: "undefined reference" error message when using mkoctfile to create oct file, Yan Zhang, 2017/02/23
- Re: RE: "undefined reference" error message when using mkoctfile to create oct file, Tatsuro MATSUOKA, 2017/02/23
- Re: RE: "undefined reference" error message when using mkoctfile to create oct file, Tatsuro MATSUOKA, 2017/02/24