0
\$\begingroup\$

I'm developing some additional options for a game (which means I don't have knowledge about whole game's methods, classes etc.).

Anyway, I have been trying to build the project for codes I've developed to test them. I've encountered some DirectX, Windows SDK Version, Compiler problems but managed to solve them. But now I'm encountering some BitScanReverse error.

It says: C3861 '_BitScanReverse': identifier not found

Here is whole code for the error I'm encountering:

#pragma once

#include <algorithm>
#include <memory>
#include <string>
#include <vector>
#include <initializer_list>
#include <functional>
#include <iterator>   

    #ifdef _MSC_VER // BitScanReverse ERROR 1
        _BitScanReverse(&n, ~code);
    #else
        n = sizeof(long) * 8 - 1 - __builtin_clzl(~code);
    #endif

    code &= ~(-1 << n);
    n = 6 - n;
    ptr++;  

    #ifdef _MSC_VER // BitScanReverse ERROR 2
        _BitScanReverse(&n, ucode);
    #else
        n = sizeof(long) * 8 - 1 - __builtin_clzl(ucode);
    #endif

I've downladed source codes through SVN, so whole project is actually working. I just couldn't manage to build it in my local laptop or desktop computer.

By the way, I've tried to build it with Visual Studio 2015 Enterprise (with other errors), Visual Studio 2017 Proffesional and Community Edition (with same errors). And actually this project was developed with Visual Studio 2013 and 2015.

I'm not even good C++ coder so I couldn't figured out the problem. Does anyone have an idea?

\$\endgroup\$
1
\$\begingroup\$

According to the docs here _BitScanReverse is in the header file <intrin.h>. Try adding #include <intrin.h> to your file.

\$\endgroup\$
  • \$\begingroup\$ Thank you it worked. But now I'm trying to solve an error with xmemory file. Thank you anyways. \$\endgroup\$ – Gunes K Jul 4 '17 at 13:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.