Compiler not recognizing constructs for some reason?


never in my life of ever until using replit have I experienced this.
Repl link:

#pragma once

#include <SDL.h>
#include <vulkan/vulkan.h>
#include <cstdlib>
#include <iostream>
#include <stdexcept>

namespace CRE {

  class CREWindow {
      void init();

      const int m_Width, m_Height;
      const char* m_Title;
      int m_Mode;

      SDL_Window *m_Window;
      Window(const char* title, int w, int h, int mode);


then I get 6 errors for some reason

Wow that is a lot of errors! Maybe it is the template…

PS: I got way more than 6 errors when I ran it.

1 Like

as far as I know, the c++ 11 template (which is what my SDL template is based on) should support the existence of constructors and deconstructors. I am not sure if this is a nix thing, or strictly a compiler thing, but it is definitely abnormal and should not be happening.


managed to remove all of the errors after a painful hour of fiddling.

initially, I changed the compiler version, which didn’t really do anything

so then I realized I forgot to put CRE before Window, and since constructors have to have the same name as the class, that caused some issues.

but I still was getting errors with the constructors and everything

so then with compilation, I precompiled my main engine files and then included it with the main compilation to make linking work properly

clang++ -c ./CRE/*.hpp -I./vendor/SDL2/include -I./vendor/glm
clang++ -c ./CRE/*.cpp -I./vendor/SDL2/include -I./vendor/glm

clang++ -g main.cpp cre_application.o cre_window.o -o main -I./vendor/SDL2/include -I./vendor/glm -L./vendor/SDL2/lib/x86_x64/ -lSDL2 -lvulkan 


which seemed to fix everything.

What I learned from this: the clang debugger is very bad compared to visual studio, and visual studio is very good at preventing these compilation errors.

linking multiple files is a massive pain.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.