Skip to content

file ".c" extension #4333

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Testato opened this issue Dec 22, 2015 · 3 comments
Closed

file ".c" extension #4333

Testato opened this issue Dec 22, 2015 · 3 comments
Milestone

Comments

@Testato
Copy link

Testato commented Dec 22, 2015

Only ".h+.cpp" extension used under a sketch folder work.

If you try to use a .c extension for a file the Arduino IDE print some error,

Try it whit this example, it do not work but if you change the test.c to test.cpp it will work

https://drive.google.com/open?id=0Bw27MYXTb2FXR0ZpZDVLSDh6cDA

@NicoHood
Copy link
Contributor

Ha, i had the same issue today. Not sure if the issue was caused by us or the compiler.
You need to add extern "C" definitions around the included header files. Then it works.

However I noticed another error: If you rename the files the other is kept in the temporary directly for compiling and sometimes leftover. Saving fixes this, editing again breaks it again. I have no test for this though.

@matthijskooijman
Copy link
Collaborator

@Testato, as Nicohood indicated, extern "C" is needed when mixing C and C++ (.ino files are compiled as C++). Google keywords are name mangling and calling conventions. So, this behaves as expected and I will close this ticket. If we misunderstood and the problem has another cause, feel free to leave a comment so we can reopen it. If you do, be sure to include the actual error message as well.

@NicoHood, please open a new issue for that? I think I know what's going on and I recall seeing code to fix that for deleting files, but not for renaming apparently. I've been digging into that part of the code, so I can probably pick that one up.

@lmihalkovic
Copy link

@NicoHood i can confirm the behavior. It is the first issue i ran into when i started using the ide a couple months ago.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants