I have read all the previous replies or solutions for the same linker problem. I understand that the Linker is unable to access the library file that has the functions defined but still I have no luck in solving it!

The errors:

```
1>trial_12th.obj : error LNK2019: unresolved external symbol _viStatusDesc@12 referenced in function _main
1>trial_12th.obj : error LNK2019: unresolved external symbol _viClose@4 referenced in function _main
1>trial_12th.obj : error LNK2019: unresolved external symbol _viRead@16 referenced in function _main
1>trial_12th.obj : error LNK2019: unresolved external symbol _viWrite@16 referenced in function _main
1>trial_12th.obj : error LNK2019: unresolved external symbol _viOpen@20 referenced in function _main
1>trial_12th.obj : error LNK2019: unresolved external symbol _viOpenDefaultRM@4 referenced in function _main
1>C:\Users\41kchoudhary\Documents\Visual Studio 2010\Projects\trial_12th\Debug\trial_12th.exe : fatal error LNK1120: 6 unresolved externals

```

I am trying to send and receive data from a mixed-signal oscilloscope. In doing so I am required to write a .cpp file using the pre-defined commands/functions defined using Microsoft Visual Studio C++. I have read the user manual for using these commands, and I also have the header files and libraries required to implement it.

I am using the following code:

```
#include <visa.h>
#include "stdafx.h"
#include <stdio.h>
#include <memory.h>

int main(int argc, char* argv[])
{
     ViSession rm = VI_NULL, vi = VI_NULL;
     ViStatus status;
     ViChar buffer[256];
     ViUInt32 retCnt;

     // Open a default session
     status = viOpenDefaultRM(&rm);
     if (status < VI_SUCCESS) goto error;

     // Open the GPIB device at primary address 1, GPIB board 8
     status = viOpen(rm, "USB::0x0699::0x0377::C011104::INSTR", VI_NULL, VI_NULL,
     &vi);
     if (status < VI_SUCCESS) goto error;

     // Send an ID query.
     status = viWrite(vi, (ViBuf) "*idn?", 5, &retCnt);
     if (status < VI_SUCCESS) goto error;

     // Clear the buffer and read the response
     memset(buffer, 0, sizeof(buffer));
     status = viRead(vi, (ViBuf) buffer, sizeof(buffer), &retCnt);
     if (status < VI_SUCCESS) goto error;

     // Print the response
     printf("id: %s\n", buffer);

     // Clean up
     viClose(vi); // Not needed, but makes things a bit more

     // understandable
     viClose(rm); // Closes resource manager and any sessions

     // opened with it
     return 0;

     error:
         // Report error and clean up
             viStatusDesc(vi, status, buffer);
             fprintf(stderr, "failure: %s\n", buffer);
             if (rm != VI_NULL) {
                 viClose(rm);
             }
             return 1;
}

```
['https://Stackoverflow.com/questions/15982291', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2276161/']
One different approach is to iterate over each line and do stuff for each iteration. 0 lines = 0 iterations = no extra code needed.
I think should check like this:

```
def file_empty?(file_path) 
  !(File.file?(file_path) && !File.zero?(file_path))
end

```

so we do not need to worry about file exist or not.

File.zero?('test.rb') return false if file not exist