PvApi prosilica camera for mac os X

Joined
Mar 25, 2014
Messages
7
Reaction score
0
Points
1
Hello,

I am using prosilica camera http://www.alliedvisiontec.com/us/news/news-display/article/gige-vision-sdk-upda te.html on Mac os x 10.8.5. I downloaded the SDK for Mac OS X.
I try to execute the examples on the SDK but always I got this errors.
Code:
> make sample
    g++-4.2   -O3  -mmacosx-version-min=10.5 -I/usr/bin-pc/x64 -lPvAPI
    make: g++-4.2: No such file or directory
    make: *** [sample] Error 1
But when i run g++ -v on terminal I got:
Code:
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
    Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn)
    Target: x86_64-apple-darwin12.5.0
    Thread model: posix
And I installed the command line of Xcode and so on ?

What is the error ? could help me please ?
 

Raz0rEdge

Well-known member
Staff member
Moderator
Joined
Jul 17, 2009
Messages
15,762
Reaction score
2,100
Points
113
Location
MA
Your Mac's Specs
2022 Mac Studio M1 Max, 2023 M2 MBA
Welcome to Mac-Forums..

What do the following commands say?
Code:
which g++
g++ --version

You might want to take a look at the Makefile for the SDK and see what default values is being used to compile it. For starters, it looks like the value of CC or whatever is being set to "g++-4.2" while you likely only want "g++".

You can usually override the value by doing something like "make same CC=g++" or something depending on what the variable is, assuming it's a variable to begin with not hardcoded..
 
OP
P
Joined
Mar 25, 2014
Messages
7
Reaction score
0
Points
1
Code:
>which g++
/usr/bin/g++
>which gcc
/usr/bin/gcc
>g++ --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin12.5.0
Thread model: posix

In the SDK, there is an ARCH FILE that contains all configurations.
-------------------------------------
ARCH file:
Code:
# Global ARCHitecture settings for the Sample code
#
# this file should be adapted to your platform

# Target CPU
#CPU	= x86
CPU	    = x64

# Target OS
OS	    = OSX
OS_DIR  = OSX

# OS-X version
OSXV	= -mmacosx-version-min=10.5
# architecture flags
#ARCH	= -m32

# compilation flags
OPT	= -O3 $(ARCH) $(OSXV)

# compiler version
CVER    = 4.2
# compiler
CC      =g++-$(CVER)
# linker
LD      = ld
AR      = ar
SP      = strip

# some flags
DFLAGS	= -D_$(CPU) -D_$(OS)
#FLAGS   = -fno-strict-aliasing -fexceptions -I/usr/include $(DFLAGS)
FLAGS   = -I/usr/include $(DFLAGS)

## TIFF library
#LTIFF   = -ltiff

## few locations
INC_DIR	  = ../../inc-pc
BIN_DIR   = ../../bin-pc/$(CPU)
LIB_DIR   = ../../lib-pc/$(CPU)
OBJ_DIR	  = ./obj/$(CPU)
EXTRA_LIB = -lpthread -lz

## library
LJPEG   = -ljpeg

## libs (shared/static)
PVLIB   = -L$(BIN_DIR) -lPvAPI
SOLIB	= $(EXTRA_LIB) -Bdynamic -lm -lc
SALIB	= -Bstatic $(LIB_DIR)/$(CVER)/libPvAPI.a -framework CoreFoundation
IMLIB   = -Bstatic $(LIB_DIR)/$(CVER)/libImagelib.a -Bdynamic $(LTIFF)

## final compilation flags
CFLAGS	= $(OPT) $(FLAGS) -Wall -I$(INC_DIR) -D_REENTRANT $(EXTRA)

this is the make file for my sample code:
----------------------------------------------------------------

Code:
# makefile of GigE SDK Sample code
#

include ../ARCH

## Executable
EXE	= ListCameras

$(OBJ_DIR)/%.o : %.cpp
	$(CC) $(CFLAGS) $(VERSION) -c $< -o $@

clean: 
	rm $(EXE)

sample : $(EXE).cpp
	$(CC) $(RPATH) $(TARGET) $(CFLAGS) $(EXE).cpp -o $(EXE) $(SOLIB) $(PVLIB)

