Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 10-15-2006, 03:10 AM   #1 (permalink)
thedp
Registered User
 
Join Date: Oct 2006
Posts: 9
thedp is on a distinguished road
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.
thedp is offline   Reply With Quote
Old 10-15-2006, 09:18 AM   #2 (permalink)
DJMaze
Senior Contributor
 
DJMaze's Avatar
 
Join Date: Mar 2005
Posts: 676
DJMaze is on a distinguished road
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!
DJMaze is offline   Reply With Quote
Old 10-15-2006, 10:32 AM   #3 (permalink)
thedp
Registered User
 
Join Date: Oct 2006
Posts: 9
thedp is on a distinguished road
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?
thedp is offline   Reply With Quote
Old 10-15-2006, 10:37 AM   #4 (permalink)
DJMaze
Senior Contributor
 
DJMaze's Avatar
 
Join Date: Mar 2005
Posts: 676
DJMaze is on a distinguished road
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!
DJMaze is offline   Reply With Quote
Old 10-15-2006, 11:47 AM   #5 (permalink)
thedp
Registered User
 
Join Date: Oct 2006
Posts: 9
thedp is on a distinguished road
you're right I do miss this definition... so what do I do??
just define it?
thedp is offline   Reply With Quote
Old 10-15-2006, 11:57 AM   #6 (permalink)
DJMaze
Senior Contributor
 
DJMaze's Avatar
 
Join Date: Mar 2005
Posts: 676
DJMaze is on a distinguished road
correct define it in your project space so that the compiler receives the command.
__________________

UT: Ultra-kill... God like!
DJMaze is offline   Reply With Quote
Old 10-15-2006, 12:19 PM   #7 (permalink)
thedp
Registered User
 
Join Date: Oct 2006
Posts: 9
thedp is on a distinguished road
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.
thedp is offline   Reply With Quote
Old 10-15-2006, 12:27 PM   #8 (permalink)
thedp
Registered User
 
Join Date: Oct 2006
Posts: 9
thedp is on a distinguished road
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 ?
thedp is offline   Reply With Quote
Old 10-15-2006, 01:02 PM   #9 (permalink)
thedp
Registered User
 
Join Date: Oct 2006
Posts: 9
thedp is on a distinguished road
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);
}
thedp is offline   Reply With Quote
Old 10-15-2006, 02:19 PM   #10 (permalink)
DJMaze
Senior Contributor
 
DJMaze's Avatar
 
Join Date: Mar 2005
Posts: 676
DJMaze is on a distinguished road
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!
DJMaze is offline   Reply With Quote
Old 10-15-2006, 11:07 PM   #11 (permalink)
thedp
Registered User
 
Join Date: Oct 2006
Posts: 9
thedp is on a distinguished road
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.
thedp is offline   Reply With Quote
Old 10-16-2006, 01:57 PM   #12 (permalink)
DJMaze
Senior Contributor
 
DJMaze's Avatar
 
Join Date: Mar 2005
Posts: 676
DJMaze is on a distinguished road
include all source files into your project
__________________

UT: Ultra-kill... God like!
DJMaze is offline   Reply With Quote
Old 10-17-2006, 01:55 AM   #13 (permalink)
thedp
Registered User
 
Join Date: Oct 2006
Posts: 9
thedp is on a distinguished road
You mean ALL the files?
So far I've included the "include" dir.
thedp is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
help with visual studio .net scavanau Platform/API C++ 4 08-02-2005 07:27 AM
getting C# projects to run on Visual Studio .NET 2003 Apodysophilia MS Technologies ( ASP, VB, C#, .NET ) 3 02-21-2005 08:24 PM
Problems debugging visual c++ in vs.net 2003 Engineer MS Technologies ( ASP, VB, C#, .NET ) 2 07-20-2004 12:19 PM
Visual Studio 2005 Express Beta Products rdove Code Newbie News 1 06-30-2004 06:33 AM


All times are GMT -8. The time now is 08:54 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting