VisualStudio is unable to compile mathplot

Open Beginner friendly
#149 5 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
cpp
Domain
build-system

Research direction

Start at mplot/VisualOwnable.cppm around line 1067, inside savegltf(const std::string&), where fout is declared: MSVC says std::basic_ofstream is undefined, so check whether <fstream> is included (directly or via a module unit that Windows compilation does not inherit). Compare with how other save/export functions in the same file obtain their stream types, and check the GitHub Actions Windows runners' build logs for anneal_asa.vcxproj to reproduce. Done means the Windows 2022 and 2025 runners build the examples cleanly while Linux/macOS builds stay green.

Written by the indexing model from the issue text.

Description

VisualStudio (both the "Windows 2022" github runner version and the "Windows 2025" github runner version) chokes on some code that I believe to be valid C++.

The file is VisualOwnable.cppm and the error message is:

D:\a\mathplot\mathplot\mplot\VisualOwnable.cppm(1067,27): error C2079: 'fout' uses undefined class 'std::basic_ofstream<char,std::char_traits<char>>' [D:\a\mathplot\mathplot\build\examples\anneal_asa.vcxproj]
  (compiling source file '../../examples/anneal_asa.cpp')
      D:\a\mathplot\mathplot\mplot\VisualOwnable.cppm(1067,27):
      the template instantiation context (the oldest one first) is
          D:\a\mathplot\mathplot\examples\anneal_asa.cpp(101,21):
          see reference to class template instantiation 'mplot::Visual<262145>' being compiled
          D:\a\mathplot\mathplot\mplot\Visual.cppm(59,34):
          see reference to class template instantiation 'mplot::VisualOwnable<262145>' being compiled
          D:\a\mathplot\mathplot\mplot\VisualOwnable.cppm(1065,22):
          while compiling class template member function 'void mplot::VisualOwnable<262145>::savegltf(const std::string &)'

I've yet to try to make a report on this to Microsoft.

Dominant language
C++
Stars
66
Forks
13
Avg merge
13h 58m
Merged PRs (30d)
12

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from sebsjames/mathplot

All issues in sebsjames/mathplot

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.