sample-static : $(EXE).cpp
	$(CC) $(RPATH) $(TARGET) $(CFLAGS) $(EXE).cpp $(SALIB) -o $(EXE) $(SOLIB)
	
install:
	cp -f $(EXE) $(BIN_DIR)
 

Raz0rEdge

Well-known member
Staff member
Moderator
Joined
Jul 17, 2009
Messages
15,762
Reaction score
2,100
Points
113
Location
MA
Your Mac's Specs
2022 Mac Studio M1 Max, 2023 M2 MBA
OK, So CC is being set to g++-$(CVER) and CVER is 4.2, thus the messed up name.

Just pass "CC=g++" at the command line and it should build fine..
 
OP
P
Joined
Mar 25, 2014
Messages
7
Reaction score
0
Points
1
thanks a lot! it is working.

But now, I need to do my own code using the sdk. So, where i have to put the inc files, the bin files and the lib files to be recognized in QT. Thanks
 

Raz0rEdge

Well-known member
Staff member
Moderator
Joined
Jul 17, 2009
Messages
15,762
Reaction score
2,100
Points
113
Location
MA
Your Mac's Specs
2022 Mac Studio M1 Max, 2023 M2 MBA
Depends on what you are using to write your program really. If you are going to use g++ to compile your code, you can just pass in the include directory with the "-i" argument, the library folder with the "-L" argument..

Read up on the g++ man page or documentation online on what this means..

You, ideally, want to use a Makefile that will manage this for so that you can just use the "make" command to build everything..
 
OP
P
Joined
Mar 25, 2014
Messages
7
Reaction score
0
Points
1
Hello,

I am using Qt. Now, I am trying to copy an example ()ListCameras.cpp code from as example sdk in QT. I put PvApi.h in /opt/local/include/ and I try to execute my the code but I get a lot of error. Why it was fine when I compiled it online ?

the ListCameras.pro is

Code:
#-------------------------------------------------
#-------------------------------------------------
#
# Project created by QtCreator 2014-03-25T21:43:24
#
#-------------------------------------------------

QT       += core

QT       -= gui

TARGET = ListCameras
CONFIG   += console
CONFIG   -= app_bundle

TEMPLATE = app


SOURCES += main.cpp
INCLUDEPATH+=/opt/local/include/
LIBS+=-L/opt/local/lib/
LIBS+= -llibPvAPI
LIBS+= -llibPvJNI

The erros are all in the PvApi.

Code:
In file included from ../ListCameras/main.cpp:55:
/opt/local/include/PvApi.h:97:26: error: Define PVDECL to be your compiler keyword for "standard call"
                        #error Define PVDECL to be your compiler keyword for "standard call"
                         ^
