Msql How to develop and compile

When I try to compile this little code under MS visual c++ I got 9 errors back
LNK2001 unresolved external symbol _msqlFreeResult@4

The code was taken from http://shell.warped.com/~joshua/MSQLDebug/   

I put the msql.h in DevStudio\VC\include and some msql.dll in DevStudio\VC\lib

So question are

What is my mistake?
How could I compile that Code?
What msql dll do I need?


#include <stdio.h>
#include <sys/types.h>
#include <fcntl.h>

#include <winsock.h>

#include <msql.h>


int main(int argc, char *argv[])
{
      int            sock;
      m_result *      res;
      m_row            row;
      int            i;
      int            count;
      char            buf[256];

      printf("There can be only one!\n");

      if (argc != 4)
      {
            printf("Usage: %s Host DBName Table\n", argv[0]);
            return(0);
      }

      if ((sock = msqlConnect(argv[1])) < 0)
      {
            printf("ERROR : %s\n",msqlErrMsg);
            exit(1);
      }

      if(msqlSelectDB(sock, argv[2]) < 0)
      {
            printf("Can't select database: %s\n", msqlErrMsg);
            msqlClose(sock);
            exit(1);
      }

      sprintf(buf, "SELECT * FROM %s", argv[3]);
      if(msqlQuery(sock, buf) < 0)
      {
            printf("ERROR: Invalid query: %s\n", msqlErrMsg);
            msqlClose(sock);
            exit(1);
      }

      res = msqlStoreResult();

      msqlDataSeek(res, 0);

      count = 0;
      while (row = msqlFetchRow(res))
      {
            for (i=0; i<msqlNumFields(res); i++)
                  printf("'%s' ", row[i]);
            printf("\n");

            count++;
      }

      printf("\n\nTotal Number of Rows = %d\n", count);

      msqlFreeResult(res);

      msqlClose(sock);

      printf("And done...\n");
      return(0);
}
LVL 1
mgoergenAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

nil_dibCommented:
1. you should put the msqlxy.lib files in the DevStudio\VC\lib!

2. look at project->settings->linker->input and add the lib files to the object/library modules

3. put the dll in the directory of the executable, or in directory known by the PATH variable

nil_dib
0
mgoergenAuthor Commented:
Hi

The settings for point 2 are done. I got now 14 erros but different ones.

So I guess that could be the right way to solve the problem
0
inprasCommented:
Hi mgoergen
I have downloaded and tried what U said

U have to include
msql.dll and msql_dll.lib to UR project settings
copy both these files to UR current directory and in the project settings Link tab use /NODEFAULT "msql.lib" "msql_dll.lib"
U can successfully compile which I did just now

Hope this helps
Regards
0
Rowby Goren Makes an Impact on Screen and Online

Learn about longtime user Rowby Goren and his great contributions to the site. We explore his method for posing questions that are likely to yield a solution, and take a look at how his career transformed from a Hollywood writer to a website entrepreneur.

mgoergenAuthor Commented:
Sorry Still got errors :-(

But I guess it depends on me and my not worse knowledge about Visual C. So perhaps you could send the whole project file to me?  I guess the settings would then be right.

mgoergen@compu-shack.com

After that I will except your answer

Thanks a lot for helping
Mirko


0
inprasCommented:
I am sending it write now
see the explaination also in the mail
Regards
0
inprasCommented:
Thank U Nice that its working for U
Regards
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.