From 353d9ea7d4e60aba31a0118d9958dde5363cdcc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Lasersk=C3=B6ld?= Date: Sat, 22 Oct 2022 08:33:12 +0200 Subject: [PATCH] Workaround for clang bug that prevents importing string and iostream Described here https://github.com/llvm/llvm-project/issues/58540 https://stackoverflow.com/questions/74149849/error-when-importing-string-and-iostream-in-same-file?noredirect=1#comment130924685_74149849 --- src/glapi.cppm | 3 +-- src/glfunctions.h | 1 - src/main-nix.cpp | 11 +++-------- src/matgl.cppm | 5 ++--- 4 files changed, 6 insertions(+), 14 deletions(-) diff --git a/src/glapi.cppm b/src/glapi.cppm index f052c6a..761936d 100644 --- a/src/glapi.cppm +++ b/src/glapi.cppm @@ -2,12 +2,11 @@ module; #include #include -#include export module glapi; import ; -import ; +import ; #define glCall(call) \ call; \ diff --git a/src/glfunctions.h b/src/glfunctions.h index 0ab1897..83cfbd5 100644 --- a/src/glfunctions.h +++ b/src/glfunctions.h @@ -38,7 +38,6 @@ #endif #include -#include #define glCall(call) \ call; \ checkGlError(#call) diff --git a/src/main-nix.cpp b/src/main-nix.cpp index 2d13ff7..147d765 100755 --- a/src/main-nix.cpp +++ b/src/main-nix.cpp @@ -1,9 +1,5 @@ - - -// #include "glfunctions.h" #include #include -// #include import graf; import draw; @@ -11,8 +7,7 @@ import hant; import graf; import glapi; -// import ; -// import ; +import ; import ; using namespace std; @@ -85,7 +80,7 @@ void processEvents() { // Init everything int main(int /*argc*/, char * /*argv*/[]) { if (SDL_Init(SDL_INIT_VIDEO)) { - fprintf(stderr, "&s", "failed to init video\n"); + std::cerr << "failed to init video\n"; return -1; } SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); @@ -104,7 +99,7 @@ int main(int /*argc*/, char * /*argv*/[]) { height, SDL_WINDOW_OPENGL); if (!window) { - fprintf(stderr, "%s", "could not create window\n"); + std::cerr << "could not create window\n"; return 1; } diff --git a/src/matgl.cppm b/src/matgl.cppm index af7a9cf..2a73993 100644 --- a/src/matgl.cppm +++ b/src/matgl.cppm @@ -16,13 +16,12 @@ module; #include #include #include -// #include -#include -#include export module matgl; import glapi; +import ; +import ; export namespace GL {