Skip to content

clang version error in Insights VSCode extension on Windows #422

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
ahmedshakill opened this issue Oct 11, 2021 · 6 comments
Closed

clang version error in Insights VSCode extension on Windows #422

ahmedshakill opened this issue Oct 11, 2021 · 6 comments
Labels
awaiting-followup Waiting for more input

Comments

@ahmedshakill
Copy link

Trying to use insights vscode extension on windows .
I have added insights executable directory to path variable .

Now I have VS 2019 and clang 11 installed . But it gives this error .
I had clang 12 . Then switched to clang 11 but same error.

> Executing task: insights "f:\Code\python\Single Files\shared_ptr.cpp" > C:\Users\kingpin\AppData\Local\Temp\shared_ptr.cpp42748E73R7YC4qqBs.cpp <

Error while trying to load a compilation database:
Could not auto-detect compilation database for file "f:\Code\python\Single Files\shared_ptr.cpp"
No compilation database found in f:\Code\python\Single Files or any parent directory
fixed-compilation-database: Error while opening fixed database: no such file or directory
json-compilation-database: Error while opening JSON database: no such file or directory
Running without flags.
In file included from f:\Code\python\Single Files\shared_ptr.cpp:1:
In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\iostream:9:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\yvals_core.h:551:2: error: 
      STL1000: Unexpected compiler version, expected Clang 11.0.0 or newer.
#error STL1000: Unexpected compiler version, expected Clang 11.0.0 or newer.
 ^
1 error generated.
Error while processing f:\Code\python\Single Files\shared_ptr.cpp.
The terminal process "C:\WINDOWS\System32\cmd.exe /d /c insights "f:\Code\python\Single Files\shared_ptr.cpp" > C:\Users\kingpin\AppData\Local\Temp\shared_ptr.cpp42748E73R7YC4qqBs.cpp" terminated with exit code: 1.
@andreasfertig
Copy link
Owner

Hello @ki9gpin,

thanks for reporting this. Can you please provide a minimal working example (or is this case a not working example)?
The data provided is not enough to the your error you encountered. Thank you!

Andreas

@andreasfertig andreasfertig added the awaiting-followup Waiting for more input label Oct 12, 2021
@ahmedshakill
Copy link
Author

ahmedshakill commented Oct 12, 2021

Could you elaborate and specify "minimal working example" ? I am not sure what you are asking .
IMO my system configuration for running "isights vscode extionsion" is ok .
My workspace directory contains a single ( .cpp ) file . I was trying to run insights on that file using command pallete -> show insights but it gives the error as you can see .

@andreasfertig
Copy link
Owner

Hello @ki9gpin,

sorry I was not precise. I'm talking about ta small code snipped that leads to the error.

Andreas

@ahmedshakill
Copy link
Author

Here is my Code in shared_ptr.cpp file :

#include <iostream>
#include <vector>
#include <cstring>
#include <memory>

template
T const& max(T const & a, T const& b){
return b<a? a:b;
}

template
T const& max(T const& a, T const& b, T const& c){
return max(max(a,b),c);
}

int main()
{
// auto m1 = ::max(7,42,68);
char const* s1 = "frederic";
char const* s2 = "anica";
char const* s3 = "lucas";
auto m2 = ::max(s1,s2,s3);
std::cout<<m2;
return 0;
}

Also you can look at this picture for a clearer view
Screenshot (1135)

@andreasfertig
Copy link
Owner

Hello @ki9gpin,

thank you!

A look at yvals_core.h shows a compiler version matching for the STL version going on.

Can you try to set the define _ALLOW_COMPILER_AND_STL_VERSION_MISMATCH in the build-flags? This article says that it can be an escape hatch.

Switching your Clang version probably doesn't matter because I assume that the Clang version the error refers to is the Clang version C++ Insights was build with. That should be 12. Do you have the latest binary installed?

Andreas

@ahmedshakill
Copy link
Author

With Clang 12, defining the flag _ALLOW_COMPILER_AND_STL_VERSION_MISMATCH in my code solved the problem .

Screenshot (1136)

Thanks for developing this awesome tool

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-followup Waiting for more input
Projects
None yet
Development

No branches or pull requests

2 participants