Config broken after visual install

General questions regarding the usage of CodeLite
Jarod42
CodeLite Expert
Posts: 197
Joined: Wed Sep 30, 2009 5:54 pm
Genuine User: Yes
IDE Question: C++
Location: France
Contact:

Config broken after visual install

Post by Jarod42 »

After installing visual studio, my Codelite shows me red arrows (for errors) even if I didn't change setup (I only use Mingw gcc/clang via msys2).

Not sure how to configure "stuff" (CL intellisense, clang?) to don't use visual studio header.

(one error shown is in visual studio path `<intrin.h>` when I include `<sstream>`)

Projects compile fine BTW.
Removing codelite user data doesn't fix the issue neither.

Any idea?
User avatar
eranif
CodeLite Plugin
Posts: 6143
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Config broken after visual install

Post by eranif »

Visit:

First, check that you have clangd running as a child process of CodeLite

Next, go to:
- Plugins -> Language Server -> Settings
- Select the `clangd` tab (you should have one)
- Paste the command here

If this is a standard C++ project (not a file system workspace etc), you should have a `compile_flags.txt` file(s) at the root folder of each project and one at the workspace folder.

These files are auto generated by CodeLilte and are used by clangd to instruct it how to build your sources.
the content is taken from the projects you have in the workspace.

Check that the content contains all the info required to build your source files.

Let's say that in project PROJECT_A you have file named file.cpp and this is the command required to build it:

Code: Select all

gcc -c file.cpp -o file.o -DMY_MACRO -IC:\includes -IC:\boost_174
Then, you should have a file named compile_flags.txt at the same folder where PROJECT_A.project file exists.
This file should include:

Code: Select all

-IC:\includes
-IC:\boost_174
-DMY_MACRO
...
-target
x86_64-pc-windows-gnu
- the `...` means: your gcc compiler include paths.
- if you don't see the last two lines (-target && x86_64-pc-windows-gnu), then your project selected compiler is set to a non GCC/MinGW one
Make sure you have read the HOW TO POST thread
Jarod42
CodeLite Expert
Posts: 197
Joined: Wed Sep 30, 2009 5:54 pm
Genuine User: Yes
IDE Question: C++
Location: France
Contact:

Re: Config broken after visual install

Post by Jarod42 »

I see `clangd` as child of Codelite.
>"C:\Program Files\CodeLite\lsp\clangd.exe" -limit-results=500 -header-insertion-decorators=0
clangd is a language server that provides IDE-like features to editors.

It should be used via an editor plugin rather than invoked directly. For more information, see:
https://clang.llvm.org/extra/clangd/
https://microsoft.github.io/language-server-protocol/

clangd accepts flags on the commandline, and in the CLANGD_FLAGS environment variable.

I[15:39:51.126] clangd version 10.0.0
I[15:39:51.128] Working directory: C:\Users\XXX
I[15:39:51.129] argv[0]: C:\Program Files\CodeLite\lsp\clangd.exe
I[15:39:51.129] argv[1]: -limit-results=500
I[15:39:51.129] argv[2]: -header-insertion-decorators=0
I[15:39:51.130] Starting LSP over stdin/stdout
compile_flags.txt is present:
-IC:\msys64\mingw64\include\c++\10.1.0
-IC:\msys64\mingw64\include\c++\10.1.0\x86_64-w64-mingw32
-IC:\msys64\mingw64\include\c++\10.1.0\backward
-IC:\msys64\mingw64\lib\gcc\x86_64-w64-mingw32\10.1.0\include
-IC:\msys64\mingw64\include
-IC:\msys64\mingw64\lib\gcc\x86_64-w64-mingw32\10.1.0\include-fixed
-IC:\msys64\mingw64\x86_64-w64-mingw32\include
-IC:\Users\XXX\Code\Maxr\project\codelite
-IC:\msys64\mingw64\include\SDL2
-IC:\Users\XXX\Code\Maxr\maxr
-IC:\Users\XXX\Code\Maxr\maxr\src
-DWIN32
-D_USE_MATH_DEFINES
-DNDEBUG
-std=c++14
-target
x86_64-pc-windows-gnu
So all seems fine...

