Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Problems compiling C in XCODE using VISA / NI

Solved!
Go to solution

Hi,

 

I'm developing a program in C to communicate with my Tektronix oscilloscope. I inherited this project from a friend (who is currently incommunicado), so I can't talk to him about it.

 

About my system: I'm running OS X 10.8.4, developing in XCODE 4.6.3. I originally had problems with NI-VISA 5.3, and they recurred when I upgraded to 5.4 (I thought upgrading might fix the issue).

This is also a cross post. I posted on the Apple Developer forum to no avail (https://discussions.apple.com/message/22681139#22681139). If my problem gets solved there first, I'll post the solution here as well. I don't pick sides.

 

Basically, my problem is that my program will not build due to a linker problem. I am using functions from the NI-VISA 5.4 package for OS X 10.8. However, the linker cannot seem to find the correct functions for my system:

 

Undefined symbols for architecture x86_64:

  "_viClose", referenced from:

      _setupVI in oscilloscope.o

      _getData in oscilloscope.o

      _closeInstr in oscilloscope.o

  "_viOpen", referenced from:

      _setupVI in oscilloscope.o

  "_viOpenDefaultRM", referenced from:

      _setupVI in oscilloscope.o

  "_viRead", referenced from:

      _setupVI in oscilloscope.o

      _getData in oscilloscope.o

  "_viStatusDesc", referenced from:

      _setupVI in oscilloscope.o

      _getData in oscilloscope.o

  "_viWrite", referenced from:

      _setupVI in oscilloscope.o

      _getData in oscilloscope.o

ld: symbol(s) not found for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

 

These are all pretty basic VISA functions. I struggled in just including the correct header file, as

#include <visa.h>

didn't work. When I went to the verbose form, it worked:

#include "/Library/Frameworks/VISA.framework/Versions/A/Headers/visa.h"

 

However, then the problem started happening that I'm having now -- the object linker can't find the code for the VISA functions. I've tried changing build architctures from x86_64 to just x86, without avail. I'm currently building in i386 x86. I've also tried (under Build Phases -> Link Binary with Libraries) to link the VISA.framework to the project, but this simply gives the linker error "framework not found VISA". I've also tried option-clean.

 

I feel like I am missing something very obvious. I'm still operating under the notion that either NI-VISA did not install to the correct location, or that my build settings are incorrect.

 

Does anyone have any insight to lend? I've been searching through different forums for help for almost 2 days now, with no avail.

0 Kudos
Message 1 of 2
(6,191 Views)
Solution
Accepted by topic author atucker

solved in cross thread https://discussions.apple.com/message/22682742#22682742

 

copied settings from: National Instruments/NI-VISA/Examples/C/ExamplesProject.pbproj

 


ended up with:

 

Final settings I ended up using:

Architectures

Architectures:     $NATIVE_ARCH_ACTUAL

Build Active Architecture Only:     No

Valid Architectures:     i386 x86_64

 

Search Paths

no Framework Search Paths

no Library Search Paths

 

Build Phases

Link Binary With Libraries:     VISA.framework

 

I think keeping /Library/Frameworks in the search paths is what was causing my problems when trying to Link Binary.

 

Thanks to xnav and Frank (had the right initial idea, which I had tried but just in the wrong manner).

0 Kudos
Message 2 of 2
(6,180 Views)