我一直试图用C++测试GLFW很长一段时间,并且我一直有链接器问题.我是C++的新手,虽然我有Java和C#的经验,直接使用编译器对我来说是个新手.这是我的设置信息.
IDE:Qt Creator
操作系统:Windows 7 64位
编译器:MinGW32 4.8.1
01:23:26: Starting: "C:\MinGW\bin\mingw32-make.exe"
C:/MinGW/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory 'A:/workspace_cpp/Test-Debug'
g++ -Wl,-subsystem,console -mthreads -o debug\Test.exe debug/main.o -lglfw3 -lopengl32
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libglfw3.a(win32_monitor.c.obj):win32_monitor.::(.text+0x2c7): undefined reference to `CreateDCW@16'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x358): undefined reference to `GetDeviceCaps@8'
Makefile.Debug:77: recipe for target 'debug\Test.exe' failed
mingw32-make[1]: Leaving directory 'A:/workspace_cpp/Test-Debug'
Makefile:34: recipe for target 'debug' failed
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x370): undefined reference to `GetDeviceCaps@8'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libglfw3.a(win32_monitor.c.obj):win32_monitor .c:(.text+0x39e): undefined reference to `DeleteDC@4'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../libglfw3.a(win32_monitor.c.obj): bad reloc address 0x20 in section `.eh_frame'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: final link failed: Invalid operation
collect2.exe: error: …Run Code Online (Sandbox Code Playgroud) 最近我用QT Creator开发了C++.一切都很好,我几乎正在打包和分发我的应用程序.但显然在任何发布之前,你最好确保一切正确.所以我正处于测试阶段,有些东西告诉我,我有一些轻微的内存问题.没什么大不了的,但我喜欢这些; ...).
所以我决定尝试一些内存泄漏检测库.对于初学者,我看了这个问题.由于费用原因,我无视Purify和Insure ++.其他人建议使用MSVC编译器,以便我可以使用CRT内存验证例程.我考虑过但现在决定反对,因为它会对在QT Creator中使用调试器产生影响.
然后我偶然发现了DUMA,我使用QT附带的MinGW32编译器进行编译.然而,我发现由于令人难以置信的分段错误,它在QT中并不能很好地发挥作用.我知道他们是DUMA的工作方式,但我很确定我没有像DUMA试图让我相信的那样搞砸了.
我尝试的另一件事是谷歌性能工具,我很遗憾无法使用QT提供的MinGW32版本进行编译,即使我添加了所需的依赖项.
所有这些都让我想到了一个问题:QT Creator开发人员是否有任何可行的解决方案想要检查他们的程序是否存在内存泄漏?
谢谢,
我的exe在我编程的计算机上运行完全正常.它调试很好,发布很好,我可以将exe文件从'release'文件夹移动到一个新文件中,从C:\ pathtoqt\ming47_32\bin找到所需的.dll文件,它仍然运行正常.但是,当我尝试在包含.dll文件的另一台计算机上运行此程序时,我无法执行此操作并且我得到"应用程序已请求运行时以不寻常的方式终止它".
我在2台Windows 7计算机和1台Windows XP上测试了这个.我使用了依赖walker并下载了一堆.dll,它仍然没有用.我设法让所有的dll成为"找到"状态或"红色"状态.
构建设置:http://puu.sh/3qTV3.png
我使用的是Qt5.0.2,mingGW 4.7 32bit.
我也偶然发现了这个... http://puu.sh/3qU6j.png
我正在使用mingw32工具从linux到windows的交叉编译.我需要生成pdb文件以便在Windows上进行调试.有没有办法做到这一点?
我刚刚更新MinGW的使用mingw-get-setup状态,我无法构建一个包含点儿什么<cmath>,如果我使用任何大于头-O0用-std=c++1y.(我也试过c++11和c++98)我得到象这样的错误之一:
g++.exe -pedantic-errors -pedantic -Wextra -Wall -std=c++1y -O3 -c Z:\Projects\C++\L6\src\events.cpp -o obj\src\events.o
In file included from z:\lander\mingw\lib\gcc\mingw32\4.8.1\include\c++\cmath:44:0,
from Z:\Projects\C++\L6\src\utils.h:4,
from Z:\Projects\C++\L6\src\events.cpp:10:
z:\lander\mingw\include\math.h: In function 'float hypotf(float, float)':
z:\lander\mingw\include\math.h:635:30: error: '_hypot' was not declared in this scope
{ return (float)(_hypot (x, y)); }
Run Code Online (Sandbox Code Playgroud)
我这边有什么不对劲吗?
或mingw repo的版本被窃听?如果是这样,这个标题有什么快速解决方法吗?
我正在使用Windows上的Qt 4.7.2.我已生成Makefile,Makefile.Debug和Makefile.Release.但是,当我尝试使用mingw32-make构建可执行文件时,我收到以下错误:
mingw32-make -f Makefile.Debug all
mingw32-make[1]: Entering directory `C:/Qt/4.7.2/src/plugins/sqldrivers/mysql'
Makefile.Debug:61: *** missing separator. Stop.
mingw32-make[1]: Leaving directory `C:/Qt/4.7.2/src/plugins/sqldrivers/mysql'
mingw32-make: *** [debug-all] Error 2
Run Code Online (Sandbox Code Playgroud) 我已经多次构建了glew lib.我的上一个构建删除了对所有着色器函数的未定义引用,例如glCreateShader().我认为这个构建是正确的,因为我发现Code:Blocks可以打开Visual Studio 6.0项目,所以它为我准备了一切.
我可以glewInit()在不调用的情况下编译我的应用程序但是在调用时它会导致SEGFAULT glCreateShader().这是由于没有初始化glew引起的.
我需要打开它,但它不会让我XD
链接:mingw32,glew32,opengl32,glu32,glut32
IDE:Code :: Blocks
编译:MINGW32
有了这个环境,我编译了一个在线发布的c ++/openGL示例:
#define GLEW_STATIC
// third-party libraries
#include <windows.h>
#include <GL/glew.h>
#include <GL/glfw.h>
#include <glm/glm.hpp>
#include <cassert>
#include <iostream>
#include <stdexcept>
GLuint gVAO = 0;
GLuint gVBO = 0;
GLuint programId;
const glm::vec2 SCREEN_SIZE(800, 600);
static void LoadTriangle() {
// make and bind the VAO
glGenVertexArrays(1, &gVAO);
glBindVertexArray(gVAO);
// make and bind the VBO
glGenBuffers(1, &gVBO);
glBindBuffer(GL_ARRAY_BUFFER, gVBO);
// Put the three triangle verticies …Run Code Online (Sandbox Code Playgroud) 我正在ubuntu下用i586-mingw32msvc交叉编译一个应用程序.
我很难理解如何嵌入清单文件以使用mingw32要求管理员执行级别.
对于我的例子,我使用了这个hello.c:
int main() {
return 0;
}
Run Code Online (Sandbox Code Playgroud)
这个资源文件hello.rc:
1 Manifest "hello.exe.manifest"
Run Code Online (Sandbox Code Playgroud)
这个清单文件hello.exe.manifest:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" processorArchitecture="X86" name="hello" type="win32"/>
<description>Hello World</description>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
Run Code Online (Sandbox Code Playgroud)
我编译我的资源文件:
i586-mingw32msvc-windres hello.rc hello.o
Run Code Online (Sandbox Code Playgroud)
我编译我的最终申请:
i586-mingw32msvc-gcc -O3 -Os -s -o hello.exe hello.c hello.o
Run Code Online (Sandbox Code Playgroud)
SigCheck不显示正在运行的清单文件sigcheck -m hello.exe.
现在,当我在Windows下运行我的应用程序时,它不会触发UAC(=不以管理员身份运行),而当我将hello.exe.manifest文件附加到同一文件夹时,它会触发UAC(如预期的那样).
我错过了什么?
EDIT1:摆弄资源黑客我已经开了Setup.exe,我用NSIS创建的文件,唯一明智的区别是,Manifest写MANIFEST在我hello.exe和 …