Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 Add Include broken in 2511 and VS2022 17.8.6
 New Topic  Reply to Topic
 Printer Friendly
Previous Page
Author Previous Topic Topic Next Topic
Page: of 2

feline
Whole Tomato Software

United Kingdom
19020 Posts

Posted - Mar 05 2024 :  06:22:53 AM  Show Profile  Reply with Quote
You are describing the bug I am seeing here perfectly. The difference is that so far I have never been able to reproduce this when the cpp and header files are in the same directory. You are not the first person to report this bug happening under these conditions, but it isn't showing up for me under these conditions.

Are you able to reproduce the bug in a test solution you would be able to send to me? If there is another factor at work in this bug, I would like to have a test case for it, to make sure it also gets fixed.

Assuming you have something you can send me, please send me the solution along with your IDE and VA settings, which can be exported via:

VA Options -> Performance -> Export Settings
IDE tools menu -> Import and Export Settings -> Export selected environment settings

via email:

[email protected]

including this thread ID or URL in the description, so we can match it up.

zen is the art of being at one with the two'ness
Go to Top of Page

dezmen
Junior Member

13 Posts

Posted - Mar 05 2024 :  06:52:16 AM  Show Profile  Reply with Quote
My bad. My header is not in the same directory as cpp.
Example:
./main.cpp
./Header/my_struct.h
./Source/somesource.cpp
VS project have ./Header folder in Additional Include Directories

Including my_struct.h in somesource.cpp fails. Ofc project is bigger than that, header folder have thousand of headers (no subfolders tho, just sub folder inside visual studio).


Currently reverted back to 2508, works perfectly

Edited by - dezmen on Mar 05 2024 06:53:24 AM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19020 Posts

Posted - Mar 05 2024 :  08:08:27 AM  Show Profile  Reply with Quote
On the vcpkg front, does anyone have a simple, sensible example they can point me at that will actually work and build? I am just going round in circles here, trying to set up an example that makes use of the new VS2022 built in vcpkg manager. Not even getting a VS2022 solution to build, when trying to apply this simple tutorial:

https://learn.microsoft.com/en-us/vcpkg/consume/manifest-mode

zen is the art of being at one with the two'ness
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19020 Posts

Posted - Mar 05 2024 :  09:22:21 AM  Show Profile  Reply with Quote
dezmen, I am seeing the same thing, now I have set up a test for this. In VA 2508 Add Include just adds the #include statement, no path required, since the header file is in one of the include directories. Yet in VA 2511 no #include statement is added.

I did not expect the bug to show up like that, but it does, and I have added my test case for this situation to the bug report. Good to know we are seeing the same thing, even if I did miss a situation in my tests.

zen is the art of being at one with the two'ness
Go to Top of Page

hajokirchhoff
Ketchup Master

Germany
58 Posts

Posted - Mar 05 2024 :  09:24:16 AM  Show Profile  Reply with Quote
quote:
Originally posted by feline

On the vcpkg front, does anyone have a simple, sensible example they can point me at that will actually work and build? I am just going round in circles here, trying to set up an example that makes use of the new VS2022 built in vcpkg manager. Not even getting a VS2022 solution to build, when trying to apply this simple tutorial:

https://learn.microsoft.com/en-us/vcpkg/consume/manifest-mode



- clone git and boostrap vcpkg
- run `vcpkg integrate install`
- Create a new C++ project/solution in Visual Studio 2022.
- right click on the C++ project, choose "properties"
- Goto "Configuration Properties", vcpkg (this will appear only if integrate install worked)
- Enable "Use vcpkg manifest"

- create a vcpkg.json file and put it in the root directory of your project/solution.

Ignore the vcpkg commands to create a vcpkg or add a port. Use this instead (IMHO):


{
  "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
   "dependencies": [
      { "name": "boost" }
   ]
}


Hit "F5", "F7" or whatever key to build. Should work, I just tried it here.

I've got a *.7z file for this example. Can I upload it somewhere?
Regards
Hajo

P.S. I sent you an email offering more help if you want it :)
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19020 Posts

Posted - Mar 05 2024 :  1:00:40 PM  Show Profile  Reply with Quote
*sigh* that is working, thank you! Apparently these simple "vcpkg.json" files simply do not work with the built in version of vcpkg that newer versions of VS2022 have. Which makes absolutely no sense to me.

This test is downloading a crazy amount of data though!

Now just to try and set up a good test case that is a bit smaller and more contained than this still growing monster

zen is the art of being at one with the two'ness
Go to Top of Page

Riztazz
Junior Member

Poland
15 Posts

