Hi, sorry for the newbie question...
Just asking if it's possibile to mix arduino libraries (written in cpp ?) with standard c; like in project started in vs code with the esp-idf estension.
I tryied a project using arduino as component with the extern 'C' in the main.cpp but I can't compile, the compiler won't find Arduino.h even if it's in the include path.
I just need to drive a stepper with a ULN2003A and I cant find nothing in c. All examples are with the Stepper.h from Arduino.
Thanks in advance
Using arduino libraries for ESP32 in visual studio code.
Re: Using arduino libraries for ESP32 in visual studio code.
I had similar errors when compiling my code with arduino-as-component package in VS Code. The issue I found and fixed is in top level CMakeList.txt file. The 'EXTRA_COMPONENT_DIRS' would not accept relative path to my "arduino-as-component/components" folder. But if I set full path, my code would compile. Try it out.
-
- Posts: 21
- Joined: Mon Sep 20, 2021 9:13 am
Re: Using arduino libraries for ESP32 in visual studio code.
Hello, yes it is possible....But, But....
Make sure you're using the correct include paths – Arduino libraries will generally be located in a different location than standard C libraries, so you'll need to make sure you're using the correct include paths to find the Arduino header files. You can do this by adding the path to the Arduino libraries to the include path in your build system or by using the #includedirective with the full path to the Arduino header files.
Make sure you're linking to the correct libraries – If you're using functions from the Arduino libraries that are implemented in separate object files, you'll need to make sure you're linking to the correct libraries. This can usually be done by specifying the path to the Arduino libraries in the linker flags or by using the appropriate build system commands to link the libraries.
Make sure you're using the correct data types and function prototypes: Arduino libraries can use different data types and function prototypes than standard C libraries, so you'll need to make sure you're using the correct data types and function prototypes. correct functions when calling Arduino functions from your standard C code. You can usually find the correct data types and function prototypes in the Arduino header files.
If you're still having trouble mixing the Arduino libraries with standard C code, it might be helpful to consult the documentation for the Arduino libraries and the build system you're using to see if there are any additional steps you need to take.
regards
Make sure you're using the correct include paths – Arduino libraries will generally be located in a different location than standard C libraries, so you'll need to make sure you're using the correct include paths to find the Arduino header files. You can do this by adding the path to the Arduino libraries to the include path in your build system or by using the #includedirective with the full path to the Arduino header files.
Make sure you're linking to the correct libraries – If you're using functions from the Arduino libraries that are implemented in separate object files, you'll need to make sure you're linking to the correct libraries. This can usually be done by specifying the path to the Arduino libraries in the linker flags or by using the appropriate build system commands to link the libraries.
Make sure you're using the correct data types and function prototypes: Arduino libraries can use different data types and function prototypes than standard C libraries, so you'll need to make sure you're using the correct data types and function prototypes. correct functions when calling Arduino functions from your standard C code. You can usually find the correct data types and function prototypes in the Arduino header files.
If you're still having trouble mixing the Arduino libraries with standard C code, it might be helpful to consult the documentation for the Arduino libraries and the build system you're using to see if there are any additional steps you need to take.
regards
Re: Using arduino libraries for ESP32 in visual studio code.
I think you can cross-check your steps with this tutorial: https://randomnerdtutorials.com/vs-code ... 6-arduino/
Errors may occur if necessary files are missing.
Errors may occur if necessary files are missing.
Who is online
Users browsing this forum: No registered users and 94 guests