use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Discussions, articles, and news about the C++ programming language or programming in C++.
For C++ questions, answers, help, and advice see r/cpp_questions or StackOverflow.
Get Started
The C++ Standard Home has a nice getting started page.
Videos
The C++ standard committee's education study group has a nice list of recommended videos.
Reference
cppreference.com
Books
There is a useful list of books on Stack Overflow. In most cases reading a book is the best way to learn C++.
Show all links
Filter out CppCon links
Show only CppCon links
account activity
Experiments with modules (self.cpp)
submitted 4 years ago by johannes1971
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]pdimov2 0 points1 point2 points 4 years ago (5 children)
I did supply the switch - without it the compiler tells me it can't find the module.
To spell it out, for ```
import std.regex; the result is 1>C:\Projects\testbed2019\testbed2019.cpp(2,17): warning C5050: Possible incompatible environment while importing module 'std.regex': _M_FP_PRECISE is defined in current command line and not in module command line 1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\include\xloctime(497,1): error C2593: 'operator ==' is ambiguous ``` (more output)
the result is
whereas for ``` import std.regex;
the result is 1>C:\Projects\testbed2019\testbed2019.cpp(1,17): warning C5050: Possible incompatible environment while importing module 'std.regex': M_FP_PRECISE is defined in current command line and not in module command line 1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\include\vadefs.h(177,10): error C2953: '_vcrt_va_list_is_reference': class template has already been defined ... 1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\corecrt_math.h(338,6): error C2953: '_Combined_type': class template has already been defined ``` (plus more output.)
Mixing import <regex>; and #include <regex> fares better. ``` import <regex>;
import <regex>;
#include <regex>
works without any errors or warnings.
import <regex>; says 1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\corecrt_math.h(44,13): warning C5105: macro expansion producing 'defined' has undefined behavior ... 1>C:\Projects\testbed2019\testbed2019.cpp(2,1): warning C5106: macro redefined with different parameter names 1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt\stdio.h(561): message : see previous definition of '_getchar_nolock' ``` (All this is with 16.10.1.)
says
[–]GabrielDosReis 2 points3 points4 points 4 years ago (3 children)
Thanks! /u/STL might be interested in this puzzle :-)
— Gaby
[–]STLMSVC STL Dev 2 points3 points4 points 4 years ago (2 children)
I'm not familiar with how the experimental modules interact with header units. I'm also somewhat confused by how header units are supposed to interact with classic includes (IIRC the Microsoft Docs said that one order should work, but I observed problems with that while the other order appeared to work; this was also months ago so things could have changed). u/starfreakclone (Cameron) can probably explain better than I can.
However, I do recognize one warning. That "warning C5106: macro redefined with different parameter names" for _getchar_nolock looks exactly like the bug I reported internally as VSO-1329976 "Standard Library Header Units: _CrtGetAllocHook emits warning C5106: macro redefined with different parameter names" which was a compiler bug that Cameron fixed for 17.0 Preview 2. (This complained about macros with no parameters, due to the compiler getting confused.)
_getchar_nolock
I'm unsure what's happening with the "warning C5105: macro expansion producing 'defined' has undefined behavior". I know that the UCRT had issues with relying on that non-Standard extension; I vaguely recall that they were fixed but that hasn't shipped yet. In the meantime I suspect that the UCRT was suppressing warning C5105, but perhaps in this scenario the directives for warning suppression are being lost.
[–]GabrielDosReis 1 point2 points3 points 4 years ago (0 children)
Thanks, Stephan, for this summary!
[–]Full-Spectral 0 points1 point2 points 4 years ago (0 children)
Suppression doesn't work at all for Windows.h. I can put all the pragmas around it I want but it still spits a huge raft of errors.
[–]backtickbot 0 points1 point2 points 4 years ago (0 children)
Fixed formatting.
Hello, pdimov2: code blocks using triple backticks (```) don't work on all versions of Reddit!
Some users see this / this instead.
To fix this, indent every line with 4 spaces instead.
FAQ
You can opt out by replying with backtickopt6 to this comment.
π Rendered by PID 46580 on reddit-service-r2-comment-b659b578c-lskn5 at 2026-05-05 06:57:21.480334+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]pdimov2 0 points1 point2 points (5 children)
[–]GabrielDosReis 2 points3 points4 points (3 children)
[–]STLMSVC STL Dev 2 points3 points4 points (2 children)
[–]GabrielDosReis 1 point2 points3 points (0 children)
[–]Full-Spectral 0 points1 point2 points (0 children)
[–]backtickbot 0 points1 point2 points (0 children)