- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As part of my stereo preamplifier project, I am attempting to create messages that are stored as constants in an array of chars.
const char Inputs[6][7] = {"TUNER", "OPTICAL",
"AV", "SERVER", "PHONO", "FRONT"};
I need these messages to be stored in a global header file so elements throughout my program can access them. When I declare the above line in a c file, it compiles fine. In a header file, even if I use the extern keyword, my code does not compile.
What is the best method to declare a constant array of strings in a header file?
- Labels:
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Usually in a .g file you just declare items. This will not allocate any code, flash or sram.
In one of the files you define what has been declared. This ensures that the data is allocated only once.
So in the .h file you declare the external array and in your main.c you define as pavloven showed the arrays.
Bob