1

I have simple project that is using visual studio 2022 windows 10 i try to compile it , i defined it to be ISO C++14 Standard (/std:c++14) it always print : C++14 standard support is required to build

The compile error :

Build started...
1>------ Build started: Project: my_sdl_bgfx2, Configuration: Debug x64 ------
1>my_sdl_bgfx2.cpp
1>C:\dev\my\cpp\my_sdl_bgfx\my_sdl_bgfx2\include\bx\platform.h(443,1): fatal error C1189: #error:  "C++14 standard support is required to build."
1>Done building project "my_sdl_bgfx2.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

but its never pass this condition :

#if defined(__cplusplus)
#   if __cplusplus < 201402L
#       error "C++14 standard support is required to build."
#   elif __cplusplus < 201703L
#       define BX_CPP_NAME "C++14"
#   elif __cplusplus < 201704L
#       define BX_CPP_NAME "C++17"
#   else
// See: https://gist.github.com/bkaradzic/2e39896bc7d8c34e042b#orthodox-c
#       define BX_CPP_NAME "C++WayTooModern"
#   endif // BX_CPP_NAME
#else
#   define BX_CPP_NAME "C++Unknown"
#endif // defined(__cplusplus)

this is the source code :


#include <iostream>
#include <bgfx/bgfx.h>
#include <bgfx/platform.h>
#include <bx/mutex.h>
#include <bx/thread.h>

//#include <cstdio>
#include "sdl/SDL.h"
#include "sdl/SDL_syswm.h"

#define SDL_MAIN_HANDLED
//  Screen dimension constants
const int SCREEN_WIDTH = 640;
const int SCREEN_HEIGHT = 480;
//  Window data
SDL_Window* mWindow;

namespace 
{
    int32_t threadFunc(bx::Thread* _thread, void* _userData) {
        BX_UNUSED(_thread);
        bgfx::init();

    }
}

int main(int argc, char** argv)
{

    if (SDL_Init(SDL_INIT_VIDEO) < 0) {
        printf("SDL could not initialize. SDL_Error: %s\n", SDL_GetError());
        return 1;
    }
    mWindow = SDL_CreateWindow(
         "SDL Tutorial",
         SDL_WINDOWPOS_UNDEFINED,
         SDL_WINDOWPOS_UNDEFINED,
         SCREEN_WIDTH,
         SCREEN_HEIGHT,
         SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE | SDL_WINDOW_FULLSCREEN_DESKTOP
     );

     if (mWindow == NULL)
     {
         printf("SDL could not initialize SDL_CreateWindow. SDL_Error: %s\n", SDL_GetError());
         return 1;
     }

     SDL_SysWMinfo wmi;
     SDL_VERSION(&wmi.version);
     if (!SDL_GetWindowWMInfo(mWindow, &wmi))
     {
         return false;
     }

     //bgfx::PlatformData pd;
     SDL_SysWMinfo wmi;
     SDL_VERSION(&wmi.version);
     if (!SDL_GetWindowWMInfo(mWindow, &wmi))
     {
         return NULL;
     }
     /*pd.nwh = wmi.info.win.window;
     pd.context = NULL;
     pd.backBuffer = NULL;
     pd.backBufferDS = NULL;
     bgfx::setPlatformData(pd);

     bgfx::renderFrame();*/




     bool bStopMainLoop = false;
     while (!bStopMainLoop) {
         for (SDL_Event currentEvent; SDL_PollEvent(&currentEvent) != 0;) {
             if (currentEvent.type == SDL_QUIT) {
                 bStopMainLoop = true;
                 break;
             }
         }
     }
    return 0;
}


vc++ config: enter image description here

user63898
  • 29,839
  • 85
  • 272
  • 514
  • 5
    There is a [Setting for that](https://learn.microsoft.com/en-us/cpp/build/reference/zc-cplusplus?view=msvc-170) because backwards compat – Mgetz Aug 17 '22 at 17:17

0 Answers0