Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Visual Studio C++ Modules Intellisense #5405

Open
01Pollux opened this issue Jul 28, 2024 · 0 comments
Open

Visual Studio C++ Modules Intellisense #5405

01Pollux opened this issue Jul 28, 2024 · 0 comments
Labels

Comments

@01Pollux
Copy link

Xmake Version

xmake v2.9.3+HEAD.a5da06f37

Operating System Version and Architecture

Windows 11 23H2

Describe Bug

image

The code compiles correctly, but IntelliSense cannot detect the modules available in the current project.

Expected Behavior

image
As shown in the image, the expected behavior is that IntelliSense should be able to detect the modules linked against the current library. However, in reality, it does not.

After some investigation, I managed to resolve this issue by uncommenting the project references located in the .vcxproj file.

  <ItemGroup>
    <ProjectReference Include="..\mod\mod.vcxproj">
      <Project>{2B32DA8B-CA39-4549-A720-EAEACE53D244}</Project>
    </ProjectReference>
  </ItemGroup>

Project Configuration

add_rules("mode.release", "mode.debug")
set_languages("c++20")

target("mod")
    set_kind("static")
    add_files("src/mod.ixx", {public = true})
    add_files("src/mod.cpp")

target("hello")
    set_kind("binary")
    add_deps("mod")
    add_files("src/main.cpp")

Additional Information and Error Logs

mod.ixx:

export module mod;

export namespace mod {
    int foo();
}

mod.cpp:

module;
#include <iostream>
module mod;

namespace mod {
    int foo() {
        std::cout << "Hello World!\n";
        return 2;
    }
}

main.cpp:

import mod;

int main() {
	return mod::foo();
}
@01Pollux 01Pollux added the bug label Jul 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant