Closed NWiebusch closed 3 years ago
I cannot reproduce that error with the following setup:
PLCnext CLI version 21.0.0 LTS (21.0.0.489) Eclipse Version: 2019-09 R (4.13.0) PLCnext add-in for eclipse, version 21.0.0.489
Do you see the same problem when you create an empty ACF project and build it straight away, without replacing the source files with the ones in this repository?
... and, I assume you mean Example 5 (Data Access), not Example 3 (Data Type Exchange) ?
The Build procedure needs to be adapted for acf projects.
@ tools/build.sh -> tools/build_acf.sh
mv Examples/DataAccessExample Examples/DataAccess
cd Examples/DataAccess
plcncli new acfproject -c DummyC && ls -la src && rm src/Dummy*
plcncli set target --add --name AXCF2152 --version 2021.0.2
plcncli generate all
plcncli build
plcncli deploy
When compiling the Example 3 on its own with plcncli 2021.0.1, the linker throws an exception:
/bin/sh -c "/usr/bin/plcncli" build -p"/home/debianuser/eclipse-workspace-cpp/DataAccess" -b Release Requested build for targets RFC4072S,21.3.0.25 Starting build for target RFC4072S,21.3.0.25 Checking if CMake needs to be reconfigured... [cmake]: Scanning dependencies of target DataAccess [cmake]: [ 25%] Building CXX object CMakeFiles/DataAccess.dir/intermediate/code/DataAccessLibrary.cpp.o [cmake]: [ 50%] Building CXX object CMakeFiles/DataAccess.dir/intermediate/code/DataAccessLibrary.meta.cpp.o [cmake]: [ 75%] Building CXX object CMakeFiles/DataAccess.dir/src/DataAccessComponent.cpp.o [cmake]: [100%] Linking CXX shared library libDataAccess.so [cmake]: /opt/pxc/2021.3/RFC_4072S/sysroots/x86_64-pokysdk-linux/usr/libexec/x86_64-pxc-linux/gcc/x86_64-pxc-linux/9.3.0/real-ld: CMakeFiles/DataAccess.dir/src/DataAccessComponent.cpp.o:(.data.rel.ro._ZTVN10DataAccess19DataAccessComponentE[_ZTVN10DataAccess19DataAccessComponentE]+0xb0): undefined reference to
DataAccess::DataAccessComponent::RegisterComponentPorts()' [cmake]: /opt/pxc/2021.3/RFC_4072S/sysroots/x86_64-pokysdk-linux/usr/libexec/x86_64-pxc-linux/gcc/x86_64-pxc-linux/9.3.0/real-ld: CMakeFiles/DataAccess.dir/src/DataAccessComponent.cpp.o:(.data.rel.ro._ZTVN10DataAccess19DataAccessComponentE[_ZTVN10DataAccess19DataAccessComponentE]+0xe8): undefined reference to
non-virtual thunk to DataAccess::DataAccessComponent::RegisterComponentPorts()' [cmake]: collect2: error: ld returned 1 exit status [cmake]: make[2]: ** [CMakeFiles/DataAccess.dir/build.make:140: libDataAccess.so] Error 1 [cmake]: make[1]: [CMakeFiles/Makefile2:73: CMakeFiles/DataAccess.dir/all] Error 2 [cmake]: make: * [Makefile:130: all] Error 2 cmake process exited with errorThis issue can be fixed by adding the reference into DataAccessComponent.cpp
void DataAccessComponents::RegisterComponentPorts() { }