user7335295
user7335295

Reputation: 441

open62541: Error when building PubSub example

Currently, I am trying to build the PubSub example of the open62541 implementation. I have already gone through the documentation on how to build the examples a several times but I cannot figure it out.

I have tried to compile the PubSub tutorial examples. This includes the tutorial_pubsub_publish.c and the tutorial_pubsub_subscribe.c files. After I cloned the repository, I built the library as followed:

mkdir build 
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON - 
DUA_ENABLE_AMALGAMATION=ON -DUA_ENABLE_PUBSUB=ON ..
make

First I compiled the publish example which worked:

gcc -std=c99 -o PubSub_Publish_Example open62541.c tutorial_pubsub_publish.c

Then, I tried to compile the subscribe example in the same way like this:

gcc -std=c99 -o PubSub_Publish_Example open62541.c tutorial_pubsub_subscribe.c

This generated lots of errors - all saying "No such file or directory(first error was for the #include "ua_architecture_base.h") Then I tried to compile it with the ua_architecture_base.h and get other missing file or directory error and so on...

I also tried to compile the whole include folder of the open62541, but I also get "No such file or directory" errors:

gcc -std=c99 -I /home/theresa/Desktop/open62541/include -o PubSub_Subscribe_Example open62541.c tutorial_pubsub_subscribe.c

I also noticed that of all examples provided by the open62541 master, the tutorial_pubsub_subscribe.c file is the only example which does NOT include the open62541.h folder. Instead it includes a few other header files:

#include "ua_pubsub_networkmessage.h"
#include "ua_log_stdout.h"
#include "ua_server.h"
#include "ua_config_default.h"
#include "ua_pubsub.h"
#include "ua_network_pubsub_udp.h"
#ifdef UA_ENABLE_PUBSUB_ETH_UADP
     #include "ua_network_pubsub_ethernet.h"
#endif
#include "src_generated/ua_types_generated.h"
#include <stdio.h>
#include <signal.h>

So how can I compile and run the tutorial_pubsub_subscribe.c example and why does the subscriber example not include the open62541 header file?

Upvotes: 0

Views: 1104

Answers (1)

Andrew Cullen
Andrew Cullen

Reputation: 868

I had success following the instructions "Building with CMake for Windows".
Using cmake-gui I selected the (advanced) features: UA_BUILD_EXAMPLES, UA_ENABLE_PUBSUB, UA_ENABLE_PUBSUB_INFORMATIONMODEL, UA_ENABLE_PUBSUB_INFORMATIONMODEL_METHODS, and UA_NAMESPACE_ZERO = FULL

Upvotes: 1

Related Questions