Repository navigation
Intellisense is not happy when separating .h and .tpp #13808
Copy link
Copy link
Closed
Labels
Language ServicebugfixedCheck the Milestone for the release in which the fix is or will be available.Check the Milestone for the release in which the fix is or will be available.quick fix
Milestone
Description
Environment
OS and Version: Windows 11 Pro 24H2
VS Code Version: 1.102.1
C/C++ Extension Version: 1.26.3
If using SSH remote, specify OS of remote machine: x
Bug Summary and Steps to Reproduce
Bug Summary: I am trying to create a template class separating its declaration in .h file and its implementation in .tpp file. Both files have #pragma once and the code compiles correctly, everything works, except the intellisense . It's arguing about redefinition error.
This error happens in my MyArray.tpp file:
redefinition of 'MyArray<T, n>'C/C++(clang-diagnostic-error)
MyArray.tpp(6, 16): previous definition is here
template<class T, size_t n> MyArray<T, n>::MyArray(std::initializer_list<T> elements)
Steps to reproduce:
- Create
include/<file>.tpp and <file>.h, createmain.cpp - write declaration and implementation code
#include "<file>.tpp"on the bottom of<file>.hand#include <file>.hon the top of<file>.tpp
Expected behavior: intellisense should not be confused. The exact code works well in Visual Studio
Configuration and Logs
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**",
"${vcpkgRoot}/x64-windows/include"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "10.0.26100.0",
"compilerPath": "cl.exe",
"cStandard": "c23",
"cppStandard": "c++23",
"intelliSenseMode": "windows-msvc-x64"
}
],
"version": 4
}
-------- Diagnostics - 8/4/2025, 6:16:10 PM
Version: 1.26.3
Current Configuration:
{
"name": "Win32",
"includePath": [
"c:/Users/bobkata75/Desktop/sandbox-cpp/**",
"E:/vcpkg/installed/x64-windows/include"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "10.0.26100.0",
"compilerPath": "cl.exe",
"cStandard": "c23",
"cppStandard": "c++23",
"intelliSenseMode": "windows-msvc-x64",
"compilerPathIsExplicit": true,
"cStandardIsExplicit": true,
"cppStandardIsExplicit": true,
"intelliSenseModeIsExplicit": true,
"recursiveIncludesReduceIsExplicit": false,
"recursiveIncludesPriorityIsExplicit": false,
"recursiveIncludesOrderIsExplicit": false,
"compilerPathInCppPropertiesJson": "cl.exe",
"mergeConfigurations": false,
"recursiveIncludes": {},
"browse": {
"limitSymbolsToIncludedHeaders": true
}
}
Modified Settings:
{
"C_Cpp.errorSquiggles": "enabled",
"C_Cpp.clang_format_style": "Google",
"C_Cpp.codeAnalysis.clangTidy.enabled": true,
"C_Cpp.codeAnalysis.clangTidy.path": "C:/Users/bobkata75/.vscode/extensions/ms-vscode.cpptools-1.26.3-win32-x64/LLVM/bin/clang-tidy.exe",
"C_Cpp.loggingLevel": "Debug"
}
Additional Tracked Settings:
{
"editorTabSize": 4,
"editorInsertSpaces": true,
"editorAutoClosingBrackets": "languageDefined",
"filesEncoding": "utf8",
"filesAssociations": {
"xstring": "cpp",
"atomic": "cpp",
"bit": "cpp",
"cctype": "cpp",
"charconv": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"compare": "cpp",
"concepts": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"exception": "cpp",
"format": "cpp",
"initializer_list": "cpp",
"ios": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"iterator": "cpp",
"limits": "cpp",
"locale": "cpp",
"memory": "cpp",
"new": "cpp",
"ostream": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"string": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"typeinfo": "cpp",
"utility": "cpp",
"xfacet": "cpp",
"xiosbase": "cpp",
"xlocale": "cpp",
"xlocbuf": "cpp",
"xlocinfo": "cpp",
"xlocmes": "cpp",
"xlocmon": "cpp",
"xlocnum": "cpp",
"xloctime": "cpp",
"xmemory": "cpp",
"xtr1common": "cpp",
"xutility": "cpp"
},
"filesExclude": {
"**/.git": false,
"**/.svn": true,
"**/.hg": true,
"**/.DS_Store": true,
"**/Thumbs.db": true
},
"filesAutoSaveAfterDelay": true,
"editorInlayHintsEnabled": true,
"editorParameterHintsEnabled": true,
"searchExclude": {
"**/node_modules": true,
"**/bower_components": true,
"**/*.code-search": true
},
"workbenchSettingsEditor": "ui"
}
cpptools version (native): 1.26.3.0
Current database path: C:\USERS\BOBKATA75\APPDATA\LOCAL\MICROSOFT\VSCODE-CPPTOOLS\E2D454233DDEB24056A7678759803B1E\.BROWSE.VC.DB
Translation Unit Mappings:
[ C:\Users\bobkata75\Desktop\sandbox-cpp\src\main.cpp - source TU]:
Translation Unit Configurations:
[ C:\Users\bobkata75\Desktop\sandbox-cpp\src\main.cpp ]
Process ID: 11732
Memory Usage: 229 MB
Compiler Path: C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.44.35207\bin\Hostx64\x64\cl.exe
Include paths:
include: E:\vcpkg\installed\x64-windows\include
include: C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.44.35207\include
include: C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include
include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\ucrt
include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\um
include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\shared
include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\winrt
include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\cppwinrt
system include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\um
system include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\ucrt
system include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\shared
system include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\winrt
system include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\cppwinrt
Defines:
_DEBUG
UNICODE
_UNICODE
Standard Version: ms_c++23
IntelliSense Mode: windows-msvc-x64
Other Flags:
--using_directory
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.44.35207\lib\x86
--using_directory
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.44.35207\lib\x86\store\references
--using_directory
C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.26100.0
--using_directory
C:\Program Files (x86)\Windows Kits\10\References\10.0.26100.0
--using_directory
C:\Windows\Microsoft.NET\Framework\v4.0.30319
Total Memory Usage: 229 MB
------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 5207
loggingLevel: 6
loggingLevel has changed to: Debug
Shutting down IntelliSense server: C:\Users\bobkata75\Desktop\sandbox-cpp\include\MyArray.tpp
LSP: (received) cpptools/didChangeCppProperties (id: 28)
LSP: (invoked) cpptools/didChangeCppProperties (id: 28)
Attempting to get defaults from C compiler in "compilerPath" property: 'cl.exe'
Attempting to get defaults from C++ compiler in "compilerPath" property: 'cl.exe'
Expanding recursive includes for: C:\USERS\BOBKATA75\DESKTOP\SANDBOX-CPP\INCLUDE\MYARRAY.TPP
Done expanding recursive includes for: C:\USERS\BOBKATA75\DESKTOP\SANDBOX-CPP\INCLUDE\MYARRAY.TPP
Reducing recursive includes for: C:\USERS\BOBKATA75\DESKTOP\SANDBOX-CPP\INCLUDE\MYARRAY.TPP
Folder: C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2022\BUILDTOOLS\VC\AUXILIARY\VS\INCLUDE will be indexed
Folder: C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2022\BUILDTOOLS\VC\TOOLS\MSVC\14.44.35207\INCLUDE will be indexed
Folder: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.26100.0\CPPWINRT will be indexed
Folder: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.26100.0\SHARED will be indexed
Folder: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.26100.0\UCRT will be indexed
Folder: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.26100.0\UM will be indexed
Folder: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.26100.0\WINRT will be indexed
Folder: C:\USERS\BOBKATA75\DESKTOP\SANDBOX-CPP will be indexed
Folder: E:\VCPKG\INSTALLED\X64-WINDOWS\INCLUDE will be indexed
LSP: Sending response (id: 28)
Done reducing recursive includes for: C:\USERS\BOBKATA75\DESKTOP\SANDBOX-CPP\INCLUDE\MYARRAY.TPP
Expanding recursive includes for: C:\USERS\BOBKATA75\DESKTOP\SANDBOX-CPP\INCLUDE\MYARRAY.TPP
Done expanding recursive includes for: C:\USERS\BOBKATA75\DESKTOP\SANDBOX-CPP\INCLUDE\MYARRAY.TPP
Reducing recursive includes for: C:\USERS\BOBKATA75\DESKTOP\SANDBOX-CPP\INCLUDE\MYARRAY.TPP
C:/Users/bobkata75/.vscode/extensions/ms-vscode.cpptools-1.26.3-win32-x64/LLVM/bin/clang-tidy.exe
--header-filter=(C:/Users/bobkata75/Desktop/sandbox-cpp|C:\\Users\\bobkata75\\Desktop\\sandbox-cpp)
--export-fixes=C:\Users\BOBKAT~1\AppData\Local\Temp\{15092845776348287165}\fixes24260.yaml
--quiet
--use-color=false
C:/Users/bobkata75/Desktop/sandbox-cpp/include/MyArray.tpp
--
-std=c++23
-xc++
-Wno-pragma-pack
-Wno-pragma-once-outside-header
-D_DEBUG
-DUNICODE
-D_UNICODE
-IE:/vcpkg/installed/x64-windows/include
-IC:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.44.35207/include
-IC:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Auxiliary/VS/include
-isystemC:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/um
-isystemC:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/ucrt
-isystemC:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/shared
-isystemC:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/winrt
-isystemC:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/cppwinrt
Done reducing recursive includes for: C:\USERS\BOBKATA75\DESKTOP\SANDBOX-CPP\INCLUDE\MYARRAY.TPP
Error while processing C:\Users\bobkata75\Desktop\sandbox-cpp\include\MyArray.tpp.
C:\Users\bobkata75\Desktop\sandbox-cpp\include\MyArray.tpp:6:16: error: redefinition of 'MyArray<T, n>' [clang-diagnostic-error]
6 | MyArray<T, n>::MyArray(std::initializer_list<T> elements)
| ^
C:\Users\bobkata75\Desktop\sandbox-cpp\include\MyArray.tpp:6:16: note: previous definition is here
C:\Users\bobkata75\Desktop\sandbox-cpp\include\MyArray.tpp:16:19: error: redefinition of 'at' [clang-diagnostic-error]
16 | T& MyArray<T, n>::at(size_t i) {
| ^
C:\Users\bobkata75\Desktop\sandbox-cpp\include\MyArray.tpp:16:19: note: previous definition is here
C:\Users\bobkata75\Desktop\sandbox-cpp\include\MyArray.tpp:24:19: error: redefinition of 'front' [clang-diagnostic-error]
24 | T& MyArray<T, n>::front() {
| ^
C:\Users\bobkata75\Desktop\sandbox-cpp\include\MyArray.tpp:24:19: note: previous definition is here
C:\Users\bobkata75\Desktop\sandbox-cpp\include\MyArray.tpp:29:19: error: redefinition of 'back' [clang-diagnostic-error]
29 | T& MyArray<T, n>::back() {
| ^
C:\Users\bobkata75\Desktop\sandbox-cpp\include\MyArray.tpp:29:19: note: previous definition is here
C:\Users\bobkata75\Desktop\sandbox-cpp\include\MyArray.tpp:34:19: error: redefinition of 'data' [clang-diagnostic-error]
34 | T* MyArray<T, n>::data() {
| ^
C:\Users\bobkata75\Desktop\sandbox-cpp\include\MyArray.tpp:34:19: note: previous definition is here
C:\Users\bobkata75\Desktop\sandbox-cpp\include\MyArray.tpp:39:21: error: redefinition of 'empty' [clang-diagnostic-error]
39 | bool MyArray<T, n>::empty() const {
| ^
C:\Users\bobkata75\Desktop\sandbox-cpp\include\MyArray.tpp:39:21: note: previous definition is here
C:\Users\bobkata75\Desktop\sandbox-cpp\include\MyArray.tpp:44:23: error: redefinition of 'size' [clang-diagnostic-error]
44 | size_t MyArray<T, n>::size() const {
| ^
C:\Users\bobkata75\Desktop\sandbox-cpp\include\MyArray.tpp:44:23: note: previous definition is here
C:\Users\bobkata75\Desktop\sandbox-cpp\include\MyArray.tpp:50:23: error: redefinition of 'max_size' [clang-diagnostic-error]
50 | size_t MyArray<T, n>::max_size() const {
| ^
C:\Users\bobkata75\Desktop\sandbox-cpp\include\MyArray.tpp:50:23: note: previous definition is here
C:\Users\bobkata75\Desktop\sandbox-cpp\include\MyArray.tpp:55:21: error: redefinition of 'fill' [clang-diagnostic-error]
55 | void MyArray<T, n>::fill(T& el) {
| ^
C:\Users\bobkata75\Desktop\sandbox-cpp\include\MyArray.tpp:55:21: note: previous definition is here
C:\Users\bobkata75\Desktop\sandbox-cpp\include\MyArray.tpp:63:58: error: redefinition of 'begin' [clang-diagnostic-error]
63 | typename MyArray<T, n>::MyArrayIterrator MyArray<T, n>::begin() {
| ^
C:\Users\bobkata75\Desktop\sandbox-cpp\include\MyArray.tpp:63:58: note: previous definition is here
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) textDocument/didOpen: file:///c%3A/Users/bobkata75/Desktop/sandbox-cpp/src/main.cpp
LSP: (invoked) textDocument/didOpen: file:///c%3A/Users/bobkata75/Desktop/sandbox-cpp/src/main.cpp
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
Intellisense update pending for: file:///c%3A/Users/bobkata75/Desktop/sandbox-cpp/src/main.cpp
Expanding recursive includes for: C:\USERS\BOBKATA75\DESKTOP\SANDBOX-CPP\SRC\MAIN.CPP
Done expanding recursive includes for: C:\USERS\BOBKATA75\DESKTOP\SANDBOX-CPP\SRC\MAIN.CPP
Reducing recursive includes for: C:\USERS\BOBKATA75\DESKTOP\SANDBOX-CPP\SRC\MAIN.CPP
LSP: (received) cpptools/didChangeActiveEditor: file:///c%3A/Users/bobkata75/Desktop/sandbox-cpp/src/main.cpp
LSP: (invoked) cpptools/didChangeActiveEditor: file:///c%3A/Users/bobkata75/Desktop/sandbox-cpp/src/main.cpp
LSP: (received) cpptools/getCodeActions: file:///c%3A/Users/bobkata75/Desktop/sandbox-cpp/src/main.cpp (id: 29)
LSP: (invoked) cpptools/getCodeActions: file:///c%3A/Users/bobkata75/Desktop/sandbox-cpp/src/main.cpp (id: 29)
LSP: (received) cpptools/getDocumentSymbols: file:///c%3A/Users/bobkata75/Desktop/sandbox-cpp/src/main.cpp (id: 30)
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: Sending response (id: 29)
LSP: (invoked) cpptools/getDocumentSymbols: file:///c%3A/Users/bobkata75/Desktop/sandbox-cpp/src/main.cpp (id: 30)
LSP: (invoked) cpptools/didChangeTextEditorSelection
Done reducing recursive includes for: C:\USERS\BOBKATA75\DESKTOP\SANDBOX-CPP\SRC\MAIN.CPP
C:/Users/bobkata75/.vscode/extensions/ms-vscode.cpptools-1.26.3-win32-x64/LLVM/bin/clang-tidy.exe
--header-filter=(C:/Users/bobkata75/Desktop/sandbox-cpp|C:\\Users\\bobkata75\\Desktop\\sandbox-cpp)
--export-fixes=C:\Users\BOBKAT~1\AppData\Local\Temp\{15092845776348287165}\fixes8676.yaml
--quiet
--use-color=false
C:/Users/bobkata75/Desktop/sandbox-cpp/src/main.cpp
--
-std=c++23
-xc++
-Wno-pragma-pack
-Wno-pragma-once-outside-header
-D_DEBUG
-DUNICODE
-D_UNICODE
-IE:/vcpkg/installed/x64-windows/include
-IC:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.44.35207/include
-IC:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Auxiliary/VS/include
-isystemC:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/um
-isystemC:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/ucrt
-isystemC:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/shared
-isystemC:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/winrt
-isystemC:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/cppwinrt
LSP: Sending response (id: 30)
IntelliSense update scheduled and TU acquisition started for: file:///c%3A/Users/bobkata75/Desktop/sandbox-cpp/src/main.cpp
Expanding recursive includes for: C:\USERS\BOBKATA75\DESKTOP\SANDBOX-CPP\SRC\MAIN.CPP
Done expanding recursive includes for: C:\USERS\BOBKATA75\DESKTOP\SANDBOX-CPP\SRC\MAIN.CPP
Reducing recursive includes for: C:\USERS\BOBKATA75\DESKTOP\SANDBOX-CPP\SRC\MAIN.CPP
Done reducing recursive includes for: C:\USERS\BOBKATA75\DESKTOP\SANDBOX-CPP\SRC\MAIN.CPP
LSP: (received) cpptools/getCodeActions: file:///c%3A/Users/bobkata75/Desktop/sandbox-cpp/src/main.cpp (id: 31)
LSP: (invoked) cpptools/getCodeActions: file:///c%3A/Users/bobkata75/Desktop/sandbox-cpp/src/main.cpp (id: 31)
LSP: Sending response (id: 31)
sending compilation args for C:\Users\bobkata75\Desktop\sandbox-cpp\src\main.cpp
include: E:\VCPKG\INSTALLED\X64-WINDOWS\INCLUDE
include: C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2022\BUILDTOOLS\VC\TOOLS\MSVC\14.44.35207\INCLUDE
include: C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2022\BUILDTOOLS\VC\AUXILIARY\VS\INCLUDE
include: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.26100.0\UCRT
include: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.26100.0\UM
include: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.26100.0\SHARED
include: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.26100.0\WINRT
include: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.26100.0\CPPWINRT
system include: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.26100.0\UM
system include: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.26100.0\UCRT
system include: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.26100.0\SHARED
system include: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.26100.0\WINRT
system include: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.26100.0\CPPWINRT
define: _DEBUG
define: UNICODE
define: _UNICODE
other: --using_directory
other: C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.44.35207\lib\x86
other: --using_directory
other: C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.44.35207\lib\x86\store\references
other: --using_directory
other: C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.26100.0
other: --using_directory
other: C:\Program Files (x86)\Windows Kits\10\References\10.0.26100.0
other: --using_directory
other: C:\Windows\Microsoft.NET\Framework\v4.0.30319
stdver: ms_c++23
intelliSenseMode: windows-msvc-x64
LSP: (received) cpptools/getFoldingRanges: file:///c%3A/Users/bobkata75/Desktop/sandbox-cpp/src/main.cpp (id: 32)
LSP: (invoked) cpptools/getFoldingRanges: file:///c%3A/Users/bobkata75/Desktop/sandbox-cpp/src/main.cpp (id: 32)
LSP: Sending response (id: 32)
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (invoked) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/getCodeActions: file:///c%3A/Users/bobkata75/Desktop/sandbox-cpp/src/main.cpp (id: 33)
LSP: (invoked) cpptools/getCodeActions: file:///c%3A/Users/bobkata75/Desktop/sandbox-cpp/src/main.cpp (id: 33)
LSP: Sending response (id: 33)
Update IntelliSense time (sec): 2.196
LSP: (received) cpptools/getFoldingRanges: file:///c%3A/Users/bobkata75/Desktop/sandbox-cpp/src/main.cpp (id: 34)
LSP: (invoked) cpptools/getFoldingRanges: file:///c%3A/Users/bobkata75/Desktop/sandbox-cpp/src/main.cpp (id: 34)
LSP: Sending response (id: 34)
LSP: (received) cpptools/getFoldingRanges: file:///c%3A/Users/bobkata75/Desktop/sandbox-cpp/src/main.cpp (id: 35)
LSP: (invoked) cpptools/getFoldingRanges: file:///c%3A/Users/bobkata75/Desktop/sandbox-cpp/src/main.cpp (id: 35)
LSP: Sending response (id: 35)
LSP: (received) cpptools/getDiagnostics (id: 36)
LSP: (invoked) cpptools/getDiagnostics (id: 36)
LSP: Sending response (id: 36)
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditorsOther Extensions
No response
Additional context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Language ServicebugfixedCheck the Milestone for the release in which the fix is or will be available.Check the Milestone for the release in which the fix is or will be available.quick fix
Type
Projects
- StatusShow more project fieldsDone
Activity
bhubavenski commentedon Aug 4, 2025
I think the problem is that clang-tidy.exe runs for MyArray.tpp
sean-mcmanus commentedon Aug 4, 2025
Boris Hubavenski (@bhubavenski) The .txx is missing from our code that handles C++ header extensions so it's incorrectly create a separate TU for the .txx instead of using the .cpp, which works if the .txx file is .tcc instead.
bhubavenski commentedon Aug 4, 2025
Sean McManus (@sean-mcmanus) Hello! I tried your advice to use
.tcc, but doesn't seems to do anything different than just changing the file icon fromc++toh++( because of the material icons extension ). The error of type "redefinition of ... " is still there. Interestingly I also tried your advice on a fresh new project and there it worked correct, no errors, but both projects are bare bones and both have same configuration in them, there are really no big difference. Why in the one it works and on the other it doesn't? I see that on the one where are the erros, clang-tidy tries to compile thetccfile, but in the other project it doesn'tbhubavenski commentedon Aug 4, 2025
Also, I noticed that the .tcc file is not recognized as C++ syntax but as plain text. I already tried switching the language mode manually, which works, but is there anything else I should configure to make the C++ extension work properly with this file type? IntelliSense seems to work for now, but I’m wondering if there are other settings I should adjust to ensure full support.
bhubavenski commentedon Aug 4, 2025
also the automatic option for "Code Analysis" is not exactly automatic, or its mostly random. Sometimes its triggered automatically and sometimes its triggered on
CTRL + Sand sometimes I need to trigger it manuallysean-mcmanus commentedon Aug 5, 2025
Boris Hubavenski (@bhubavenski) You can set files.associations for .tcc/.tpp/.txx .
The runAutomatically applies when a file is opened or saved.
If you see issues with the .tcc file, what do you see when run C/C++: Log Diagnostics in regards to which TU is being created, i.e. are you seeing the .tcc file get it's own TU? Does another .cpp file include that .tcc file? It's supposed to create a TU with just the .cpp file.
sean-mcmanus commentedon Aug 7, 2025
Boris Hubavenski (@bhubavenski) Fixed with https://github.com/microsoft/vscode-cpptools/releases/tag/v1.27.0 . Let us know if you still have an issue since we may have not had the same repro scenario.