标签: visual-c++-2012

无法使用BitScanForward64

我正在用c ++构建一个使用位板(__int64s)的国际象棋引擎,我需要使用BitScanForward64进行一些计算.但是当我调用它时,我收到此错误:

错误C3861:'_ BitScanForward64':找不到标识符

我这样包括它:

#include <intrin.h>
#pragma intrinsic(_BitScanForward64)
Run Code Online (Sandbox Code Playgroud)

它与BitScanForward64相同.

我在Windows 7(64位)上使用Visual Studio 11.CPU:Intel Core i7-2600K

我之前没有用c ++做过很多项目所以我不知道为什么会这样.请帮忙!

c++ intrinsics visual-c++ visual-c++-2012

4
推荐指数
1
解决办法
3644
查看次数

VC++ 11 map和multimap迭代器(重载)C2535

我正在玩新的VS 2012,我可能会遇到新的C++ 11问题.当我在项目设置中将平台工具集设置为VS2010(v100)时,这种代码很有效.

.H:

typedef std::multimap<unsigned, unsigned>   SizeMap;
typedef std::map<unsigned, unsigned>        OffsetMap;

private:
    inline void _RemoveBlockL(SizeMap::iterator sizeI);
    inline void _RemoveBlockL(OffsetMap::iterator offsetI);
Run Code Online (Sandbox Code Playgroud)

的.cpp:

inline void Foo::_RemoveBlockL(SizeMap::iterator sizeI)
{
// impementation
}

inline void Foo::_RemoveBlockL(OffsetMap::iterator offsetI)
{
// impementation
}
Run Code Online (Sandbox Code Playgroud)

但是当我为VS2012(v110)更改它时,我会收到以下错误:

Error   61  error C2535: 'void
Boo::system::Foo::_RemoveBlockL(std::_Tree_iterator<_Mytree>)' : member function already
defined or declared D:\_work\wp-test\boo\system\foo.h
Run Code Online (Sandbox Code Playgroud)

为什么重载不能在VC++ 11中运行?

c++ stl map multimap visual-c++-2012

4
推荐指数
1
解决办法
346
查看次数

发布.exe请求MSVCR110.dll的vs2012 c ++

我正在尝试使用vs2012 Express编译发布可执行文件.但是,每当我尝试在其他计算机上运行.exe时,我都会收到警告,提示我需要msvcr110.dll.我可以简单地复制dll,但我正在寻找更长期的解决方案.

在我尝试隔离导致错误的原因时,我已使用默认设置恢复为新的c ++项目,但在配置管理器中将配置更改为release.

我一直在努力解决这个问题一个多星期没有任何进展,所以任何建议都会受到赞赏.

c++ visual-c++ visual-studio-2012 visual-c++-2012

3
推荐指数
1
解决办法
4875
查看次数

无法打开包含文件:'arpa/inet.h':

#include <arpa/inet.h>
Run Code Online (Sandbox Code Playgroud)

我收到了这种错误

无法打开包含文件:'arpa/inet.h':

如何包含此头文件?我实际上是在VC++ 2012中执行此代码.

c visual-c++-2012

3
推荐指数
1
解决办法
1万
查看次数

如何更改MSVC++的std :: tuple支持的模板参数数量?

MSVC++还不支持可变参数模板,因此它的标准库"伪造"这些类,如std::tuple通过使用宏.我最近尝试使用VC11 beta编译我的一个项目,并得到它以显示它:

gtest\gtest.h(9735): error C2977: 'std::tuple' : too many template arguments
c:\program files (x86)\microsoft visual studio 11.0\vc\include\utility(72) : see declaration of 'std::tuple'
gtest\gtest.h(9743): error C2977: 'std::tuple' : too many template arguments
gtest\gtest.h(14568): error C2977: 'std::tuple' : too many template arguments
gtest\gtest.h(14568): error C3203: 'tuple' : unspecialized class template can't be used as a template argument for template parameter 'T', expected a real type
gtest\gtest.h(14568): error C2955: 'std::tuple' : use of class template requires template argument list
gtest\gtest.h(14568): error …
Run Code Online (Sandbox Code Playgroud)

c++ templates visual-c++ variadic-templates visual-c++-2012

2
推荐指数
1
解决办法
2970
查看次数

从Visual C++ 6.0转换到Visual Studio 2012的问题

我有一个Visual C++ 6.0项目,我需要更新并将其导入Visual Studio 2012而没有任何问题,但是,在编译期间,我得到以下四个错误:

错误1错误C2440:'static_cast':无法从'void(__ thiscall CTrendDlg ::*)(int)'转换为'void(__thiscall CCmdTarget ::*)(UINT)'c:\ users \nima\desktop\ffls_scode\trenddlg.cpp 89

错误6错误C2440:'static_cast':无法从'void(__ thiscall CManualDlg ::*)(int)'转换为'void(__thiscall CCmdTarget ::*)(UINT)'c:\ users \nima\desktop\ffls_scode\manualdlg.cpp 175

错误7错误C2440:'static_cast':无法从'void(__ thiscall CManualDlg ::*)(int)'转换为'void(__thiscall CCmdTarget ::*)(UINT)'c:\ users \nima\desktop\ffls_scode\manualdlg.cpp 177

错误8错误C2440:'static_cast':无法从'void(__ thiscall CManualDlg ::*)(int)'转换为'void(__thiscall CCmdTarget ::*)(UINT)'c:\ users \nima\desktop\ffls_scode\manualdlg.cpp 178

第一个错误源自以下代码行,其余类似:

ON_COMMAND_RANGE(IDC_CHECK_PEN, IDC_CHECK_GRID, OnCheckButtons)
ON_COMMAND_RANGE(IDC_REF_L1, IDC_REF_L16, OnCarriagePos)
ON_COMMAND_RANGE(IDC_VALVE_L1, IDC_VALVE_L4, OnValve)
ON_COMMAND_RANGE(IDC_SAMPLE_L_A, IDC_SAMPLE_L_B, OnDetector)
Run Code Online (Sandbox Code Playgroud)

其中(作为实例)OnCheckButtons函数的定义TrendDlg.cpp如下:

void CTrendDlg::OnCheckButtons(int id) 
{
    UINT    state;
    RECT    rect = {m_rect.left-60, m_rect.top-10, m_rect.right+40,       m_rect.bottom+30};

state = ((CButton*)GetDlgItem(id))->GetState();
if ((state & 0x0003) == …
Run Code Online (Sandbox Code Playgroud)

c++ mfc visual-c++-2012

2
推荐指数
1
解决办法
761
查看次数

vs2012 rc中基于范围的for循环

以下基于范围的for循环在VS2012中工作正常:

int values[] = {1, 2, 3};
for(int i: values)
{
}
Run Code Online (Sandbox Code Playgroud)

但是,这个不起作用:

for(int i: {1, 2, 3})
{
}
Run Code Online (Sandbox Code Playgroud)

有什么不同?

PS:我找不到std :: initializer_list模板类.我需要知道这个新VS2012 RC支持的C++ 11功能.任何的想法?

c++ visual-c++ c++11 visual-c++-2012

1
推荐指数
1
解决办法
1717
查看次数

decltype和成员函数(非指针)类型

struct C
{
    int Foo(int i) { return i; }

    typedef decltype(C::Foo) type;
};
Run Code Online (Sandbox Code Playgroud)

由于没有成员函数类型这样的类型(没有,有吗?),我希望C::type如此int (int).

但以下将无法使用Visual C++ 2012 RC进行编译:

std::function<C::type> f;
Run Code Online (Sandbox Code Playgroud)

那是什么类型的decltype(C::Foo)

c++ decltype visual-c++ c++11 visual-c++-2012

1
推荐指数
1
解决办法
2071
查看次数

C++中的WinRT异步文件操作

我目前正在开发一个需要一些文本资源的城域应用程序.构建过程的一部分是将所有这些资源复制到应用程序安装目录中的文件夹中.我想做的是收集这些资源文件的列表,并相应地处理每个文件.不幸的是,我这样做的尝试并不成功.

由于我正在为WinRT构建,我无法使用非常有用的"FindFirstFile"和"FindNextFile"函数.我一直在尝试使用WinRT异步文件IO操作完成工作.

auto getResourceFolder = installedLocation->GetFolderFromPathAsync(  folderPath  );

getResourceFolder->Completed = ref new Windows::Foundation::AsyncOperationCompletedHandler< Windows::Storage::StorageFolder^ >( 
[this]( Windows::Foundation::IAsyncOperation< Windows::Storage::StorageFolder^ >^ operation ) {

    if( operation->Status == Windows::Foundation::AsyncStatus::Completed ) {

        auto resourceFolder = operation->GetResults();
        auto getResourceFiles = resourceFolder->GetFilesAsync();
        getResourceFiles->Completed = ref new Windows::Foundation::AsyncOperationCompletedHandler< IVectorView< Windows::Storage::IStorageFile^ >^ >( 
        [this]( Windows::Foundation::IAsyncOperation< IVectorView< Windows::Storage::IStorageFile^ >^ >^ operation ) {

            if( operation->Status == Windows::Foundation::AsyncStatus::Completed ) {

                auto resourceFiles = operation->GetResults();

                for( unsigned int i = 0; i < resourceFiles->Size; ++i ) {

                    // Process File
                } …
Run Code Online (Sandbox Code Playgroud)

visual-c++ microsoft-metro windows-runtime c++-cx visual-c++-2012

0
推荐指数
1
解决办法
5265
查看次数

定义的常量在视觉工作室中表现得很奇怪

我正在使用visual studio 2012 professional来制作我的第一个windows/directx程序.在我的程序的顶部,我有这个:

3: #define SCREEN_HEIGHT 500;
4: #define SCREEN_WIDTH  400;
Run Code Online (Sandbox Code Playgroud)

在我决定使用常量之前,这非常合适:

49: //set size but not coordinates. we'll do that when we create the window
50: RECT clientArea = {0, 0, 500, 400};
51: //x-coordinates, y-coordinates, height, width
52: 
53: //Makes the previous struct have the values for the client area not the window
54: AdjustWindowRect(&clientArea, WS_OVERLAPPEDWINDOW, FALSE);
55: //address of previously defined RECT, window style, do we have a menu?
56: 
57: //create the window and store …
Run Code Online (Sandbox Code Playgroud)

c++ windows visual-studio-2012 visual-c++-2012

0
推荐指数
1
解决办法
370
查看次数