|  | |  |
10-15-2006, 04:10 AM
|
#1 (permalink)
| | Registered User
Join Date: Oct 2006
Posts: 9
| Linking with Visual Studio 2003 ??? Hello,
I'm trying to add the following lib: http://id3lib.sourceforge.net/
to my VS2003 project, I don't understand the instructions: Code: B)***Your project wants to link id3lib static, and has mfc linked dynamic or has no MFC:
1) Rename config.h.win32 to config.h
2) include libprj/id3lib.dsp and zlib/prj/zlib.dsp to your workspace
3) make your project dependend on id3lib, and make id3lib dependend on zlib
4) Add /D ID3LIB_LINKOPTION=1 to your project options (settings, C/C++ tab)
5) Add the following include dirs to your program:
/I <path_to_id3lib>\\include /I <path_to_id3lib>\\include\\id3
6) (add your code which uses id3lib)
7) Try to compile, and see if you need any of the following:
(debug) /nodefaultlib:"msvcprtd" or(release) /nodefaultlib:"msvcprt"
(debug) /nodefaultlib:"MSVCRTD" or(release) /nodefaultlib:"MSVCRT"
(debug) /nodefaultlib:"libcmtd" or(release) /nodefaultlib:"libcmt"
different programs may require different 'nodefaultlib' 's, or none at all, these worked for me.
If none you try work, revert to C) From what I understood, this instructions are for VC6, but they won't work with VS2003.
Please help, without this lib I can't go on with my open-source project. 
I'm sorry for the stupid question, but I'm really new to Visual Studio 2003
Thank you. |
| |
10-15-2006, 10:18 AM
|
#2 (permalink)
| | Senior Contributor
Join Date: Mar 2005
Posts: 745
| As you've read in the other topic i've compiled it with VC6 and then use it dynamicly in any compiler.
The problem for VS2003 is maybe the .dsp file?
Anyway, providing the error messages that you receive might be helpfull
I can't help with VS2003 though, because i don't have that
VC6, BCB4, BDS2006 or Code::Blocks+mingw is fine
__________________ 
UT: Ultra-kill... God like! |
| |
10-15-2006, 11:32 AM
|
#3 (permalink)
| | Registered User
Join Date: Oct 2006
Posts: 9
| Well I get the same Error...
#error read message above or win32.readme.first.txt
I'm really lost here... This tag is 50% of the project.
Maybe you can read the insturctions and make more sence of it: Code: B)***Your project wants to link id3lib static, and has mfc linked dynamic or has no MFC:
1) Rename config.h.win32 to config.h
2) include libprj/id3lib.dsp and zlib/prj/zlib.dsp to your workspace
3) make your project dependend on id3lib, and make id3lib dependend on zlib
4) Add /D ID3LIB_LINKOPTION=1 to your project options (settings, C/C++ tab)
5) Add the following include dirs to your program:
/I <path_to_id3lib>\\include /I <path_to_id3lib>\\include\\id3
6) (add your code which uses id3lib)
7) Try to compile, and see if you need any of the following:
(debug) /nodefaultlib:"msvcprtd" or(release) /nodefaultlib:"msvcprt"
(debug) /nodefaultlib:"MSVCRTD" or(release) /nodefaultlib:"MSVCRT"
(debug) /nodefaultlib:"libcmtd" or(release) /nodefaultlib:"libcmt"
different programs may require different 'nodefaultlib' 's, or none at all, these worked for me.
If none you try work, revert to C) BTW, why would the .dsp file be a problem? |
| |
10-15-2006, 11:37 AM
|
#4 (permalink)
| | Senior Contributor
Join Date: Mar 2005
Posts: 745
| Open the file which triggers the "#error read message above"
And read above that what is causing the error.
If it's globals.h then the issue is clear.
You didn't define ID3LIB_LINKOPTION
__________________ 
UT: Ultra-kill... God like! |
| |
10-15-2006, 12:47 PM
|
#5 (permalink)
| | Registered User
Join Date: Oct 2006
Posts: 9
| you're right I do miss this definition... so what do I do??
just define it? |
| |
10-15-2006, 12:57 PM
|
#6 (permalink)
| | Senior Contributor
Join Date: Mar 2005
Posts: 745
| correct define it in your project space so that the compiler receives the command.
__________________ 
UT: Ultra-kill... God like! |
| |
10-15-2006, 01:19 PM
|
#7 (permalink)
| | Registered User
Join Date: Oct 2006
Posts: 9
| Well I've include it, with the value one...
I think this solved my problem...
But now I get an error with my code: Code: #include <iostream>
#include "id3/tag.h"
using namespace std;
int main()
{
ID3_Tag myTag;
ID3_Field *myField;
ID3_Frame *myFrame;
char str[1024] = {0};
myTag.Link("test.mp3");
myFrame = myTag.Find(ID3FID_ALBUM);
myField = myFrame->GetField(ID3FN_TEXT);
myField->Get(str, 1024);
cout<<str;
return(0);
} The program crashes.
I've read the papers, and why does the code requests the dll file?
I thought it was either use the LIB or use the DLL.
I think I've missed something, can you please explain the concept behind id3lib operation?
Thank you. |
| |
10-15-2006, 01:27 PM
|
#8 (permalink)
| | Registered User
Join Date: Oct 2006
Posts: 9
| Ok the program IS stable...
I just forgot the place the mp3 file to where the exe was created...
But still, what is the idea of the Library?
Is there no way to get rid of the DLL ? |
| |
10-15-2006, 02:02 PM
|
#9 (permalink)
| | Registered User
Join Date: Oct 2006
Posts: 9
| And one last thing,
I really sorry if I'm annoying, it's just very importand for me.
I'm trying to update the lyric, why doesn't this work? The program compiles but crashes. Code: #include <iostream>
#include "id3/tag.h"
using namespace std;
int main()
{
ID3_Tag myTag;
ID3_Frame *myFrame = NULL;
ID3_Field *myField = NULL;
const char *p1 = "new text";
myTag.Link("test.mp3");
myFrame = myTag.Find(ID3FID_UNSYNCEDLYRICS);//ID3FID_UNSYNCEDLYRICS
myField = myFrame->GetField(ID3FN_TEXT);
myField->Set(p1);
myTag.Update();
return(0);
} |
| |
10-15-2006, 03:19 PM
|
#10 (permalink)
| | Senior Contributor
Join Date: Mar 2005
Posts: 745
| a .lib file (or .a) is just a binary compile list of all the available functions inside a dll that gets loaded at program execution.
Use impdef to create a definition list to see which public functions are available inside a dll (cdecl or stdcall)
implib creates a .lib for your specific compiler and must be used to make your program properly link the id3lib dll.
It would also be good to test where the program fails, so ALWAYS use if/else statements AND try...catch Code: #include <iostream>
#include "id3/tag.h"
using namespace std;
int main()
{
ID3_Tag myTag;
ID3_Frame *myFrame = NULL;
ID3_Field *myField = NULL;
const char *p1 = "new text";
MessageBox(0, "load test.mp3", 0,0);
myTag.Link("test.mp3");
MessageBox(0, "find ID3FID_UNSYNCEDLYRICS", 0,0);
myFrame = myTag.Find(ID3FID_UNSYNCEDLYRICS);//ID3FID_UNSYNCEDLYRICS
if (myFrame) {
MessageBox(0, "get field ID3FN_TEXT", 0,0);
myField = myFrame->GetField(ID3FN_TEXT);
if (myField)
{
myField->Set(p1);
myTag.Update();
}
else
{
MessageBox(0, "ID3FN_TEXT not found", 0,0);
}
}
else
{
MessageBox(0, "ID3FID_UNSYNCEDLYRICS not found", 0,0);
}
return(0);
}
__________________ 
UT: Ultra-kill... God like! |
| |
10-16-2006, 12:07 AM
|
#11 (permalink)
| | Registered User
Join Date: Oct 2006
Posts: 9
| But is there a way to avoid the DLL file, I would really like the program to be a single executable, without external baggage.
Also, how do I compile the DLL and the lib for my compiler?
Thanks again. |
| |
10-16-2006, 02:57 PM
|
#12 (permalink)
| | Senior Contributor
Join Date: Mar 2005
Posts: 745
| include all source files into your project
__________________ 
UT: Ultra-kill... God like! |
| |
10-17-2006, 02:55 AM
|
#13 (permalink)
| | Registered User
Join Date: Oct 2006
Posts: 9
| You mean ALL the files?
So far I've included the "include" dir. |
| | | Thread Tools | | | | Display Modes | Linear Mode |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | All times are GMT -8. The time now is 12:15 AM. |
Copyright © 2000-2008, Milano Interactive Web Hosting provided by Portal 360 Web Hosting |  | |