How do I Integrate with Visual Studio Code (linux) #17814
Replies: 17 comments
-
Can you compile your project with make after cmake command? the message "Build files have been written to: /home/mohamed/vcpkg/build" means that you have successfully configured it |
Beta Was this translation helpful? Give feedback.
-
I cd into the build directory and try
|
Beta Was this translation helpful? Give feedback.
-
@strega-nil Could you please take a look? Thanks. |
Beta Was this translation helpful? Give feedback.
-
I got it! The message |
Beta Was this translation helpful? Give feedback.
-
Do't forget to add vcpkg directory to the PATH variable |
Beta Was this translation helpful? Give feedback.
-
I realized that the "CMake projects should use: "-DCMAKE_TOOLCHAIN_FILE" message is not an error. when I try to
even the vscode autocomplete the library when I include it |
Beta Was this translation helpful? Give feedback.
-
can you tell me where exactly the PATH variable is it in the settings.json? |
Beta Was this translation helpful? Give feedback.
-
It's a system variable of linux configured in the file ~/.bashrc, you can open it with vim or other text editor and add the line: |
Beta Was this translation helpful? Give feedback.
-
test_cpp.cpp |
Beta Was this translation helpful? Give feedback.
-
I edit the source file in vscode and build in it's inner terminal successfully. But I can't use the cmake configure and cmake build operation in vscode to build the example. It's very strange |
Beta Was this translation helpful? Give feedback.
-
@syys96 you need to add to your |
Beta Was this translation helpful? Give feedback.
-
I'm having essentially the same issue. Do I add my stuff here, or pull a new issue?
I carefully went thru the installation of vcpkg.
For my testing, I'm using FMT
I'm using VS Code, version 1.45.1 with C/C++ for Visual Studio Code Extension (0.28.1) installed. As I understand it, from this link that Visual Studio Code C/C++ extension May 2018 Update includes Auto-detection of libraries installed by Vcpkg for IntelliSense. I've tried both sudo and without for I'm wondering if my use case is right:
Many thanks for the support here... |
Beta Was this translation helpful? Give feedback.
-
Can you build the test in terminal instead of vscode? Or do you add the CMAKE_TOOLCHAIN_FILE to setting.json under your workplace? |
Beta Was this translation helpful? Give feedback.
-
CMakeLists.txt Then you can use cmake and make to build the test, the progress has successfully passed on my machine |
Beta Was this translation helpful? Give feedback.
-
@syys96 You are my hero! That totally nailed it. I had some sloppiness within my CMakeLists.txt file, at the I will say, I don't understand the linker line of code Note, I've been trying to really understand how to correctly use C++ in Linux with VS Code, with a real deugger. In fact i created a decent repo on some expected use cases... In fact, would this be a potential start towards creating a decent beginners tutorial on using VCPKG with VS Code? https://github.com/zipzit/vscode_cpp_projects I will say, the fmt library is sort of obtuse. That's not a library I would every be likely to use. I'm thinking of adding a simple graphics or charting library via VCPKG would be a nice touch. any feedback? And syys96, thank you for your assistance here! |
Beta Was this translation helpful? Give feedback.
-
@zipzit yeah, that's some oddity with the fmt library. Basically, you can use it either "header-only", or compile it separately. Since you're using vcpkg already to take care of that, there's no reason not to just use |
Beta Was this translation helpful? Give feedback.
-
I'm looking at the topic question here: "How do I Integrate with Visual Studio Code (linux)"
I'm wondering if it would be appropriate to do a pull request to add this stuff as a VScode how-to for this repo? |
Beta Was this translation helpful? Give feedback.
-
I following the readme to install vcpkg
when I run
./vcpkg integrate install
output
I tried these commands
the last line of output
Build files have been written to: /home/mohamed/vcpkg/build
but when I run the
./vcpkg integrate install
again it gives the same error .I'm totally new to cmake. am I using the right cmakelists.txt which is inside the toolsrc
Environment:
Beta Was this translation helpful? Give feedback.
All reactions