Forum Replies Created
-
AuthorPosts
-
November 10, 2019 at 23:52 in reply to: CMake project not recognizing header files in sysroot/usr/local/include #26421nOlanderParticipant
Just realized I never responded to this, but this resolved the issue and it has been building properly
November 1, 2019 at 21:26 in reply to: Import CMake project – Exception from HRESULT: 0x80070057 (E_INVALIDARG) #26399nOlanderParticipantI was able to create a new project from the CMake file successfully, it appears this was occurring when attempting to add a new VisualGDB CMake project to an existing solution. Still remains a bug, but it’s less of an issue as I am able to create a new project from a CMake file and add other projects to the created solution.
October 24, 2019 at 19:39 in reply to: CMake project not recognizing header files in sysroot/usr/local/include #26291nOlanderParticipantI believe I may have resolved this. In this section:
target_include_directories(Snap7-Wrapper PUBLIC ${PROJECT_SOURCE_DIR}/include PRIVATE ${CMAKE_SOURCE_DIR}/include ${CMAKE_SYSROOT}/usr/local/include )
I switched the sysroot line to the
PUBLIC
section and it seemed to work.I’m not 100% certain, but it is no longer reporting the snap7.h not found on building. I will complete some testing and report the success here.
October 24, 2019 at 02:38 in reply to: CMake project not recognizing header files in sysroot/usr/local/include #26288nOlanderParticipantMy apologies for the delay in response. I believe I resolved that and got this output:
------ Build started: Project: Services, Configuration: Debug VisualGDB ------ VisualGDB: Run "c:\SysGCC\raspberry\bin\make.exe VERBOSE=1" in directory "E:\NCA\Webservice\branches\stability\Services\Services\../VisualGDB/Debug" on local computer C:/Users/user/AppData/Local/VisualGDB/CMake/bin/cmake.exe -SE:/NCA/Webservice/branches/stability/Services -BE:/NCA/Webservice/branches/stability/Services/VisualGDB/Debug --check-build-system CMakeFiles/Makefile.cmake 0 C:/Users/user/AppData/Local/VisualGDB/CMake/bin/cmake.exe -E cmake_progress_start E:/NCA/Webservice/branches/stability/Services/VisualGDB/Debug/CMakeFiles E:/NCA/Webservice/branches/stability/Services/VisualGDB/Debug/CMakeFiles/progress.marks c:/SysGCC/raspberry/bin/make -f CMakeFiles/Makefile2 all make[1]: Entering directory `E:/NCA/Webservice/branches/stability/Services/VisualGDB/Debug' c:/SysGCC/raspberry/bin/make -f src/plc/CMakeFiles/Snap7-Wrapper.dir/build.make src/plc/CMakeFiles/Snap7-Wrapper.dir/depend make[2]: Entering directory `E:/NCA/Webservice/branches/stability/Services/VisualGDB/Debug' C:/Users/user/AppData/Local/VisualGDB/CMake/bin/cmake.exe -E cmake_depends "Unix Makefiles" E:/NCA/Webservice/branches/stability/Services E:/NCA/Webservice/branches/stability/Services/src/plc E:/NCA/Webservice/branches/stability/Services/VisualGDB/Debug E:/NCA/Webservice/branches/stability/Services/VisualGDB/Debug/src/plc E:/NCA/Webservice/branches/stability/Services/VisualGDB/Debug/src/plc/CMakeFiles/Snap7-Wrapper.dir/DependInfo.cmake make[2]: Leaving directory `E:/NCA/Webservice/branches/stability/Services/VisualGDB/Debug' c:/SysGCC/raspberry/bin/make -f src/plc/CMakeFiles/Snap7-Wrapper.dir/build.make src/plc/CMakeFiles/Snap7-Wrapper.dir/build make[2]: Entering directory `E:/NCA/Webservice/branches/stability/Services/VisualGDB/Debug' make[2]: Nothing to be done for `src/plc/CMakeFiles/Snap7-Wrapper.dir/build'. make[2]: Leaving directory `E:/NCA/Webservice/branches/stability/Services/VisualGDB/Debug' [ 11%] Built target Snap7-Wrapper c:/SysGCC/raspberry/bin/make -f src/comms/CMakeFiles/NFC-PLC-Comms.dir/build.make src/comms/CMakeFiles/NFC-PLC-Comms.dir/depend make[2]: Entering directory `E:/NCA/Webservice/branches/stability/Services/VisualGDB/Debug' C:/Users/user/AppData/Local/VisualGDB/CMake/bin/cmake.exe -E cmake_depends "Unix Makefiles" E:/NCA/Webservice/branches/stability/Services E:/NCA/Webservice/branches/stability/Services/src/comms E:/NCA/Webservice/branches/stability/Services/VisualGDB/Debug E:/NCA/Webservice/branches/stability/Services/VisualGDB/Debug/src/comms E:/NCA/Webservice/branches/stability/Services/VisualGDB/Debug/src/comms/CMakeFiles/NFC-PLC-Comms.dir/DependInfo.cmake make[2]: Leaving directory `E:/NCA/Webservice/branches/stability/Services/VisualGDB/Debug' c:/SysGCC/raspberry/bin/make -f src/comms/CMakeFiles/NFC-PLC-Comms.dir/build.make src/comms/CMakeFiles/NFC-PLC-Comms.dir/build make[2]: Entering directory `E:/NCA/Webservice/branches/stability/Services/VisualGDB/Debug' [ 17%] Building CXX object src/comms/CMakeFiles/NFC-PLC-Comms.dir/src/NFC_comms.cpp.o cd E:/NCA/Webservice/branches/stability/Services/VisualGDB/Debug/src/comms && c:/SysGCC/raspberry/bin/arm-linux-gnueabihf-g++.exe --sysroot=c:/SysGCC/raspberry/arm-linux-gnueabihf/sysroot -IE:/NCA/Webservice/branches/stability/Services/spdlog -IE:/NCA/Webservice/branches/stability/Services/src/comms/include -IE:/NCA/Webservice/branches/stability/Services/plc/include -IE:/NCA/Webservice/branches/stability/Services/src/plc/include -g -Werror -std=c++14 -o CMakeFiles/NFC-PLC-Comms.dir/src/NFC_comms.cpp.o -c E:/NCA/Webservice/branches/stability/Services/src/comms/src/NFC_comms.cpp In file included from E:/NCA/Webservice/branches/stability/Services/src/comms/include/comms.hpp:81, from E:/NCA/Webservice/branches/stability/Services/src/comms/src/NFC_comms.cpp:1: E:\NCA\Webservice\branches\stability\Services\src\plc\include\S7Object_Wrapper.hpp(22,10): error : snap7.h: No such file or directory #include <snap7.h> ^~~~~~~~~ compilation terminated. make[2]: *** [src/comms/CMakeFiles/NFC-PLC-Comms.dir/src/NFC_comms.cpp.o] Error 1 make[2]: Leaving directory `E:/NCA/Webservice/branches/stability/Services/VisualGDB/Debug' make[1]: *** [src/comms/CMakeFiles/NFC-PLC-Comms.dir/all] Error 2 make[1]: Leaving directory `E:/NCA/Webservice/branches/stability/Services/VisualGDB/Debug' make: *** [all] Error 2 ------------------------------------------------------------- Command exited with code 2 Executable: c:\SysGCC\raspberry\bin\make.exe Arguments: VERBOSE=1 Directory: E:\NCA\Webservice\branches\stability\Services\Services\../VisualGDB/Debug VisualGDB: Error: Command-line action failed ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Does that clarify the issue at all? It seems a bit more verbose than the previous one.
October 14, 2019 at 20:52 in reply to: CMake project not recognizing header files in sysroot/usr/local/include #26154nOlanderParticipantWhen I output the value of
${CMAKE_SYSROOT}
it is printing the correct path to the sysroot but I’m still getting that same error when I build. This seems to be the affected due to youtarget_include_directories(Snap7-Wrapper PUBLIC ${PROJECT_SOURCE_DIR}/include PRIVATE ${CMAKE_SOURCE_DIR}/include ${CMAKE_SYSROOT}/usr/local/include ) message(${CMAKE_SYSROOT})
which outputs
c:/SysGCC/raspberry/arm-linux-gnueabihf/sysroot.
My make output is the following:
------ Build started: Project: Services, Configuration: Debug VisualGDB ------ VisualGDB: Run "c:\SysGCC\raspberry\bin\make.exe " in directory "E:\Webservice\branches\stability\Services\Services\../VisualGDB/Debug" on local computer C:/Users/USER/AppData/Local/VisualGDB/CMake/bin/cmake.exe -SE:/Webservice/branches/stability/Services -BE:/Webservice/branches/stability/Services/VisualGDB/Debug --check-build-system CMakeFiles/Makefile.cmake 0 C:/Users/USER/AppData/Local/VisualGDB/CMake/bin/cmake.exe -E cmake_progress_start E:/Webservice/branches/stability/Services/VisualGDB/Debug/CMakeFiles E:/Webservice/branches/stability/Services/VisualGDB/Debug/CMakeFiles/progress.marks c:/SysGCC/raspberry/bin/make -f CMakeFiles/Makefile2 all make[1]: Entering directory `E:/Webservice/branches/stability/Services/VisualGDB/Debug' c:/SysGCC/raspberry/bin/make -f src/config/CMakeFiles/Config.dir/build.make src/config/CMakeFiles/Config.dir/depend make[2]: Entering directory `E:/Webservice/branches/stability/Services/VisualGDB/Debug' make[2]: Leaving directory `E:/Webservice/branches/stability/Services/VisualGDB/Debug' c:/SysGCC/raspberry/bin/make -f src/config/CMakeFiles/Config.dir/build.make src/config/CMakeFiles/Config.dir/build [ 23%] Built target Config c:/SysGCC/raspberry/bin/make -f src/plc/CMakeFiles/Snap7-Wrapper.dir/build.make src/plc/CMakeFiles/Snap7-Wrapper.dir/depend make[2]: Entering directory `E:/Webservice/branches/stability/Services/VisualGDB/Debug' make[2]: Leaving directory `E:/Webservice/branches/stability/Services/VisualGDB/Debug' c:/SysGCC/raspberry/bin/make -f src/plc/CMakeFiles/Snap7-Wrapper.dir/build.make src/plc/CMakeFiles/Snap7-Wrapper.dir/build [ 35%] Built target Snap7-Wrapper c:/SysGCC/raspberry/bin/make -f src/comms/CMakeFiles/NFC-PLC-Comms.dir/build.make src/comms/CMakeFiles/NFC-PLC-Comms.dir/depend make[2]: Entering directory `E:/Webservice/branches/stability/Services/VisualGDB/Debug' make[2]: Leaving directory `E:/Webservice/branches/stability/Services/VisualGDB/Debug' c:/SysGCC/raspberry/bin/make -f src/comms/CMakeFiles/NFC-PLC-Comms.dir/build.make src/comms/CMakeFiles/NFC-PLC-Comms.dir/build make[2]: Entering directory `E:/Webservice/branches/stability/Services/VisualGDB/Debug' [ 41%] Building CXX object src/comms/CMakeFiles/NFC-PLC-Comms.dir/src/NFC_comms.cpp.o In file included from E:/Webservice/branches/stability/Services/src/comms/include/comms.hpp:81, from E:/Webservice/branches/stability/Services/src/comms/src/NFC_comms.cpp:1: E:\Webservice\branches\stability\Services\src\plc\include\S7Object_Wrapper.hpp(22,10): error : snap7.h: No such file or directory #include <snap7.h> ^~~~~~~~~ compilation terminated. make[2]: Leaving directory `E:/Webservice/branches/stability/Services/VisualGDB/Debug' make[2]: *** [src/comms/CMakeFiles/NFC-PLC-Comms.dir/src/NFC_comms.cpp.o] Error 1 make[1]: *** [src/comms/CMakeFiles/NFC-PLC-Comms.dir/all] Error 2 make[1]: Leaving directory `E:/Webservice/branches/stability/Services/VisualGDB/Debug' make: *** [all] Error 2 ------------------------------------------------------------- Command exited with code 2 Executable: c:\SysGCC\raspberry\bin\make.exe Arguments: Directory: E:\Webservice\branches\stability\Services\Services\../VisualGDB/Debug VisualGDB: Error: Command-line action failed ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Does this help you in resolving the issue all?
- This reply was modified 5 years, 2 months ago by nOlander.
October 10, 2019 at 16:25 in reply to: CMake project not recognizing header files in sysroot/usr/local/include #26135nOlanderParticipantI made that change in my CMake file, but it’s still reporting
No such file or directory
even after changing the CMakeLists.txt and clean/rebuild the entire solution. Is there any way to view the output of CMake generating the make command? I can only find the output for the build, not including CMake.October 9, 2019 at 21:34 in reply to: CMake project not recognizing header files in sysroot/usr/local/include #26127nOlanderParticipantThis is how the CMake file is set up:
cmake_minimum_required(VERSION 3.0) project(PLCComms VERSION 0.2.3) set(SRC src/service.cpp src/PLC_control.cpp ) add_library(Snap7-Wrapper src/S7Object_Wrapper.cpp) set_target_properties(Snap7-Wrapper PROPERTIES LANGUAGES CXX CXX_STANDARD 14 CXX_STANDARD_REQUIRED ON CXX_EXTENSIONS OFF DESCRIPTION "Wrapper around snap7 library" VERSION 0.0.2 ) target_include_directories(Snap7-Wrapper PUBLIC ${PROJECT_SOURCE_DIR}/include PRIVATE ${CMAKE_SOURCE_DIR}/include C:/SysGCC/raspberry/arm-linux-gnueabihf/sysroot/usr/local/include ) target_compile_options(Snap7-Wrapper PRIVATE -Werror ) target_link_libraries(Snap7-Wrapper snap7 ) add_executable(${PROJECT_NAME} ${SRC}) set_target_properties(${PROJECT_NAME} PROPERTIES LANGUAGES CXX CXX_STANDARD 14 CXX_STANDARD_REQUIRED ON CXX_EXTENSIONS OFF DESCRIPTION "Handles communication between PLC and clients via ZeroMQ" ) configure_file( ${PROJECT_SOURCE_DIR}/include/project_config.h.in ${PROJECT_SOURCE_DIR}/include/project_config.h ) target_include_directories(${PROJECT_NAME} PUBLIC ${PROJECT_SOURCE_DIR}/include PRIVATE ${CMAKE_SOURCE_DIR}/include ) target_compile_options(${PROJECT_NAME} PRIVATE -Werror ) target_link_libraries(${PROJECT_NAME} zmq msgpack11 Config Snap7-Wrapper systemd )
The directory with the header file that’s not being found is
C:/SysGCC/raspberry/arm-linux-gnueabihf/sysroot/usr/local/include
and it gets added to the CMakeLists.txt via this line:target_include_directories(Snap7-Wrapper PRIVATE ../../=/usr/local/include)
. I did notice that it was being inserted above the already existingtarget_include_directories
for that target, so I tried manually editing it in to the existing one but it didn’t make a difference.You mentioned making sure to utilize
${CMAKE_SYSROOT}/path/to/include
format, but I noticed that the line inserted automatically didn’t do that and instead used../../=/usr/local/include
.Do those help at all?
I also checked the VS Properties for the project and under Type it says “CMake Project”. Is this a regular CMake Project like you said and if so, how can I change it to and Advanced CMake Project?
October 8, 2019 at 23:57 in reply to: CMake project not recognizing header files in sysroot/usr/local/include #26115nOlanderParticipantI’m fairly certain I have it configured as an Advanced CMake project, but how would I tell?
I’ve tried to use the automatic header discovery and I’ll get the notification about “Found one additional include directory required by the current file”, which edits the appropriate CMake file, but it only seems to resolve the autocomplete/red squiggles error and I still get the compilation error.
If possible, I would prefer to leave the CMake files untouched as much as possible because I know they work with the directory structure on the Linux system, but I will make changes if needed. When you say “VS properties for that target”, what do you mean? I’ve selected the specific .a item in the solution explorer and added the sysroot/usr/local/include directory to the include directories list, but it hasn’t made a change in the build.
Attachments:
You must be logged in to view attached files. -
AuthorPosts