How to use cuda with LSP-clangd - c++

I want to use sublime text as my c++ editor.
I added LSP-clangd in the editor. I generate some compile_commands.json and clangd works on almost every files in my project but not with cuda files.
I saw in clangd FAQ that we must ensure :
that our editor plugin is enabling clangd when CUDA files are open (e.g. enabling for extension *.cu). I didn't found any parameters in LSP-clangd settings to add some file extensions.
make sure that clangd understands these are CUDA files (e.g. by extension *.cu or adding the clang flag -xcuda). Where should I add these flags? In compile_commands.json?
set the path to your cuda installation if it isn’t detected, by adding the clang flag --cuda-path=... Where should I specify this path? I tried using command clang --cuda-path=my/cuda/path but it returns me clang: error; no input files
Have you any idea to solve one of these 3 problems ? or did someone suceed to use cuda with clangd in sublime text ?

Related

clang-tidy + VSCode: how to see command line?

Is there a way to see the actual commmand line that VSCode is issuing to clang-tidy?
I am trying to figure out why clang-tidy is giving clang-diagnostic-error messages about being unable to find certain header files, though I have configured workspace settings file settings.json to with "C_Cpp.default.includePath" to include the necessary folders, and have configured settings.json to contain "C_Cpp.codeAnalysis.clangTidy.args" entries such as "-Imy_path/to/the/files".
The build (clang and/or gcc and/or aarch64-linux-g++) all build fine with no errors. I am using the cmake extension in VSCode to generate the makefile (Ninja) and run the build.
I can't find the reason why the #include files are not being found by clang-tidy, so it seems that checking the actual command line being issued by VSCode would be a starting point for debugging this.
Thanks in advance for any help debugging this configuration issue.

Using boost/python on Windows

I'm trying to get into C++-extensions for python, with boost/python.
I've downloaded boost 1_73 and installed it by calling bootstrap and then b2 --with-python
In Visual Studio, i've included the compiler include path (the boost directory) and linker library paths (/stage/lib/) that the output of b2 tells me to.
Now I get the compiler error LNK1104 cannot open file 'boost_python37-vc141-mt-x64-1_73.lib'. I can't find any information about this specific error. For everything similar there is only the suggestion to add the above mentioned paths.
The code I'm trying to compile is just the hello world example supplied with boost.
Any ideas?
First check that file exists somewhere in your filesystem. If it doesn't, you may have accidentally built it against a different version (i.e. not 141) of the VC runtime. (This has happened to me when I've had multiple runtimes installed.)
If you do have the file, then you just need to ensure that the path is in the link settings section of your project config.

Library installation using compiler

I have been writing C++ code snippets sporadically to speed things up in R via Rcpp, but now I would like to do more using Armadillo library, but I am having trouble installing it.
The README file instructs to create a location for "include" folder and tell your compiler to use that location for header files (in addition to the locations it uses already).
If I save the "include" folder into C:\Users\me\Documents\ARMADILLO, then how do I instruct the compiler to use the appropriate location?
After some search, I tries typing into command line the following (after prompt: C:\Users\me>):
g++ Documents\ARMADILLO\include, but it did not work ("permission denied"). I hence wonder how this should be done.
Moreover, the README file finally instructs to: Configure your compiler to link with LAPACK and BLAS - I would very much appreciate an advice how this should be done as well.
Thanks a lot!
PS: I have Windows 7 and VS Express 2013 for Desktop.
Visual Studio uses solutions which are containers of projects. Each project has a settings page (right click the project in the Solution Explorer window). Under "Configuration properties" there's a VC++ Directories page, which in turn lists "Include Directories". Append ;C:\Users\me\Documents\ARMADILLO
BTW, I find it useful to put such libs under C:\libs\. Saves on path length.

Code::Blocks correctly finds but fails to open standard includes

I'm using Code::Blocks 13.12 IDE on Xubuntu 14.04 for writing C and C++ code, and in spite of correctly finding header files by the compiler, the IDE is not capable to automatically open included outside of the project tree files with "Open include file" command, including standard headers.
Is there any C::B configuration with which is possible to work around this limitation? Maybe some plugin providing functionality similar to Qt Creator "Include Hierarchy" feature?
It seems to be a bug in the "Code completion" plugin which is resolved after plugin is disabled and enabled again from the "Manage Plugins ..." dialog.

Cannot build an opengl es 2.0 c++ native android project. (fatal error: android/sensor.h: No such file or directory)

I try to build a book samples. (http://www.apress.com/9781430258308 , full source code can be download from there. I tried to build the very first code.)
I downloaded and installed the latest android sdk,adt and eclipse. I installed Sequoyah in Eclipse. I use android NDK r8c instead of the latest NDK because I got an 'Invalid path for NDK' error when I tried to set the NDK path in Eclipse.(Preferences/Android/Native Development/NDK Location)
I use MiniGW for c++ compiler.(I used this guide ( http://riccardotramma.com/2011/04/setup-eclipse-to-develop-opengl-glut-apps-in-java-cc-on-windows-mac/ ) to setup MiniGW in Eclipse. Just the MiniGW part.) I use MiniGW instead of Cygwin because I always get a 'unexpected end of file' error at some point of the build process.
I also added some include path and library (java and opengles) to the project at Properties/C/C++ General/Paths and Symbols. If I don't do this I get a 'fatal error: jni.h: No such file or directory' error and I would get additional errors for the further .h declarations.(egl.h etc.)
Now I just get the 'fatal error: android/sensor.h: No such file or directory' error (this is the first android .h declaration and probably I would get more errors for all of the android specific .h files later in the code.
I noticed one thing. There is a red x near $(call import-module,android/native_app_glue) line in the Outline window. Everything else seems fine.
If you can successfully build the above examples ( you can download it freely) please let me know your exact configuration or please guide me how to build my first native opengl code. (sdk,ndk versions etc.)
Thanks in advance,
Steve
Here's some quick points:
You can't use MinGW as the C++ compiler to work on Android NDK projects. The Android NDK has it's own specific compiler/toolchain. If you right-click on your project in Eclipse and go to C/C++ Build > Tool Chain Editor. The current toolchain should be Android GCC.
If you are getting unexpected end of file errors, could it be that some of the code has unix/linux style line endings? Here is an example of that (with the solution of using a text editor to make sure all the end lines are Windows/DOS format) - http://connect.microsoft.com/VisualStudio/feedback/details/794991/c-error-directive-and-unix-line-endings-leads-to-an-unexpected-end-of-file
You need a Application.mk file in the same directory as Android.mk.
This Application.mk file should contain a string similar to APP_PLATFORM: = android-9.