cancel
Showing results for 
Search instead for 
Did you mean: 

How do I add a directory to the places VisualGDB (or similar IDE) looks for .h files?

magene
Senior II

This seems like it should be pretty straight forward but I’m still struggling. I have a project that started from the STM Nucleo413ZH RTC Calendar example. I did set it up in the embedded project wizard as a C++ project.  I changed main.c to main.cpp and I seem to be able to do C++ things like cout. Now I’m trying a use the standard C++ string library and having trouble getting all the .h files included in my project. My class that needs the string library starts like this:

#include <stm32f4xx_hal.h>
 
#include <iostream>
#include <string>
#include <cstring>
using namespace std;

But I get this error when I build: “Error bits/c++config.h: No such file or directory�? and when I click on the error it shows this line in the <string> file as the culprit:

#include <bits/c++config.h>

I can right click on <bits/c++config.h>, hit “open file�? and the file opens at:

C:\Users\gene\AppData\Local\VisualGDB\EmbeddedBSPs\arm-eabi\com.sysprogs.arm.stm32\STM32F4xxxx\STM32F4xx_HAL_Driver\Src

There are a whole bunch of .h files in bits that need to be included and it seems like I should be able to add the bits folder to the project properties C/C++ -> General -> Additional Include Directories or the Additional System Include Directories, but I sure haven’t figure out a way to make that work yet.

The really confusing thing is I have a completely different project with #include <string> that worked just fine but again, I sure can’t figure out what’s different.

And I should mention, I did try adding all the required header files one at a time and eventually go to memoryfwd.h which starts like this

#ifndef _MEMORYFWD_H
#define _MEMORYFWD_H 1
 
#pragma GCC system_header
 
//#include <bits/c++config.h>
#include <c++config.h>
namespace std _GLIBCXX_VISIBILITY(default)

And I get this error: “unknown type ‘namespace�?. I can make a copy of memoryfwd.h and rename it memoryfwd.hpp but I need to change whatever files are including memoryfwd.h to include memoryfwd.hpp. But I can’t find any files in my solution that have the term “memoryfwd.h�?.

There really has to be something fundamental about the mechanics of organizing a project that I don’t understand and haven't been able to figure out myself. I have several C/C++ books that I actually refer to, I also have the Mastering STM32 book which has been a lot of help, I’ve done a bunch of the VisualGDB tutorials and I spend a lot of time Googling for answers before I post a question.

Help will be appreciated. Thanks.

0 REPLIES 0