Pergunta

So currently I'm trying to use the VISA library from National Intruments and the IVI Foundation to read/write commands to various external devices.

I am relatively novice with my IDE: Microsoft Visual C++ Express 2010 and this is my first time trying to use a third party library that requires more than a .h import.

Basically I have a directory with 3 header files, a directory with 3 .lib libraries and a directory with 7 DLLs. They have no documentation as to what any of the individual files do, only the library as a whole. So, I need to be able to get all of these files associated with my project.

Currently I have all the headers imported in my header file and the header directory added to the include directories in the project properties. I also have the directory containing the .lib files added to the library directories in the project properties. I assumed that .lib files would link to the DLLs, but apparently that is not the case because I'm getting the error:

VISA Console 2.obj : error LNK2019: unresolved external symbol _viOpenDefaultRM@4 referenced in function _wmain

This error occurs when using any function from the library. Here is my code currently:

#include "stdafx.h"

int _tmain(int argc, _TCHAR* argv[])
{
    ViStatus status;
    ViSession defaultRM, instr;

    status = viOpenDefaultRM(&defaultRM);

    return 0;
}

The project will build when I comment out the viOpenDefaultRM command, so I assume that means I can use the objects from the library and not the commands. Since I have the 3 object declarations that build just fine.

Okay this is all my information, hopefully someone can help and hope this helps someone else!

Foi útil?

Solução

In addition to having the directory for the .lib file(s) added to the library directories property, you need to also add the actual libraries that the linker should search.

Add the libraries to the project's

 Configuration Properties | Linker | Input | Additional Dependencies

field.

The DLLs are not necessary for the build process, but to run the program they should be in a directory inthe PATH or in the same directory as the program file.

Outras dicas

Have you added to the project properties the additional dependecies?

Under "Linker->Input" find "Additional Dependecies" and place there the libs that you got from

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top