- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I am writing a program for PSoC 5LP (Prototyping Kit) working with the RGB-sensor VEML6040 by Vishay.
I try to outsource most of the functions and only have the core-code remaining in the file main.c. So i created two files: veml6040.h and veml6040.c and added them to the project (in header and source files).
Extract from veml6040.h
#include "veml6040.c"
#include "main.c"
#include <project.h>
// definitions
// function headers
extract from veml6040.c
#include "veml6040.h"
uint16_t ReadSensor(uint8_t CommandCode)
{
// awesome code
}
// other functions ...
When i do so and i change the files following message appears (translated from german by me):
The file cannot be saved: (The process cannot access file "C:\Users\username\Documents\PSoC Creator\PSoC5LP-VEML6040\PSoC5LP-VEML6040.cydsn\main.c", because another process is accessing it.)
None of the files can be saved (not even main.c). Also the Build ends with the PSoC Creator crashing.
When i remove the files from the project, everything works fine again.
Can someone help me with this problem?
Best regards,
Jeroen
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That's right. There usually is a #ifdef to allow a .h file to be #included into several files of a project, see attached example.
Bob
PS: Where in Germany are you located? I live near Bremen.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Welcome in the forum.
Do not include .c files!!! just include the corresponding .h files.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you.
I don't have to include the .c file in the corresponding header?
Only the .h file in the .c file?
- 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
Thanks for your help. I will try this soon.
I am from the Ruhr area.
Best Regards
Jeroen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I just stumbled across this old forum entry.
To update my own question: I solved the problem and published the complete code open source. I'm leaving a link here if anyone searches for the VEML6040 for the PSOC 5LP and sees this post: https://github.com/J-Schaefer/veml6040
Best regard
Jeroen