RazBerry2, v3.2.2 and C API

Discussions about RaZberry - Z-Wave board for Raspberry computer
Post Reply
hurricane
Posts: 1
Joined: 02 Feb 2022 12:15

RazBerry2, v3.2.2 and C API

Post by hurricane »

Hi,

I'm trying to get in touch with the C API and RaZberry2 in v3.2.2. However, the test project mentioned in the Z-Way manual isn't avaiable since the url https://storage.z-wave.me/fileadmin/z-way-test.tgz seems to be unaccesable. After creating a simple C program which is trying to zway_init() I've got an "undefined reference" issue. See code snippet and error message below:

Code: Select all

#include <stdio.h>
#include <ZWayLib.h>
#include <ZLogging.h>

int main(int argc, char **argv)
{
	ZWLog logger;
	ZWay zway;
	
	zway = NULL;

	ZWError r = zway_init(&zway, ZSTR("/dev/ttyAMA0"), 115200, ZSTR("/opt/z-way-server/config/"), ZSTR("/opt/z-way-server/translations/"), ZSTR("/opt/z-way-server/ZDDX/"), NULL, logger);
	
	if(r != NoError)
	{
		printf("Error");
	}
	else
	{
		printf("Inited");
		zway_log(zway, Debug, ZSTR("inited"));
	}	
	return 0;
}
gcc -I/opt/z-way-server/libzway -L/opt/z-way-server/libs -lzway -lzcommons -lzs2 -lpthread -lxml2 -lz -lm -lcrypto -larchive -o sor.out sor.c
/usr/bin/ld: /tmp/ccwfS55J.o: in function `main':
sor.c:(.text+0x54): undefined reference to `zway_init'
/usr/bin/ld: sor.c:(.text+0x84): undefined reference to `zway_get_logger'
/usr/bin/ld: sor.c:(.text+0x94): undefined reference to `zway_get_name'
/usr/bin/ld: sor.c:(.text+0xa8): undefined reference to `zlog_write'
collect2: error: ld returned 1 exit status
make: *** [makefile:2: sor.out] Fehler 1
I think the LD_LIBRARY_PATH is set correctly too:
pi@raspberrypi:~/Projekte/smor/c $ echo $LD_LIBRARY_PATH
/opt/z-way-server/libs
Any idea what is wrong?
User avatar
PoltoS
Posts: 7579
Joined: 26 Jan 2011 19:36

Re: RazBerry2, v3.2.2 and C API

Post by PoltoS »

Please try to place libs (-lzway and others) at the end
Post Reply