Qt的问题

liu54ee 2015-09-09 09:19:12
\Qt5.0\5.5\msvc2013_64\mkspecs\win32-msvc2013 -Fodebug\ @C:\Users\mains\AppData\Local\Temp\Scene.obj.12568.688.jom
Scene.cc
g:\dpix-master\dpix\src\Session.h(89) : warning C4267: 'return' : conversion from 'size_t' to 'int', possible loss of data
g:\dpix-master\dpix\src\Session.h(89) : warning C4267: 'return' : conversion from 'size_t' to 'int', possible loss of data
g:\dpix-master\dpix\src\Session.h(89) : warning C4267: 'return' : conversion from 'size_t' to 'int', possible loss of data
e:\toolsoftware\qt5.0\5.5\msvc2013_64\include\qtcore\qthread.h(106) : error C2059: syntax error : '('
e:\toolsoftware\qt5.0\5.5\msvc2013_64\include\qtcore\qthread.h(106) : error C2143: syntax error : missing ',' before '/'
e:\toolsoftware\qt5.0\5.5\msvc2013_64\include\qtcore\qthread.h(106) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
e:\toolsoftware\qt5.0\5.5\msvc2013_64\include\qtcore\qthread.h(106) : error C2059: syntax error : '/'
jom: G:\dpix-master\build-dpix-Desktop_Qt_5_5_0_MSVC2013_64bit-Debug\Makefile.Debug [debug\MainWindow.obj] Error 2
cl -c -nologo -Zc:wchar_t -FS -Zi -MDd -GR -W3 -w34100 -w34189 -w44996 -EHsc /Fddebug\dpix.pdb -DUNICODE -DWIN32 -DWIN64 -DQGLVIEWER_STATIC -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_XML_LIB -DQT_CORE_LIB -I..\dpix -I. -I..\libnpr\include -I..\libgq\include -I..\libcda\include -I..\qglviewer -I..\dpix\src -IE:\toolsoftware\Qt5.0\5.5\msvc2013_64\include -IE:\toolsoftware\Qt5.0\5.5\msvc2013_64\include\QtOpenGL -IE:\toolsoftware\Qt5.0\5.5\msvc2013_64\include\QtWidgets -IE:\toolsoftware\Qt5.0\5.5\msvc2013_64\include\QtGui -IE:\toolsoftware\Qt5.0\5.5\msvc2013_64\include\QtANGLE -IE:\toolsoftware\Qt5.0\5.5\msvc2013_64\include\QtXml -IE:\toolsoftware\Qt5.0\5.5\msvc2013_64\include\QtCore -Idebug -I. -IE:\toolsoftware\Qt5.0\5.5\msvc2013_64\mkspecs\win32-msvc2013 -Fodebug\ @C:\Users\mains\AppData\Local\Temp\Session.obj.12568.3938.jom
Session.cc
g:\dpix-master\dpix\src\Session.h(89) : warning C4267: 'return' : conversion from 'size_t' to 'int', possible loss of data
..\dpix\src\Session.cc(87) : warning C4267: 'initializing' : conversion from 'size_t' to 'int', possible loss of data
..\dpix\src\Session.cc(446) : warning C4267: 'initializing' : conversion from 'size_t' to 'int', possible loss of data
..\dpix\src\Session.cc(468) : warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data
jom: G:\dpix-master\build-dpix-Desktop_Qt_5_5_0_MSVC2013_64bit-Debug\Makefile [debug] Error 2
21:12:49: The process "E:\toolsoftware\Qt5.0\Tools\QtCreator\bin\jom.exe" exited with code 2.
Error while building/deploying project dpix (kit: Desktop Qt 5.5.0 MSVC2013 64bit)
When executing step "Make"

能解释一下上面的错误吗?
qthread.h是我的库文件啊,为什么他会出错?

大神求指导?
...全文
349 6 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
欧阳春晖 2015-09-10
  • 打赏
  • 举报
