2023-10-23 05:15 AM
Hi everyone
I have a problem with cubeide
I developed my project on visual studio and insert vector library in my project know when i want compile with cubeide the error is "no such file or directory".how can i fix this problem.
Also i create c++ project in cubeide.
2023-10-23 06:21 AM
Locate the file it's looking for and ensure it's in the project path by moving it or adding its path to the project include directories.
2023-10-23 10:24 AM
That file is from the Visual Studio libraries and I think it is part of the standard C++ libraries. include <vector> Whatever I searched on the internet, I could not find it. If you have the library, please send it to me.
2023-10-23 11:10 AM
Sounds like you might be trying to include <vector> within a .c file, which isn't going to work. vectors are a C++ thing.
Perhaps show the full error message, or a screenshot. Hard to troubleshoot when you're only being given fragments of info.
2023-10-24 08:24 AM
I have put two pictures, one of which I am trying to include the vector library, the error is obvious, and the other one, without including the library, I directly called its functions in the program, but it still gave an error.
thanks for regarding dear
2023-10-24 09:47 AM
Back to what @TDK said - your main source file is "main.c" (based on the messages in the 2nd image). It must be .cpp in order to use C++ classes. Move your C++ code into a separate .cpp file, then call that function from main(). Some people try renaming "main.c" to "main.cpp" - that is OK if you never want to re-generate your code from CubeMX. But I recommend against it if you ever think you will run CubeMX again on this project.
The function in your .cpp file will need to be declared as 'extern "C"' in order to be called from main.c.
Also, you have:
#include "vector.h"
that should be:
#include <vector>
2023-10-28 04:29 AM - edited 2023-10-28 04:32 AM
thank you for your help dear, my problem is solved. but now i have another problem that when i call varient library and want to define it , it give me an error that
error: 'variant' is not a member of 'std'
please pay attention to the attached file.
thanks for regarding
2023-10-31 05:48 AM - edited 2023-10-31 05:53 AM
Hello @Sofia ,
The variant member of std is only available from C++17. So, under Properties -> C/C++ Build -> MCU G++ Compiler -> General , try to change the language standards to GNU++17 then rebuild the index.
I hope this helps !
Thanks,
Rim