Posted - Mar 06 2024 :  12:39:12 AM  Show Profile  Reply with Quote
You are consuming entire boost library with this manifest-mode, consider switching to e.g. fmt or some other smaller library or specify boost component you want to consume
Go to Top of Page

dezmen
Junior Member

13 Posts

Posted - Mar 06 2024 :  01:23:49 AM  Show Profile  Reply with Quote
So. Any fix for include things? :)
Go to Top of Page

hajokirchhoff
Ketchup Master

Germany
58 Posts

Posted - Mar 06 2024 :  04:17:12 AM  Show Profile  Reply with Quote
quote:
Originally posted by feline

*sigh* that is working, thank you! Apparently these simple "vcpkg.json" files simply do not work with the built in version of vcpkg that newer versions of VS2022 have.
...
Now just to try and set up a good test case that is a bit smaller and more contained than this still growing monster


Ah, yes, I forgot. While I think vcpkg should become a standard tool in the Visual Studio arsenal, MS decided for whatever reason to include a slightly older and partly incompatible version. But what encourages me is the amount of work MS has poured into this open source tool in the past three years. I started in 2021 with vcpkg. The current version is so much better and work is still ongoing. I am sure, the VS team will get the integration right, sooner or later.

@Riztazz is right, of course. "name": "boost" includes the entire boost library. "name": "boost-format" would include only the boost-format and it's dependencies. The dependency management is part of the appeal.

The other part of the appeal is that once you've build the boost library for a project, all other project will simply consume that build and the initial setup time is reduced to a couple of milliseconds.

At the very first run of vcpkg, the tool will actually download the entire toolchain required for the lib. That can take hours. I had a lib that required a fortran compiler and vcpkg did not only download the full cmake and dependent tools, it actually downloaded the sources for a fortran compiler and built it.

But Binary Caching means that it will do this only once and only for tools that are required.

```
#include "boost/format.hpp"

void main()
{
cout << boost::str(boost::format("Hi, this is boost-format from %s") % "vcpkg"));
}
```
Go to Top of Page

Riztazz
Junior Member

Poland
15 Posts

Posted - Mar 06 2024 :  05:35:36 AM  Show Profile  Reply with Quote
alt-g shortcut also works only to declaration, but i think that one would be hard to implement as buildtrees change a lot sadly. I would pay additional money for this feature while working under vcpkg :D
One more thing i would like to note is that VCPKG also allows to consume ports from your own repository, known as registries (https://devblogs.microsoft.com/cppblog/registries-bring-your-own-libraries-to-vcpkg/), i don't think it changes much but probably worth mentioning now :) we and a lot of other people use it often to add patches to the libs we consume or we write our own ports for libraries (even though they exist on vcpkg main branch) but their ports might be lacking or written in a way that we don't like, e.g. downloading entire Fortran compiler :P

Edited by - Riztazz on Mar 06 2024 05:45:13 AM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19020 Posts

Posted - Mar 06 2024 :  12:46:29 PM  Show Profile  Reply with Quote
This is so much "fun". Building on this progress, and some more digging, I have managed to get the version of vcpkg build into VS2022 to install the zlib library. Picked simply because it is small, so a quick and simple test.

The test solution builds, but even on a machine that has never seen VA, VS2022 cannot navigate to, and shows no awareness of the zlib header file, or the structure declared inside of it. Despite not being able to find the library, the solution is building just fine, so in that sense it is clearly configured correctly.

Manually dragging the "zlib.h" header file into the IDE gets VA to parse it, so VA now knows the header file to #include. In VA 2508.0, before we broke Add Include, VA is adding a long #include "" path, since clearly it isn't picking up the vcpkg include directories, let alone registering them as directories to use for #include <> statements.


I have also taken this a step further, and produced a solution holding 2 different dll projects. Each dll project uses a "vcpkg.json" file to include zlib, but the two projects use different versions of zlib, since this is one of the situations brought up here, that we need to be aware of and watch for.

We have an open and fairly high priority case to support vcpkg and locate the directories, but getting this working, and a good test example that uses the VS2022 build in version of vcpkg is important, and I am glad to have produced that, so I have updated the bug report with this, and all the key details:

case=142493

No idea why VS2022 isn't picking up my library correctly, so it looks like I did something wrong here, but this is still good progress, so thank you everyone for the help here

zen is the art of being at one with the two'ness
Go to Top of Page

Riztazz
Junior Member

Poland
15 Posts

Posted - Mar 06 2024 :  9:44:47 PM  Show Profile  Reply with Quote
Great to hear that :)

