CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2010
    Posts
    2

    link errors, while using dll of a sensor from c++ 6.o

    Dear All


    For one of the sensors that I have bought. The company supplied me with header file, library file and the dll. Now I have written a simple code in order to access the values. There are no compilation errors but 2 link errors.
    What I have done is that in Project settings->preprocesser->include directories, I have given the path of where my header file is, in my case I have set to D:\Program Files\Microsoft Visual Studio\MyProjects\sensor\MTCSApi.h because this is where I have placed my header file (could be wrong). Similarly for linker I have given the path putting .lib file in debug folder where my exe also exists.

    I have written a small code


    #include<iostream.h>
    #include<MTCSApi.h>



    main()
    {


    /* The actual call to the function contained in the dll */
    int ReturnVal = MTCSInitSystem("0", 0x152a, 0x8220);
    cout<<"The value"<<ReturnVal;


    }

    and the following are the errors I get,
    Linking...
    sen2.obj : error LNK2001: unresolved external symbol __imp__MTCSGetADCAVR2
    Debug/Sensor2.exe : fatal error LNK1120: 1 unresolved externals


    I am absolutely confused despite of changing all the project settings. Can anyone give me a solution. I dont know whether to use MFC shared DLL option and havent tried it. What do you guys say, since I am stuck here for past few days.

    tc

  2. #2
    Join Date
    Feb 2002
    Posts
    4,640

    Re: link errors, while using dll of a sensor from c++ 6.o

    Did you add the lib file to the link settings? Not the directory, but the actual file.

    Viggy

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured