Skip to content

Commit

Permalink
Workaround for clang bug that prevents importing string and iostream
Browse files Browse the repository at this point in the history
  • Loading branch information
mls-m5 committed Oct 22, 2022
1 parent d607a49 commit 353d9ea
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 14 deletions.
3 changes: 1 addition & 2 deletions src/glapi.cppm
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ module;

#include <GL/gl.h>
#include <SDL2/SDL_video.h>
#include <stdexcept>

export module glapi;

import <stdexcept>;
import <string>;
import <iostream>;

#define glCall(call) \
call; \
Expand Down
1 change: 0 additions & 1 deletion src/glfunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
#endif

#include <stdexcept>
#include <string>
#define glCall(call) \
call; \
checkGlError(#call)
11 changes: 3 additions & 8 deletions src/main-nix.cpp
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@


// #include "glfunctions.h"
#include <GL/gl.h>
#include <SDL2/SDL.h>
// #include <cstdio>

import graf;
import draw;
import hant;
import graf;
import glapi;

// import <cstdlib>;
// import <iostream>;
import <iostream>;
import <stdexcept>;

using namespace std;
Expand Down Expand Up @@ -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);
Expand All @@ -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;
}

Expand Down
5 changes: 2 additions & 3 deletions src/matgl.cppm
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@ module;
#include <GL/gl.h>
#include <GL/glext.h>
#include <SDL2/SDL.h>
// #include <iostream>
#include <stdexcept>
#include <vector>

export module matgl;

import glapi;
import <stdexcept>;
import <vector>;

export namespace GL {

Expand Down

0 comments on commit 353d9ea

Please sign in to comment.