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

std::thread includes don't get resolved correctly on Windows #53

Open
Dlougach opened this issue Oct 19, 2024 · 3 comments
Open

std::thread includes don't get resolved correctly on Windows #53

Dlougach opened this issue Oct 19, 2024 · 3 comments

Comments

@Dlougach
Copy link

The <thread> header supplied with caide only actually defines anything when #if defined(_GLIBCXX_HAS_GTHREADS) condition is satisfied. This makes it impossible to inline any code that depends on std::thread.

@slycelote
Copy link
Owner

Hi,

Can you share your caide.ini as well as the error that you're getting?

@Dlougach
Copy link
Author

Example code:

#include <algorithm>
#include <iomanip>
#include <istream>
#include <map>
#include <numeric>
#include <ostream>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
#include <thread>
using namespace std;
// Powered by caide (code generator, tester, and library code inliner)


class Solution {
public:
    void solve(std::istream& in, std::ostream& out) {
    }
};

void solve(std::istream& in, std::ostream& out)
{
    std::thread a = std::thread([]() {});
    out << std::setprecision(12);
    Solution solution;
    solution.solve(in, out);
}

the config is default for the VS extension:

[core]
check_updates: false
features: 
language: cpp

[cpp]
clang_options: -target,
      i386-pc-mingw32,
      -nostdinc,
      -isystem,
      D:\Contests\Caide\include\c++,
      -isystem,
      D:\Contests\Caide\include\c++\i686-w64-mingw32,
      -isystem,
      D:\Contests\Caide\include\crt,
      -I,
      D:\Contests\Caide\cpplib,
      -std=c++17,
      -fparse-all-comments,
      -DONLINE_JUDGE
keep_macros: _WIN32,_WIN64,_MSC_VER,__GNUC__,__clang__,__cplusplus,__STDC_VERSION__,__linux,__linux__
max_consequent_empty_lines: 2

Error:

2>Prepare final code for submission
2>D:/Contests/Caide/GShohagLyubitPebe/.caideproblem/inlined.cpp(25,10): error G4D3043E2: no type named 'thread' in namespace 'std'
2>    std::thread a = std::thread([]() {});
2>    ~~~~~^
2>D:/Contests/Caide/GShohagLyubitPebe/.caideproblem/inlined.cpp(25,26): error G60A5EC10: no member named 'thread' in namespace 'std'
2>    std::thread a = std::thread([]() {});
2>                    ~~~~~^
2>2 errors generated.

@slycelote
Copy link
Owner

Seems to be fixed in a recent libstdc++. Until I upgrade it, you can get it manually e.g. here: download and unpack the deb file, find c++ directory and copy it to D:\Contests\Caide\include\c++

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants