我正在用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 ++做过很多项目所以我不知道为什么会这样.请帮忙!
我正在玩新的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中运行?
我正在尝试使用vs2012 Express编译发布可执行文件.但是,每当我尝试在其他计算机上运行.exe时,我都会收到警告,提示我需要msvcr110.dll.我可以简单地复制dll,但我正在寻找更长期的解决方案.
在我尝试隔离导致错误的原因时,我已使用默认设置恢复为新的c ++项目,但在配置管理器中将配置更改为release.
我一直在努力解决这个问题一个多星期没有任何进展,所以任何建议都会受到赞赏.
#include <arpa/inet.h>
Run Code Online (Sandbox Code Playgroud)
我收到了这种错误
无法打开包含文件:'arpa/inet.h':
如何包含此头文件?我实际上是在VC++ 2012中执行此代码.
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) 我有一个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) 以下基于范围的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功能.任何的想法?
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)?
我目前正在开发一个需要一些文本资源的城域应用程序.构建过程的一部分是将所有这些资源复制到应用程序安装目录中的文件夹中.我想做的是收集这些资源文件的列表,并相应地处理每个文件.不幸的是,我这样做的尝试并不成功.
由于我正在为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
我正在使用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) visual-c++-2012 ×10
c++ ×8
visual-c++ ×6
c++11 ×2
c ×1
c++-cx ×1
decltype ×1
intrinsics ×1
map ×1
mfc ×1
multimap ×1
stl ×1
templates ×1
windows ×1