Jump to content

Can't build/compile cmake based project - Error in 'UnigineThread.h'


photo

Recommended Posts

Posted

Hi, I have created a new Unigine project.

My setup:

API + IDE : C++ (CMake)

I generate the cmake project correctly without any type of error, but when doing a build of the projec, I have error on this file: 'UnigineThread.h',
Error:
 

C:\PROGRA~1\JETBRA~1\CLION2~1.1\bin\mingw\bin\G__~1.EXE -DDEBUG -isystem E:/Development/unigine/unigine_project/source/../include -g -m64 -march=athlon64 -msse4.2 -ffast-math -fno-strict-aliasing -Wall -Wno-unknown-pragmas -Wno-unused-parameter -std=c++14 -MD -MT CMakeFiles/unigine_project.dir/main.cpp.obj -MF CMakeFiles\unigine_project.dir\main.cpp.obj.d -o CMakeFiles/unigine_project.dir/main.cpp.obj -c E:/Development/unigine/unigine_project/source/main.cpp
In file included from E:/Development/unigine/unigine_project/include/UniginePool.h:17,
                 from E:/Development/unigine/unigine_project/include/UnigineHashMap.h:19,
                 from E:/Development/unigine/unigine_project/include/UnigineString.h:19,
                 from E:/Development/unigine/unigine_project/include/UnigineEngine.h:18,
                 from E:/Development/unigine/unigine_project/source/main.cpp:15:
In function 'bool Unigine::AtomicCAS(volatile char*, char, char)':
/UnigineThread.h:43:25: error: '_InterlockedCompareExchange8' was not declared in this scope; did you mean '_InterlockedCompareExchange'?
   43 |                 return (_InterlockedCompareExchange8(ptr, new_value, old_value) == old_value);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                         _InterlockedCompareExchange
/UnigineThread.h: In function 'char Unigine::AtomicAdd(volatile char*, char)':
/UnigineThread.h:98:24: error: '_InterlockedExchangeAdd8' was not declared in this scope; did you mean '_InterlockedExchangeAdd'?
   98 |                 return _InterlockedExchangeAdd8(ptr, value);
      |                        ^~~~~~~~~~~~~~~~~~~~~~~~
      |                        _InterlockedExchangeAdd
/UnigineThread.h: In function 'short int Unigine::AtomicAdd(volatile short int*, short int)':
/UnigineThread.h:110:24: error: '_InterlockedExchangeAdd16' was not declared in this scope; did you mean '_InterlockedExchangeAdd64'?
  110 |                 return _InterlockedExchangeAdd16(ptr, value);
      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~
      |                        _InterlockedExchangeAdd64

But if instead of using CMake if i generate the project for Visual Studio, it work it does the compilation correctly.


How can i solve this error? do i am missing something, is a new project generated with the Unigine SDK Browser

Posted

Hello!

@unknowguys Building project with Mingw compiler does not support at the moment, please switch to visual studio instead.

Thanks!

image.png

 

  • 2 years later...
Posted (edited)

Проблему компилятора так и не починили? 

Я работаю в VS Code, создал проект CMake, компилятор GCC и падают те же ошибки.

Как это можно починить? 

P.s. переходить в Visual Studio что-то не очень хочется.

Edited by vyacheslav.shahtarov
Posted

Под Windows можно собрать только MSVC, компилятор можно поставить отдельно от студии, но как его заставить работать - это уже отдельная боль :)

В статье про С++ разработку на VS Code есть упоминание: https://code.visualstudio.com/docs/cpp/config-msvc#_prerequisites

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Posted

Спасибо, я смог заставить работать CMake с cl компилятором под VS Code. Оказалось что это просто. Вам бы добавить это в доку, малоли кому пригодится))

×
×
  • Create New...