• <bdo id='XUgSl'></bdo><ul id='XUgSl'></ul>

      <i id='XUgSl'><tr id='XUgSl'><dt id='XUgSl'><q id='XUgSl'><span id='XUgSl'><b id='XUgSl'><form id='XUgSl'><ins id='XUgSl'></ins><ul id='XUgSl'></ul><sub id='XUgSl'></sub></form><legend id='XUgSl'></legend><bdo id='XUgSl'><pre id='XUgSl'><center id='XUgSl'></center></pre></bdo></b><th id='XUgSl'></th></span></q></dt></tr></i><div id='XUgSl'><tfoot id='XUgSl'></tfoot><dl id='XUgSl'><fieldset id='XUgSl'></fieldset></dl></div>

        <legend id='XUgSl'><style id='XUgSl'><dir id='XUgSl'><q id='XUgSl'></q></dir></style></legend>
        <tfoot id='XUgSl'></tfoot>

      1. <small id='XUgSl'></small><noframes id='XUgSl'>

        GLEW 和 glfw 编译错误:未定义对符号“XConvertSelec

        时间:2023-09-17
      2. <legend id='fIbFM'><style id='fIbFM'><dir id='fIbFM'><q id='fIbFM'></q></dir></style></legend>
        • <tfoot id='fIbFM'></tfoot>

          <small id='fIbFM'></small><noframes id='fIbFM'>

                <tbody id='fIbFM'></tbody>
                <bdo id='fIbFM'></bdo><ul id='fIbFM'></ul>

                <i id='fIbFM'><tr id='fIbFM'><dt id='fIbFM'><q id='fIbFM'><span id='fIbFM'><b id='fIbFM'><form id='fIbFM'><ins id='fIbFM'></ins><ul id='fIbFM'></ul><sub id='fIbFM'></sub></form><legend id='fIbFM'></legend><bdo id='fIbFM'><pre id='fIbFM'><center id='fIbFM'></center></pre></bdo></b><th id='fIbFM'></th></span></q></dt></tr></i><div id='fIbFM'><tfoot id='fIbFM'></tfoot><dl id='fIbFM'><fieldset id='fIbFM'></fieldset></dl></div>
                  本文介绍了GLEW 和 glfw 编译错误:未定义对符号“XConvertSelection"的引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在尝试编译此代码:

                  I'm trying to compile this code:

                  #include <stdio.h>
                  #include <stdlib.h>
                  
                  #include <GL/glew.h>
                  
                  #include <GLFW/glfw3.h>
                  GLFWwindow* window;
                  
                  #include <glm/glm.hpp>
                  using namespace glm;
                  
                  int main( void )
                  {
                      // Initialise GLFW
                      if( !glfwInit() )
                      {
                          fprintf( stderr, "Failed to initialize GLFW
                  " );
                          return -1;
                      }
                  
                      glfwWindowHint(GLFW_SAMPLES, 4);
                      glfwWindowHint(GLFW_RESIZABLE,GL_FALSE);
                      glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
                      glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
                      glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
                  
                      // Open a window and create its OpenGL context
                      window = glfwCreateWindow( 1024, 768, "Playground", NULL, NULL);
                      if( window == NULL ){
                          fprintf( stderr, "Failed to open GLFW window. If you have an Intel GPU, they are not 3.3 compatible. Try the 2.1 version of the tutorials.
                  " );
                          glfwTerminate();
                          return -1;
                      }
                      glfwMakeContextCurrent(window);
                  
                      // Initialize GLEW
                      if (glewInit() != GLEW_OK) {
                          fprintf(stderr, "Failed to initialize GLEW
                  ");
                          return -1;
                      }
                  
                      // Ensure we can capture the escape key being pressed below
                      glfwSetInputMode(window, GLFW_STICKY_KEYS, GL_TRUE);
                  
                      // Dark blue background
                      glClearColor(0.0f, 0.0f, 0.4f, 0.0f);
                  
                      do{
                          // Draw nothing, see you in tutorial 2 !
                  
                          // Swap buffers
                          glfwSwapBuffers(window);
                          glfwPollEvents();
                  
                      } // Check if the ESC key was pressed or the window was closed
                      while( glfwGetKey(window, GLFW_KEY_ESCAPE ) != GLFW_PRESS &&
                             glfwWindowShouldClose(window) == 0 );
                  
                      // Close OpenGL window and terminate GLFW
                      glfwTerminate();
                  
                      return 0;
                  }
                  

                  这是我找到的有关 OpenGL 的教程中的代码,在谈到 OpenGL 时,我主要使用 Java 进行编程,但我想尝试一些新的东西,所以我尝试使用 C++.

                  It's a code from a tutorial I found about OpenGL, I program mostly in Java when it comes to OpenGL, but I wanted to try something new so I went to try in C++.

                  我在这个项目中使用 QtCreator.起初我包含了 GLEW 和 glfw3 库:

                  I'm using QtCreator for this project. At first I included GLEW and glfw3 libraries:

                  对于 glfw 库文件也是如此.

                  And the same for the glfw library file.

                  然后,当我尝试编译程序时,出现此错误:

                  And then, when I try compiling the program I get this error:

                  在文本中:

                  $ /home/sapir/Qt/5.4/gcc_64/bin/qmake -spec linux-g++ CONFIG+=debug -o Makefile ../Test/Test.pro
                  $ g++ -Wl,-rpath,/home/sapir/Qt/5.4/gcc_64 -o Test main.o   -L/home/sapir/Dropbox/Development/Computer/openGLTest/Test/../../../../../../../usr/local/lib/ -lglfw3 -lGLEW -lGLEWmx 
                  /usr/bin/ld: /home/sapir/Dropbox/Development/Computer/openGLTest/Test/../../../../../../../usr/local/lib//libglfw3.a(glx_context.c.o): undefined reference to symbol 'glXQueryExtension'
                  //usr/lib/x86_64-linux-gnu/mesa/libGL.so.1: error adding symbols: DSO missing from command line
                  collect2: error: ld returned 1 exit status
                  make: *** [Test] Error 1
                  23:12:13: The process "/usr/bin/make" exited with code 2.
                  Error while building/deploying project Test (kit: Desktop Qt 5.4.0 GCC 64bit)
                  When executing step "Make"
                  23:12:13: Elapsed time: 00:00.
                  

                  我厌倦了在论坛和这里寻找答案,但我找不到任何可以解决此问题的方法.有人有什么想法吗?

                  I tired searching for an answer in forums and here, but I couldn't find anything that solved this problem. Anybody got any Ideas?

                  添加后

                  -lXxf86vm -lXrandr -lGL -lGLU -lXi
                  

                  对于 gcc 编译器,我得到一个不同的错误,其中包含:

                  to the gcc compiler, I get a different error, which contains:

                  /usr/bin/ld: /home/sapir/Dropbox/Development/Computer/openGLTest/Test/../../../../../../../usr/local/lib//libglfw3.a(x11_window.c.o): undefined reference to symbol 'XConvertSelection'
                  

                  这是我的制作文件:http://pastebin.com/xL5Hpwsf

                  这是我的 .pro 文件:http://pastebin.com/yhkV7nn7

                  And this is my .pro file: http://pastebin.com/yhkV7nn7

                  推荐答案

                  好的,经过一番研究,我发现我得到的 DSO 错误意味着我实现的包含的顺序不正确导致编译失败.

                  Ok, after some research I found that the DSO error which I got means that the order of the includes I've implemented is incorrect and cause the compilation to fail.

                  所以我所做的就是使用命令:

                  So what I did is I used the command:

                  pkg-config --static --libs x11 xrandr xi xxf86vm glew glfw3
                  

                  为了得到我需要的包,它们才能以正确的顺序运行.

                  To get the packages I need for them to run and in the right order.

                  然后我相应地编译了项目.就是这样:)

                  Then I compiled the project accordingly. That's it :)

                  这篇关于GLEW 和 glfw 编译错误:未定义对符号“XConvertSelection"的引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:OpenGL - 围绕 Y 轴旋转“曲线" 下一篇:如何在不违反 C++ 核心准则的情况下将整数转换为

                  相关文章

                  最新文章

                    1. <small id='ty0xv'></small><noframes id='ty0xv'>

                        <bdo id='ty0xv'></bdo><ul id='ty0xv'></ul>
                      <tfoot id='ty0xv'></tfoot>
                    2. <i id='ty0xv'><tr id='ty0xv'><dt id='ty0xv'><q id='ty0xv'><span id='ty0xv'><b id='ty0xv'><form id='ty0xv'><ins id='ty0xv'></ins><ul id='ty0xv'></ul><sub id='ty0xv'></sub></form><legend id='ty0xv'></legend><bdo id='ty0xv'><pre id='ty0xv'><center id='ty0xv'></center></pre></bdo></b><th id='ty0xv'></th></span></q></dt></tr></i><div id='ty0xv'><tfoot id='ty0xv'></tfoot><dl id='ty0xv'><fieldset id='ty0xv'></fieldset></dl></div>
                      <legend id='ty0xv'><style id='ty0xv'><dir id='ty0xv'><q id='ty0xv'></q></dir></style></legend>