cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeIDE: Problems with including files

FGerm.1
Associate II

I know this has been discussed before before, but for some reasons, I still can't make my project compile without having errors in it, because of including one file. I have included the path in "Paths and Symbols" tab.

Code in "main.h" file

0693W000008wq3eQAA.png 

This is the only line of code I added in the main.h file. What is inside this file is as it follows:

/*

 * Process_variables_and_parameters.h

 *

 * Created on: Mar 7, 2021

 *   Author: FredG

 */

#include <stdio.h>

#ifndef PROCESS_VARIABLES_AND_PARAMETERS_H_

#define PROCESS_VARIABLES_AND_PARAMETERS_H_

#endif /* PROCESS_VARIABLES_AND_PARAMETERS_H_ */

//variable values and their memory addresses for the EEPROM storage

//process mode

uint8_t process_mode_val = 0; //1 = manual off, 2 = manual on, 3 = auto

const uint8_t process_mode_addr = 0x00;

//operation mode

uint8_t operation_mode_val = 0; //1 = sensor mode, 2 = clock mode

const uint8_t operation_mode_addr = 0x01;

/*

 * Sensor mode operation parameters

 */

typedef struct

{

float min_humid_val;

uint8_t min_humid_addr; //= 0x02;

float max_humid_val;

uint8_t max_humid_addr; //= 0x06;

RTC_TimeTypeDef runtime;

uint8_t runtime_hours_addr; //= 0x0A;

uint8_t runtime_minutes_addr; //= 0x0B;

uint8_t runtime_seconds_addr; //= 0x0C;

RTC_TimeTypeDef delay;

uint8_t delay_hours_addr; //= 0x0D;

uint8_t delay_minutes_addr; //= 0x0E;

uint8_t delay_seconds_addr; //= 0x0F;

}sensmodeValues;

/*

 * Clock mode operation parameters

 */

typedef struct

{

RTC_TimeTypeDef runtime;

const uint8_t runtime_hours_addr; //= 0x10;

const uint8_t runtime_minutes_addr; //= 0x11;

const uint8_t runtime_seconds_addr; //= 0x12;

RTC_TimeTypeDef delay;

const uint8_t delay_hours_addr; //= 0x13;

const uint8_t delay_minutes_addr; //= 0x14;

const uint8_t delay_seconds_addr; //= 0x15;

} clockmodeValues;

/*

 * Parameters for sensor calibration

 */

typedef struct

{

uint16_t wet_val;

const uint8_t wet_addr; //= 0x16;

uint16_t dry_val;

const uint8_t dry_addr; //= 0x18;

} sens_calibValues;

Basically those are values, most of them contained inside structs. I had another case of problems with including a file in another project and both have in common that I'm defining a variable based on a struct (in the other one though, I'm just defining a time variable based on the RTC_TimeTypeDef variable type).

I'd like to know if it's because there are some errors in the code preventing compilation or something else. Thanks for the answer already.

[Edit]: Don't mind the "const" parts in the members of each struct, I took them away since I know they are a problem anyways. Even without them I get errors.

4 REPLIES 4
KnarfB
Principal III

Hi,

the fatal error says that it cannot find the .h file. Fix that first. The .h file content is irrelevant at that point. Sometimes, the error messages show in the GUI are outdated, try F5 (Refresh) and re-build. But, if the error persists, double check that you have added the correct path under "Paths and Symbols" > "Includes" for the configuaration you are building. In the Build Console, the compile lines "arm-none-eabi-gcc "../Drivers/STM ..." contain all include paths (-I) gathered from the GUI settings.

hth

KnarfB

So, I tried to refresh, but nothing really changed. Also, I can show you my Paths and Symbols GUI

0693W000008wqwoQAA.png 

I don't really know where I did something wrong, because I have other files I have included in my project that had no issues during the process. (some of them are not included yet because I haven't used them yet) and had no issues at the stage of file inclusion. Like I said before, I had his problem in another project and both have in common that I either typedef a struct or declare a variable based on a typedef that already exists. Other files have none of this.

@FGerm.1​ Notice that all your include directories are marked with ! icon. Eclipse cannot find these paths.

If the .project is in a subdirectory of your project, the relative paths should begin with ../

Or better (as Eclipse suggests) avoid relative paths. Instead always begin the paths with ${ProjDirPath} or other variable that resolves to absolute path.

-- pa

By default, stm32cubeide uses these paths, no? I don't know Eclipse that much so I'll probably be asking you a lot of questions about it. So if I want to include an absolute path, sould I just type the whole path starting from C\ in the GUI?

also, in my other projects, I also have the warning sign on the include directories in the Paths and symbols GUI