小编Dže*_*nan的帖子

CMake RelWithDebInfo链接到Debug libs

我有一个项目链接到六个库,其中包括OpenCV.
由于Release变量崩溃,而Debug工作正常(只是慢很多),我想在RelWithDebInfo配置中编译我的项目.
但是,Debug包含OpenCV库的版本而不是Release(OpenCV没有RelWithDebInfo变体).这会导致链接错误,例如:

opencv_core249d.lib(alloc.obj):错误LNK2038:检测到'RuntimeLibrary'不匹配:值'MDd_DynamicDebug'与MyProject.obj中的值'MD_DynamicRelease'不匹配

如何解决这个问题呢?

c++ linker opencv cmake

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

为什么不将reinterpret_cast转换为'unsigned char'为'char'?

我正在尝试使用MSVC10 编译这个库,这个函数让我很头疼:

/*! \brief Read bytes from a \c std::istream
    \param is The stream to be read.
    \param data A pointer to a location to store the bytes.
    \param size The number of bytes to be read.
*/
void _read(std::istream &is, unsigned char *data, int size)
{
    for (int i=0; i < size ; ++i )
      is.get(static_cast<char>(data[i]));
}
Run Code Online (Sandbox Code Playgroud)

错误C2664:'std :: basic_istream <_Elem,_ Traits>&std :: basic_istream <_Elem,_Traits> :: get(_Elem&)':无法将参数1从'char'转换为'char&'

原来使用的是static_cast,所以我按照其他地方的建议尝试使用reinterpret_cast但是也失败了:

错误C2440:'reinterpret_cast':无法从'unsigned char'转换为'char'

该库附带unix makefile.解决此编译错误的最佳方法是什么?

c++ unix visual-studio-2010

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

VS2010中的C99:uint8_t*非法使用类型

我正在使用VC2010,尝试编译一些用C99 for Linux编写的库.以下行给出了错误C2275:'uint8_t':非法使用此类型作为表达式

uint8_t * G = (uint8_t*)calloc(N ,sizeof(uint8_t));
Run Code Online (Sandbox Code Playgroud)

subhint:stdint.h(21):查看'uint8_t'的声明,该行是:

typedef unsigned char uint8_t;
Run Code Online (Sandbox Code Playgroud)

然后来累积的问题:错误C2065:'G':未声明的标识符等什么是非法的?

c++ c99 visual-studio-2010 visual-c++

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

从包文件中恢复git repo

我正在接管一些项目,我没有一个合适的git repo,而是一个包-7dab97d983eeb36321c680bee7fde43688334f52.pack文件.我可以从中恢复一个有效的git存储库吗?如何?

git

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

标签 统计

c++ ×3

visual-studio-2010 ×2

c99 ×1

cmake ×1

git ×1

linker ×1

opencv ×1

unix ×1

visual-c++ ×1