Dev C++ Linker Error!

(C++)
I am trying to use a library called LIBWMP3. I tryed to link using Dev-C++ but I get a linking error. Here is the code and the error.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <cstdlib>
#include <iostream>
#include "libwmp3.h"

using namespace std;

int main()
{
    
/* create class instance */
CWMp3* mp3 = CreateCWMp3();

/* open file from disk */
mp3->OpenFile("Believe.mp3",800, 0, 0);

mp3->Play();

/* ... wait here in some loop */

MP3_STATUS status;
mp3->GetStatus(&status);
while(status.fPlay)
{
    Sleep(200);
    mp3->GetStatus(&status);
}



/* destroy class instance */
mp3->Release();
}


Error:
-----------------
File format not recognized
ld returned 1 exit status
C:\C++\Library testing\Makefile.win [Build Error] [Project2.exe] Error 1
-----------------

Compile Log:
-----------------
Compiler: Default compiler
Building Makefile: "C:\C++\Library testing\Makefile.win"
Executing make...
make.exe -f "C:\C++\Library testing\Makefile.win" all
g++.exe main.o -o "Project2.exe" -L"C:/Dev-Cpp/lib" -lwinmm ../libwmp3-2.51-win/libwmp3.lib

../libwmp3-2.51-win/libwmp3.lib: file not recognized: File format not recognized
collect2: ld returned 1 exit status

make.exe: *** [Project2.exe] Error 1

Execution terminated
------------------



I have the libmp3.lib in my project options, parameters tab and the proper include. Any help would be useful I cannot find any support for this error on Dev-C++ whatsoever. Here is a link to the main website of the library.

http://www.inet.hr/~zcindori/libwmp3/index.html

I am using Dev-C++, vista 32-bit.
Also here is a list of the files from the library.

dsp_superequ.txt
GPL.txt
LGPL.txt
libmad_copyright.txt
libmad_readme.txt
LIBWMP3.txt
libwmp3.d
libwmp3.dll
libwmp3.h
libwmp3.lib
LIBWMP3 (Delphi source file)
LIBWMP3 (VB File)
mp3.d
Readme.txt


Thankyou.
PS. There is 0 support on this topic that I could find on the Dev-C++ website.
If any more info is needed please let me know.
Last edited on
I've got a bad feeling about this.
With a library name like libwmp3.lib
this library was not made to be compiled with g++ (or mingw) compiler.

but I,ve been and looked at the source code download, and the package contains a file called
libwp3.def. You should be able to use this file to create a g++ compatible library called libwmp3.a from libwmp3.lib.
Last edited on
Thank you very much for the fast reply guestgulkan.
Would you know how I could create a '.a' file from a '.def'? Would it be just as simple as opening the .def and re saving as .a? I have no clue what I would search on Google to find information on this.
PS. If you think this is not a proper library I could use a suggestion on a good library used for playing and manipulating mp3 files. Ex, play in reverse and change speed.
Thanks
It is a proper library all right.
This is putting the problem very simply as follows:
It's just that there are basically two types of object library files -
microsoft compiler style (normally indicated by a .lib extension) and linux/unix style (indicated
by .a extenion).

Different compilers are usually designed to use one style or the other.

What compiler are you using? mingw??

if so mingw compiler comes with a utility (called dlltool.exe) which can use the information given in the . def and create a library called libwmp3.a from the libwmp3.lib.
and everything should will be ok.

I am using Bloodshed Dev-C++ which does use Mingw. I have the tool called dlltool.exe but I dont know how to use it. Do I need to run through the command line?
Here is the some info I found on this tool.

http://oldwiki.mingw.org/index.php/dlltool

Thanks
PS. I have used other libraries which use '.lib' files and they worked fine.
Last edited on
I have used lib files which also worked with mingw based compilers.
I assume you got the library from this site:
http://www.inet.hr/~zcindori/libwmp3/index.html

the easiest way is if you tell me what version/file you downlaoded, and I will see if I can get it working.
Yes that is the site, here is the version I downloaded: libwmp3-2.51-win (289 KB)
Thanks so much for your effort!
Topic archived. No new replies allowed.