回复
引用 4 楼 liu15073458538 的回复:
[quote=引用 2 楼 liyage5335 的回复:] 感觉冲突了,usleep这个函数本来就有,和宏冲突了
引用 3 楼 walkiz 的回复:
应该是前面已经定义了usleep宏,命名冲突了吧。
是的找到那个地方了,是我Include的一个头文件
#ifndef TIMESTAMP_H
#define TIMESTAMP_H
/*
Szymon Rusinkiewicz
Princeton University

timestamp.h
Wrapper around system-specific timestamps.
*/


#ifdef WIN32

# define WIN32_LEAN_AND_MEAN
# include <limits.h>
# include <windows.h>
# define usleep(x) Sleep((x)/1000)

  struct timestamp { LARGE_INTEGER t; };

  static inline double LI2d(const LARGE_INTEGER &li)
  {
	// Work around random compiler bugs...
	double d = *(unsigned *)(&(li.HighPart));
	d *= 65536.0 * 65536.0;
	d += *(unsigned *)(&(li.LowPart));
	return d;
  }
但是我还有问题,就是我的头文件既然有了这样一个宏定义,那我该怎么处理呢,我是在编译老师给的代码,代码本身并不清楚 我想知道给我前辈遇到这种情况,是怎样的处理方式呢? 如果我直接把库文件的那个函数屏蔽应该会有问题吧? [/quote] #undef usleep
liu54ee 2015-09-10
  • 打赏
  • 举报
回复
#ifndef TIMESTAMP_H
#define TIMESTAMP_H
/*
Szymon Rusinkiewicz
Princeton University

timestamp.h
Wrapper around system-specific timestamps.
*/


#ifdef WIN32

# define WIN32_LEAN_AND_MEAN
# include <limits.h>
# include <windows.h>
# define usleep(x) Sleep((x)/1000)

  struct timestamp { LARGE_INTEGER t; };

  static inline double LI2d(const LARGE_INTEGER &li)
  {
	// Work around random compiler bugs...
	double d = *(unsigned *)(&(li.HighPart));
	d *= 65536.0 * 65536.0;
	d += *(unsigned *)(&(li.LowPart));
	return d;
  }

  static inline float operator - (const timestamp &t1, const timestamp &t2)
  {
	static LARGE_INTEGER PerformanceFrequency;
	static int status = QueryPerformanceFrequency(&PerformanceFrequency);
	if (status == 0) return 1.0f;

	return float((LI2d(t1.t) - LI2d(t2.t)) / LI2d(PerformanceFrequency));
  }

  static inline timestamp now()
  {
	timestamp t;
	QueryPerformanceCounter(&t.t);
	return t;
  }

#else
liu15073458538 2015-09-10
  • 打赏
  • 举报
回复
引用 2 楼 liyage5335 的回复:
感觉冲突了,usleep这个函数本来就有,和宏冲突了
引用 3 楼 walkiz 的回复:
应该是前面已经定义了usleep宏,命名冲突了吧。
是的找到那个地方了,是我Include的一个头文件
#ifndef TIMESTAMP_H
#define TIMESTAMP_H
/*
Szymon Rusinkiewicz
Princeton University

timestamp.h
Wrapper around system-specific timestamps.
*/


#ifdef WIN32

# define WIN32_LEAN_AND_MEAN
# include <limits.h>
# include <windows.h>
# define usleep(x) Sleep((x)/1000)

  struct timestamp { LARGE_INTEGER t; };

  static inline double LI2d(const LARGE_INTEGER &li)
  {
	// Work around random compiler bugs...
	double d = *(unsigned *)(&(li.HighPart));
	d *= 65536.0 * 65536.0;
	d += *(unsigned *)(&(li.LowPart));
	return d;
  }
但是我还有问题,就是我的头文件既然有了这样一个宏定义,那我该怎么处理呢,我是在编译老师给的代码,代码本身并不清楚 我想知道给我前辈遇到这种情况,是怎样的处理方式呢? 如果我直接把库文件的那个函数屏蔽应该会有问题吧?
宋寒松 2015-09-10
  • 打赏
  • 举报
回复
应该是前面已经定义了usleep宏,命名冲突了吧。
liyage 2015-09-10
  • 打赏
  • 举报
回复
感觉冲突了,usleep这个函数本来就有,和宏冲突了
liu54ee 2015-09-09
  • 打赏
  • 举报
回复

65,186

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