This is a very common issue in QT. Include header files and then get the error.
No such file or directory
How to reproduce the issue:
First I'm using the CAN Bus Open SAE J1939 library
Then I include the source and headers like this.
SOURCES +=
Communication/Database/databasehandling.cpp
Tool/Json/jsonhandling.cpp
main.cpp
Window/Main/mainwindow.cpp
Communication/USB/usb.cpp
Tool/CAN/Hardware/CAN_Network/CAN_Network.c
Tool/CAN/Hardware/Memory/FLASH_EEPROM_RAM_Memory.c
Tool/CAN/ISO_11783/ISO_11783-7_Application_Layer/Auxiliary_Valve_Command.c
Tool/CAN/ISO_11783/ISO_11783-7_Application_Layer/Auxiliary_Valve_Estimated_Flow.c
Tool/CAN/ISO_11783/ISO_11783-7_Application_Layer/Auxiliary_Valve_Measured_Position.c
Tool/CAN/ISO_11783/ISO_11783-7_Application_Layer/General_Purpose_Valve_Command.c
Tool/CAN/ISO_11783/ISO_11783-7_Application_Layer/General_Purpose_Valve_Estimated_Flow.c
Tool/CAN/Open_SAE_J1939/Listen_For_Messages.c
Tool/CAN/SAE_J1939/SAE_J1939-21_Transport_Layer/Acknowledgement.c
Tool/CAN/SAE_J1939/SAE_J1939-21_Transport_Layer/Request.c
Tool/CAN/SAE_J1939/SAE_J1939-21_Transport_Layer/Transport_Protocol_Connection_Management.c
Tool/CAN/SAE_J1939/SAE_J1939-21_Transport_Layer/Transport_Protocol_Data_Transfer.c
Tool/CAN/SAE_J1939/SAE_J1939-71_Application_Layer/Request_Component_Identification.c
Tool/CAN/SAE_J1939/SAE_J1939-71_Application_Layer/Request_ECU_Identification.c
Tool/CAN/SAE_J1939/SAE_J1939-71_Application_Layer/Request_Software_Identification.c
Tool/CAN/SAE_J1939/SAE_J1939-73_Diagnostics_Layer/DM1.c
Tool/CAN/SAE_J1939/SAE_J1939-73_Diagnostics_Layer/DM2.c
Tool/CAN/SAE_J1939/SAE_J1939-73_Diagnostics_Layer/DM3.c
Tool/CAN/SAE_J1939/SAE_J1939-73_Diagnostics_Layer/DM14.c
Tool/CAN/SAE_J1939/SAE_J1939-73_Diagnostics_Layer/DM15.c
Tool/CAN/SAE_J1939/SAE_J1939-73_Diagnostics_Layer/DM16.c
Tool/CAN/SAE_J1939/SAE_J1939-81_Network_Management_Layer/Address_Claimed.c
Tool/CAN/SAE_J1939/SAE_J1939-81_Network_Management_Layer/Address_Delete.c
Tool/CAN/SAE_J1939/SAE_J1939-81_Network_Management_Layer/Address_Not_Claimed.c
Tool/CAN/SAE_J1939/SAE_J1939-81_Network_Management_Layer/Commanded_Address.c
HEADERS +=
Communication/Database/databasehandling.h
Tool/Json/jsonhandling.h
Window/Main/mainwindow.h
Communication/USB/usb.h
Tool/CAN/Hardware/CAN_Network/CAN_Network.h
Tool/CAN/Hardware/Memory/FLASH_EEPROM_RAM_Memory.h
Tool/CAN/Hardware/Processor_choice.h
Tool/CAN/ISO_11783/ISO_11783_Enums/Enum_Auxiliary_And_General_Purpose_Valves.h
Tool/CAN/ISO_11783/ISO_11783-7_Application_Layer/Application_Layer.h
Tool/CAN/Open_SAE_J1939/Open_SAE_J1939.h
Tool/CAN/Open_SAE_J1939/Structs.h
Tool/CAN/SAE_J1939/SAE_J1939_Enums/Enum_Control_Byte.h
Tool/CAN/SAE_J1939/SAE_J1939_Enums/Enum_DM1_DM2.h
Tool/CAN/SAE_J1939/SAE_J1939_Enums/Enum_DM14_DM15.h
Tool/CAN/SAE_J1939/SAE_J1939_Enums/Enum_Group_Function_Value.h
Tool/CAN/SAE_J1939/SAE_J1939_Enums/Enum_NAME.h
Tool/CAN/SAE_J1939/SAE_J1939_Enums/Enum_PGN.h
Tool/CAN/SAE_J1939/SAE_J1939_Enums/Enum_Send_Status.h
Tool/CAN/SAE_J1939/SAE_J1939-21_Transport_Layer/Transport_Layer.h
Tool/CAN/SAE_J1939/SAE_J1939-71_Application_Layer/Application_Layer.h
Tool/CAN/SAE_J1939/SAE_J1939-73_Diagnostics_Layer/Diagnostics_Layer.h
Tool/CAN/SAE_J1939/SAE_J1939-81_Network_Management_Layer/Network_Management_Layer.h
But still I get one error in the Transport_Layer.h
file
#ifndef SAE_J1939_21_TRANSPORT_LAYER_SAE_J1939_21_TRANSPORT_LAYER_H_
#define SAE_J1939_21_TRANSPORT_LAYER_SAE_J1939_21_TRANSPORT_LAYER_H_
/* Layers */
#include "../../Hardware/CAN_Network/CAN_Network.h"
#include "../../Open_SAE_J1939/Structs.h"
#include "../SAE_J1939-71_Application_Layer/Application_Layer.h"
#include "../SAE_J1939-73_Diagnostics_Layer/Diagnostics_Layer.h"
#include "../SAE_J1939-81_Network_Management_Layer/Network_Management_Layer.h" <--- This one
#include "../SAE_J1939_Enums/Enum_Control_Byte.h"
#include "../SAE_J1939_Enums/Enum_DM1_DM2.h"
#include "../SAE_J1939_Enums/Enum_DM14_DM15.h"
#include "../SAE_J1939_Enums/Enum_Group_Function_Value.h"
#include "../SAE_J1939_Enums/Enum_NAME.h"
#include "../SAE_J1939_Enums/Enum_PGN.h"
#include "../SAE_J1939_Enums/Enum_Send_Status.h"
And one inside Application_Layer.h
file
#ifndef ISO_11783_ISO_11783_7_APPLICATION_LAYER_ISO_11783_7_APPLICATION_LAYER_H_
#define ISO_11783_ISO_11783_7_APPLICATION_LAYER_ISO_11783_7_APPLICATION_LAYER_H_
/* Layers */
#include "../../Hardware/CAN_Network/CAN_Network.h"
#include "../../ISO_11783/ISO_11783_Enums/Enum_Auxiliary_And_General_Purpose_Valves.h" <-- This one
#include "../../Open_SAE_J1939/Structs.h"
#include "../../SAE_J1939/SAE_J1939-21_Transport_Layer/Transport_Layer.h"
#include "../../SAE_J1939/SAE_J1939_Enums/Enum_PGN.h"
Question:
Why does this happening?
I have included. The QT Creator IDE sees the files. No problem there. But still, the compiler seems not to understand the existens of these files.
I'm using QT 5.15.2 and C++11.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…