/opt/local/include/PvApi.h:271:22: error: expected ')'
typedef void (PVDECL *tPvLinkCallback)(void* Context,
                     ^
/opt/local/include/PvApi.h:271:14: note: to match this '('
typedef void (PVDECL *tPvLinkCallback)(void* Context,
             ^
/opt/local/include/PvApi.h:302:22: error: expected ')'
typedef void (PVDECL *tPvCameraEventCallback)(void* Context,
                     ^
/opt/local/include/PvApi.h:302:14: note: to match this '('
typedef void (PVDECL *tPvCameraEventCallback)(void* Context,
             ^
/opt/local/include/PvApi.h:302:15: error: typedef redefinition with different types ('void (void *, tPvHandle, const tPvCameraEvent *, unsigned long)' vs 'void (void *, tPvInterface, tPvLinkEvent, unsigned long)')
typedef void (PVDECL *tPvCameraEventCallback)(void* Context,
              ^
/opt/local/include/PvApi.h:271:15: note: previous definition is here
typedef void (PVDECL *tPvLinkCallback)(void* Context,
              ^
/opt/local/include/PvApi.h:412:22: error: expected ')'
typedef void (PVDECL *tPvFrameCallback)(tPvFrame* Frame);
                     ^
/opt/local/include/PvApi.h:412:14: note: to match this '('
typedef void (PVDECL *tPvFrameCallback)(tPvFrame* Frame);
             ^
/opt/local/include/PvApi.h:412:15: error: typedef redefinition with different types ('void (tPvFrame *)' vs 'void (void *, tPvInterface, tPvLinkEvent, unsigned long)')
typedef void (PVDECL *tPvFrameCallback)(tPvFrame* Frame);
              ^
/opt/local/include/PvApi.h:271:15: note: previous definition is here
typedef void (PVDECL *tPvLinkCallback)(void* Context,
              ^
/opt/local/include/PvApi.h:431:2: error: Define specific data types for your platform.
#error Define specific data types for your platform.
 ^
/opt/local/include/PvApi.h:508:6: error: variable has incomplete type 'void'
void PVDECL PvVersion(unsigned long* pMajor,unsigned long* pMinor);
     ^
/opt/local/include/PvApi.h:508:12: error: expected ';' after top level declarator
void PVDECL PvVersion(unsigned long* pMajor,unsigned long* pMinor);
           ^
           ;
/opt/local/include/PvApi.h:528:8: error: redefinition of 'PVDECL' as different kind of symbol
tPvErr PVDECL PvInitialize(void);
       ^
/opt/local/include/PvApi.h:271:15: note: previous definition is here
typedef void (PVDECL *tPvLinkCallback)(void* Context,
              ^
/opt/local/include/PvApi.h:528:14: error: expected ';' after top level declarator
tPvErr PVDECL PvInitialize(void);
             ^
             ;
/opt/local/include/PvApi.h:546:8: error: redefinition of 'PVDECL' as different kind of symbol
tPvErr PVDECL PvInitializeNoDiscovery(void);
       ^
/opt/local/include/PvApi.h:271:15: note: previous definition is here
typedef void (PVDECL *tPvLinkCallback)(void* Context,
              ^
/opt/local/include/PvApi.h:546:14: error: expected ';' after top level declarator
tPvErr PVDECL PvInitializeNoDiscovery(void);
             ^
             ;
/opt/local/include/PvApi.h:559:6: error: variable has incomplete type 'void'
void PVDECL PvUnInitialize(void);
     ^
/opt/local/include/PvApi.h:559:12: error: expected ';' after top level declarator
void PVDECL PvUnInitialize(void);
           ^
           ;
/opt/local/include/PvApi.h:593:8: error: redefinition of 'PVDECL' as different kind of symbol
tPvErr PVDECL PvLinkCallbackRegister(tPvLinkCallback Callback,
       ^
/opt/local/include/PvApi.h:271:15: note: previous definition is here
typedef void (PVDECL *tPvLinkCallback)(void* Context,
              ^
/opt/local/include/PvApi.h:593:14: error: expected ';' after top level declarator
tPvErr PVDECL PvLinkCallbackRegister(tPvLinkCallback Callback,
             ^
             ;
/opt/local/include/PvApi.h:616:8: error: redefinition of 'PVDECL' as different kind of symbol
tPvErr PVDECL PvLinkCallbackUnRegister(tPvLinkCallback Callback,
       ^
/opt/local/include/PvApi.h:271:15: note: previous definition is here
typedef void (PVDECL *tPvLinkCallback)(void* Context,
              ^
/opt/local/include/PvApi.h:616:14: error: expected ';' after top level declarator
tPvErr PVDECL PvLinkCallbackUnRegister(tPvLinkCallback Callback,
             ^
             ;
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [main.o] Error 1
22:12:10: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project ListCameras (kit: Desktop Qt 5.0.2 clang 64bit)
When executing step 'Make'
 
Last edited:

pigoo3

Well-known member
Staff member
Admin
Joined
May 20, 2008
Messages
44,212
Reaction score
1,424
Points
113
Location
U.S.
Your Mac's Specs
2017 15" MBP, 16gig ram, 1TB SSD, OS 10.15
If OP really is a "phdstudent"...maybe we shouldn't be helping too much with the homework!;)

- Nick
 

Raz0rEdge

Well-known member
Staff member
Moderator
Joined
Jul 17, 2009
Messages
15,762
Reaction score
2,100
Points
113
Location
MA
Your Mac's Specs
2022 Mac Studio M1 Max, 2023 M2 MBA
First, how much do you know about programming? You should make sure you are trying to take a bite out of something you can actually grasp..

All of the errors after the first one are expected because you have an #error pre-processor statement telling you the problem, if you read it, it says that you have to define PVDECL to something real and then only with the #error not be hit and the code will begin to compile.

Read the instructions that came along with the SDK to understand what you have to do to set it up properly..
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top