Note: My projects are created by premake.
Last edited by Jarod42 on Wed Mar 17, 2021 5:12 pm, edited 1 time in total.
User avatar
eranif
CodeLite Plugin
Posts: 6143
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Config broken after visual install

Post by eranif »

do you get any errors in codelite.log file?
enable debugging from settings -> preferences -> misc -> log

the log file is under: %appdata%\codelite\codelite.log
Make sure you have read the HOW TO POST thread
Jarod42
CodeLite Expert
Posts: 197
Joined: Wed Sep 30, 2009 5:54 pm
Genuine User: Yes
IDE Question: C++
Location: France
Contact:

Re: Config broken after visual install

Post by Jarod42 »

Log level is set to ERROR

log content is similar a repetition of:
[13:15:20:762 SYS] [Main] toolbar button changed state to Stop Current Build
[13:15:29:350 SYS] [Main] toolbar button changed state to Build Active Project
[11:27:42:303 SYS] [Main] MSYS environment detected

[11:27:42:444 SYS] [Main] MSYS Root folder is set to: C:/msys64/
There are some
[14:04:21:881 ERR] WriteFile error: 0
By setting LOG to Developper, it is very more verbose, I don't find anything suspect, clangd gives
[13:56:19:398 DBG] [Main] Connecting to LSP server: clangd
[13:56:19:399 DBG] [Main] Handler: LSP: clangd registerd. Priority: 50 . Type: 0
[13:56:19:401 DBG] [Main] Service providers: BuiltIn C++ Code Completion(75) LSP: clangd(50)
[13:56:19:402 DBG] [Main] sorting providers for type: 0
[13:56:19:403 DBG] [Main] Service providers: LSP: clangd(90) BuiltIn C++ Code Completion(75)
[13:56:19:405 DBG] [Main] Starting lsp:
[13:56:19:406 DBG] [Main] Connection string: stdio
[13:56:19:407 DBG] [Main] lspCommand: [C:\Program Files\CodeLite\lsp\clangd.exe, -limit-results=500, -header-insertion-decorators=0]
[13:56:19:409 DBG] [Main] entry.GetWorkingDirectory():
[13:56:19:410 DBG] [Main] rootDir: C:\Users\XXX\Code\Maxr\project\codelite
[13:56:19:411 DBG] [Main] entry.GetLanguages(): [c, cpp]
[13:56:19:412 DBG] [Main] [clangd] Starting...
[13:56:19:413 DBG] [Main] [clangd] Command: [C:\Program Files\CodeLite\lsp\clangd.exe, -limit-results=500, -header-insertion-decorators=0]
[13:56:19:414 DBG] [Main] [clangd] Root folder: C:\Users\XXX\Code\Maxr\project\codelite
[13:56:19:415 DBG] [Main] [clangd] Language: cpp
[13:56:19:416 DBG] [Main] [clangd] Language: c
[13:56:19:423 DBG] [Main] Executing: "C:\Program Files\CodeLite\codelite-make.exe" --workspace=C:\Users\XXX\Code\Maxr\project\codelite\MAXR.workspace --verbose --compile-flags --config=Release --settings=C:\Users\XXX\AppData\Roaming\codelite\config\build_settings.xml
[13:56:19:458 DVL] [Main] Symbols cache cleared
No match for visual.
User avatar
eranif
CodeLite Plugin
Posts: 6143
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Config broken after visual install

Post by eranif »

I suspect that issue is because you are using MSYS compiler (C:\msys64\...)
Is your project open source or can you provide a minimal project + workspace that I can try?
Make sure you have read the HOW TO POST thread
Jarod42
CodeLite Expert
Posts: 197
Joined: Wed Sep 30, 2009 5:54 pm
Genuine User: Yes
IDE Question: C++
Location: France
Contact:

Re: Config broken after visual install

Post by Jarod42 »

I indeed use msys2.

But I play with new hello world project to reproduce issue:

Before compile_flags.txt is generated, I have indeed the issue.

Once generated, issue disappears when src files are in same directory structure than project.
but with different structure, issue is still present.

I have file structure like similar to:

Code: Select all

project/codelite/ : my_app.worksspace *.project
src/ **cpp, **.h

compile_flags.txt is in project/codelite/
if clangd works as for clang-format with .clang-format
then compile_flags.txt is not reachable from source files (or parent directories)...

Post Reply