Yeah vcpkg is a bit much at first, hopefully the eventual fix covers submodule-manifest-mode vcpkg cases as well!

Edited by - Riztazz on Mar 06 2024 9:45:55 PM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19020 Posts

Posted - Mar 07 2024 :  09:00:15 AM  Show Profile  Reply with Quote
Do you mean having a different versions of the same library in different projects inside the same solution, or do you mean something else by submodule-manifest-mode? Reading different versions was a real situation, I focussed on getting a working test case for this produced, since this isn't something I would expect VA to normally have to handle.

zen is the art of being at one with the two'ness
Go to Top of Page

Riztazz
Junior Member

Poland
15 Posts

Posted - Mar 07 2024 :  09:22:57 AM  Show Profile  Reply with Quote
Include.cmake
https://gist.github.com/Riztazz/1acf8eb4a15c1b6d15fca09a7302115d

AutoVcpkg.cmake
https://gist.github.com/Riztazz/ae418e6b9016124e698b6c8777e3f55a

vcpkg-bootstrap.cmake
https://gist.github.com/Riztazz/b0adc987834d1c41463f4eb904c38ce5

--
This is how we bootstrap vcpkg for our project, we do not rely on one installed in the system/VS, but download one from the microsoft repository and bootstrap it with cmake.
For testing purposes, just include(Include.cmake) in cmake and it should start working;p (everything else stays the same as in normal manifest case, vcpkg.json file required and so on, we also use 'registries' which we set via CMakePreset.json file (i dont think its required for very simple case, but for the sake of completeness: https://gist.github.com/Riztazz/244d6d7b0af6e236d5660c64b8c7415b)
It's easier for me to just show the cmake code to explain what i mean :) basically pinning the version of package manager itself

Edited by - Riztazz on Mar 07 2024 09:30:22 AM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19020 Posts

Posted - Mar 07 2024 :  12:09:38 PM  Show Profile  Reply with Quote
Sorry for not understanding, but I simply don't follow.

Starting with a clean, "empty" test machine, which has various versions of Visual Studio installed, but no efforts to install either CMake or vcpkg, I have installed CMake, from https://cmake.org/download/

I used the Windows x64 Installer - cmake-3.29.0-rc3-windows-x86_64.msi

But now what? Make a directory and trigger CMake? Install vcpkg?

My understanding is that I need a "CMakeLists.txt" before running CMake, and none of these links point at such a file. I assume CMake understands .cmake files, and I have several of them on my test machines, but I don't actually know what to do with one of them.

zen is the art of being at one with the two'ness
Go to Top of Page

Riztazz
Junior Member

Poland
15 Posts

Posted - Mar 07 2024 :  11:03:01 PM  Show Profile  Reply with Quote
Just a basic cmake project is required, i've created one here https://github.com/Riztazz/AutoVcpkgCmake

To launch the project you can do one of the following:
- Launch visual studio 2022 and when it prompts you to select or create a project, select 'Open a local folder' and point it to the root directory of the project
- The above can be also achieved by right-clicking (On Windows platform) on empty space in root directory of a project and selecting 'Open with visual studio' from the right-click context menu
Those two will open the project using Ninja and something known as open folders ( There is no solution (.sln) file in this case https://learn.microsoft.com/en-us/visualstudio/ide/develop-code-in-visual-studio-without-projects-or-solutions?view=vs-2022 )

Another option is to generate the solution file as it is usually done, you can do either by command line or by using GUI:
The below assumes the gui approach;

- Launch cmake gui
- Specify root directory of the project in 'Where is the source code'
- in Preset, select 'Windows x64'
- Press configure and you will be requested to choose generator, please select Microsoft visual studio 2022
- Once done, press generate

This approach will create a .sln file that you can open, it should be located in {root}/.build/ninja-win64/AutoVcpkgProject.sln (ninja-win64 is a bit misleading here)


In both approaches, it will download vcpkg from Microsoft repository and bootstrap it for this project.
Like i said previously, not sure if it changes much for VA but it differs enough that i wanted to make a note about it :P if it doesn't, i am sorry for wasting your time!

Edited by - Riztazz on Mar 07 2024 11:14:02 PM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19020 Posts

Posted - Mar 08 2024 :  09:14:31 AM  Show Profile  Reply with Quote
Thank you for the files and the instructions, but this isn't getting me anywhere at all.

For my first attempt, I started with my basic clean start test machine. I then downloaded and extracted the zip file, and loaded VS2022 and told it to open the folder:

C:\src\AutoVcpkgCmake-main
as I would with any CMake "project" I was trying to open and use.

VS2022 did something, before reporting that CMake failed. I never even got to ask VS2022 to build anything.

I know VS2022 did things in the background since the directory:

C:\src\AutoVcpkgCmake-main\.build\ninja-win64
has appeared, and contains various files and sub-directories, none of which were present in the original zip file.

The CMake build error VS2022 is reporting is present in the file:

C:\src\AutoVcpkgCmake-main\cmake\vcpkg\Include.cmake

at line 29, since it could not find the requested file:

C:/src/AutoVcpkgCmake-main/.build/ninja-win64/vcpkg/scripts/buildsystems/vcpkg.cmake

which is correct, since while I do now have the directory:

C:\src\AutoVcpkgCmake-main\.build\ninja-win64\vcpkg
it is completely empty.

So I assume this CMake "project" contains assumptions about other things that have been downloaded and configured, but I don't know what those assumptions are.



So, for test 2, I have started again with the same clean test system, then installed CMake, specifically "cmake-3.29.0-rc3-windows-x86_64.msi" since while VS2022 has some form of CMake built in, I am not sure how or where to find the GUI, or if it even exists.

I loaded the GUI from this version, and followed your instructions. When prompted for the generator I told it to use "Visual Studio 17 2022". Next I had to specify what compiler settings to use, so instead of using cross compiling I told it to "Use default preset compilers", since that sounded sensible. Trying to generate then produced errors. The relevant errors seem to be:

* VCPKG_ROOT C:/src/AutoVcpkgCmake-main/.build/ninja-win64/vcpkg
CMake Error at cmake/vcpkg/Include.cmake:29 (include):
include could not find requested file:

C:/src/AutoVcpkgCmake-main/.build/ninja-win64/vcpkg/scripts/buildsystems/vcpkg.cmake
Call Stack (most recent call first):
CMakeLists.txt:6 (include)


CMake Error at src/CMakeLists.txt:3 (find_package):
Could not find a package configuration file provided by "fmt" with any of
the following names:

fmtConfig.cmake
fmt-config.cmake

Add the installation prefix of "fmt" to CMAKE_PREFIX_PATH or set "fmt_DIR"
to a directory containing one of the above files. If "fmt" provides a
separate development package or SDK, be sure it has been installed.


The missing package errors are strange, since I thought the whole point of this exercise is that the packages would actually be downloaded. I have double checked, and this test machine is online, so it should be able to download things. The missing file is the same error as my first test attempt though, so that bit makes sense.

zen is the art of being at one with the two'ness
Go to Top of Page

Riztazz
Junior Member

Poland
15 Posts

Posted - Mar 08 2024 :  12:00:01 PM  Show Profile  Reply with Quote
That's interesting, i'll setup a clean machine and see, possibly due to newer cmake :)
I did run it on my machine before pushing and it worked perfectly:(

edit:
Did some testing and it seems to work fine on many cmake versions and vs versions.
The fact that you're missing /vcpkg/ means it failed to download the repo via https://github.com/Riztazz/AutoVcpkgCmake/blob/main/cmake/vcpkg/AutoVcpkg.cmake#L55C1-L55C20
which is not something i've seen in the past. I'll debug a bit over the weekend

Edited by - Riztazz on Mar 08 2024 12:21:47 PM
Go to Top of Page

Riztazz
Junior Member

Poland
15 Posts

Posted - Mar 09 2024 :  02:17:01 AM  Show Profile  Reply with Quote
Ok, i've been reading a bit of cmake documentation and it seems git is required for this.
NOTE: A git version of 1.6.5 or later is required if this download method is used.
https://cmake.org/cmake/help/latest/module/ExternalProject.html#git

Does your test bench come with git or git is a no no? I could probably update it to pull the zipped file and unpack it but i've never done unpacking via cmake so i would rather not

Edited by - Riztazz on Mar 09 2024 05:45:03 AM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19020 Posts

Posted - Mar 11 2024 :  11:01:37 AM  Show Profile  Reply with Quote
I don't have git installed by default, since I never use it. So I downloaded and installed the Windows version of git, from the page:

https://gitforwindows.org

which was recommended by github. I rebooted to make sure the system PATH was updated correctly.

Opening the unzipped directory in VS2022 still fails, in the same manor, so installing git had no effect on VS2022. That doesn't really surprise me, since VS2022 offers the option to clone a git repository on its launch screen.

So I opened the CMake GUI again, and now we are getting a different set of messages and errors. Because it might matter, when setting the generator for this project, I again selected "Visual Studio 17 2022" and set it to "Use default preset compilers".

The logs show it installing vcpkg, but then it fails:

error: while loading C:\src\AutoVcpkgCmake-main\vcpkg.json:
$.name (a package name): "AutoVcpkgCmake" is not a valid package name.
Package names must be lowercase alphanumeric+hypens and not reserved (see https://learn.microsoft.com/vcpkg/users/manifests for more information).

Extended documentation available at 'https://learn.microsoft.com/vcpkg/users/manifests'.

Running vcpkg install - failed
CMake Error at .build/ninja-win64/vcpkg/scripts/buildsystems/vcpkg.cmake:899 (message):
  vcpkg install failed.  See logs for more information:
  C:\src\AutoVcpkgCmake-main\.build\ninja-win64\vcpkg-manifest-install.log
Call Stack (most recent call first):
  cmake/vcpkg/Include.cmake:29 (include)
  CMakeLists.txt:6 (include)

zen is the art of being at one with the two'ness
Go to Top of Page

Riztazz
Junior Member

Poland
15 Posts

Posted - Mar 11 2024 :  11:19:50 AM  Show Profile  Reply with Quote
I feel silly, i wonder why it went through on my machine :) I've pushed a fix to the main repository. https://github.com/Riztazz/AutoVcpkgCmake/commit/7430b082c48ed2f8c06b39596ae9d0819bec9e3d
I don't wanna cause spamm, so should we maybe move to an e-mail if there is more issues? Hopefully it works now..

Edited by - Riztazz on Mar 11 2024 11:20:09 AM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19020 Posts

Posted - Mar 11 2024 :  12:23:15 PM  Show Profile  Reply with Quote
Thank you, this time CMake GUI was able to generate a solution. I now have the two SLN files:

C:\src\AutoVcpkgCmake-main\.build\ninja-win64\AutoVcpkgProject.sln
C:\src\AutoVcpkgCmake-main\.build\ninja-win64\vcpkg-download\vcpkg-download.sln

but what are they supposed to be showing me?

If I open "AutoVcpkgProject.sln" it contains a "main.cpp" file, with a reference to "fmt::print()", but this seems to be a solution using vcpkg. Is this showing something more than that, that you want VA to understand?

zen is the art of being at one with the two'ness
Go to Top of Page

Riztazz
Junior Member

Poland
15 Posts

Posted - Mar 12 2024 :  01:31:47 AM  Show Profile  Reply with Quote
Nothing in particular, it shows a very different way to initialize vcpkg and it's directories, if you open in 'open folders' mode, the directory structure will also slightly change, just wanted to make sure VA team is aware of this when fixing case 142493
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19020 Posts

Posted - Mar 12 2024 :  12:11:07 PM  Show Profile  Reply with Quote
Good to know, I was wondering if this was another complex aspect to all of this. I have added this, along with my instructions for building the solution from the zip file to the case. Having another example is definitely useful, so thank you for that.

zen is the art of being at one with the two'ness
Go to Top of Page

dreamcom00
Starting Member

Korea
1 Posts

Posted - Mar 13 2024 :  01:34:43 AM  Show Profile  Reply with Quote
I have same problem too. (Add Include is broken for me too with VA 2511)
Reverting back to 2508 fixes the issue for us too.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19020 Posts

Posted - Mar 13 2024 :  11:03:01 AM  Show Profile  Reply with Quote
We are working on a fix for Add Include, and hope to be able to release it soon.

zen is the art of being at one with the two'ness
Go to Top of Page

sitnduck
Senior Member

47 Posts

Posted - Mar 15 2024 :  07:17:49 AM  Show Profile  Reply with Quote
Hello feline, first, thank you for all your support.

...so it's great to hear a fix is forthcoming, I'll just add my own case that after working forever, Add Include "does nothing" here as well. (non-UE vanilla C++ project, nothing fancy, headers in the same folder as sources, etc.). I'm just "glad" to hear it's not just me, I thought I was going nuts :)
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19020 Posts

Posted - Mar 15 2024 :  11:35:29 AM  Show Profile  Reply with Quote
sitnduck I have emailed you about this.

zen is the art of being at one with the two'ness
Go to Top of Page

Riztazz
Junior Member

Poland
15 Posts

Posted - Mar 23 2024 :  01:08:31 AM  Show Profile  Reply with Quote
The most recent build seems to fix add include under VCPKG, thank you :)
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19020 Posts

Posted - Mar 25 2024 :  07:13:50 AM  Show Profile  Reply with Quote
Excellent news, thank you

zen is the art of being at one with the two'ness
Go to Top of Page
Page: of 2 Previous Topic Topic Next Topic  
Previous Page
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000