我对visual studio中的"字符集"选项有疑问.
字符集
- 未设置
- 使用Unicode字符集
- 使用多字节字符集
我想知道"字符集"中三个选项之间的区别.
而且,如果我选择其中的某些内容,则会影响对英语以外语言的支持.(比如RTL语言).
我已经尝试了谷歌搜索,并且基于各种具体情况有很多答案,坦率地说,我比我开始时更加困难.
事实如下:
请帮助我,修复当前在CreateDirectory上的尝试或使用其他东西来创建目录.
谢谢!
我有一个VS2008本机C++项目,我希望编译为DLL.
它只引用一个外部库(log4cplus.lib),并使用其功能.(当然也使用log4cplus的.h文件).
当我尝试将我的项目编译为静态库时,它会成功.当我尝试DLL时,它失败了:
1>MessageWriter.obj : error LNK2019: unresolved external symbol "public: static class log4cplus::Logger __cdecl log4cplus::Logger::getInstance(class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > const &)" (?getInstance@Logger@log4cplus@@SA?AV12@ABV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@Z) referenced in function "class log4cplus::Logger __cdecl Log(void)" (?Log@@YA?AVLogger@log4cplus@@XZ)
Run Code Online (Sandbox Code Playgroud)
还有4个与log4cplus.lib中的函数相关的错误.
看起来真的很蠢..请帮帮我:)
谢谢!
编辑:
我链接到log4cplus.lib文件,它发现它很好.另外,log4cplus.lib是100%功能的,我在另一个项目中使用它没有任何问题.我的初衷是将我的项目编译为静态库并在我正在编写的另一个DLL中使用它,但是当这样做时,我在其他项目中得到了相同的链接器错误...
编辑#2:
导致链接器错误的函数是静态函数..这可能是问题的一部分吗?
我正在尝试从openCV 2.4.5到Visual Studio 2010(基于VC++)的示例代码bagofwords_classification.cpp.但是我找到了错误代码:
error C2664: 'CreateDirectoryW' : cannot convert parameter 1 from 'const char *' to 'LPCWSTR'
Run Code Online (Sandbox Code Playgroud)
你能帮我解决一下这个问题吗?谢谢.:)
更新v1:
static void makeDir( const string& dir )
{
#if defined WIN32 || defined _WIN32
CreateDirectory( dir.c_str(), 0 );
#else
mkdir( dir.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH );
#endif
}
static void makeUsedDirs( const string& rootPath )
{
makeDir(rootPath + bowImageDescriptorsDir);
makeDir(rootPath + svmsDir);
makeDir(rootPath + plotsDir);
}
Run Code Online (Sandbox Code Playgroud) 大家好,我正在为学校制作一个基于文本的小冒险游戏,我想知道你是否可以将Unicode添加到C++.现在我添加了这个:Д但是当我调试我的游戏时它只是一个"?" 而不是"Д".我正在使用输出文本的iostream"cout"方法.我需要包含一些东西吗?我使用Visual Studio Express 2012.
这就是我打字的方式Д:
cout << "? |" << endl; //It's a part of the map
Run Code Online (Sandbox Code Playgroud) 我正在使用DirectX9进行一个简单的项目。我对数据类型的转换有些迷惑,并且已经做过一些研究,但是还没有发现任何特别有用的东西。让我们从代码开始:
LPDIRECT3DSURFACE9 LoadSurface(char *fileName, D3DCOLOR transColor)
{
LPDIRECT3DSURFACE9 image = NULL;
D3DXIMAGE_INFO info;
HRESULT result;
result = D3DXGetImageInfoFromFile(fileName, &info);
if (result != D3D_OK) return NULL;
result = d3ddev->CreateOffscreenPlainSurface(
info.Width, //width of the surface
info.Height, //height of the surface
D3DFMT_X8R8G8B8, //surface format
D3DPOOL_DEFAULT, //memory pool use
&image, //reference to image
NULL); //reserved - ALWAYS NULL
//make sure file loaded properly
if (result != D3D_OK) return NULL;
return image;
}
Run Code Online (Sandbox Code Playgroud)
在第6行,我得到了变量fileName的错误:
IntelliSense:“ char *”类型的参数与“ LPCWSTR”类型的参数不兼容
当尝试使用MessageBox时,我在第二个和第三个参数上也得到了完全相同的错误消息:
if (d3ddev == NULL)
{
MessageBox(hWnd, …Run Code Online (Sandbox Code Playgroud)