- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm currently working on a BLE project with PSoC 4. Since today everything worked fine. But now I'm facing the error "undefined reference to main" every time I compile my project. Didn't change anything on the project or code since the last successful compilation.
Hope you can help me.
Solved! Go to Solution.
- Labels:
-
BLE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I fixed it.
main.c wasn't compiled at all. So the linker didn't find the object file main.o. After removing main.c from the project and adding it again, it was compiled properly. But then I got the same problem for all the other files in my project. So I had to remove and add all the other files, too.
This seems to be a bug in the IDE, that should be further investigated.
- 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
You specified in main.c
extern int main(void)
Get rid of the "extern"
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That doesn't change anything. In C extern is declared implicit.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I fixed it.
main.c wasn't compiled at all. So the linker didn't find the object file main.o. After removing main.c from the project and adding it again, it was compiled properly. But then I got the same problem for all the other files in my project. So I had to remove and add all the other files, too.
This seems to be a bug in the IDE, that should be further investigated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This issue probably has to do with the way you add the files to the project. When you right click on your original main.c file, the option to compile it is grayed out. Same for the other .c files.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I added all files by right-clicking on the project -> Add -> Existing item/New item. But it just worked fine until yesterday. Didn't add any new files. It seems that something broke my project file.