Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Non Qt project (Cmake) - troubles with linking to library
Qt 6.11 is out! See what's new in the release blog

Non Qt project (Cmake) - troubles with linking to library

Scheduled Pinned Locked Moved Installation and Deployment
2 Posts 2 Posters 1.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mc001
    wrote on last edited by
    #1

    Hi guys,

    I freshly installed Qt Creator with MinGW and Cmake. I'm trying to play with OpenGL.
    So far I got this code:

    @#include <GLFW/glfw3.h>

    int main()
    {
    if (!glfwInit()) {
    return -1;
    }

    return 0;
    

    }@

    My CMakeLists.txt is like this:

    @cmake_minimum_required(VERSION 2.8)
    project(world_0)

    aux_source_directory(. SRC_LIST)
    file(GLOB SRC_LIST *.cpp)

    find_package(GLFW3 REQUIRED)

    include_directories(F:/u_qt/libs/glfw/glfw-3.0.1/include)
    link_directories(F:/u_qt/libs/glfw/glfw-3.0.1/lib-mingw)

    add_executable(${PROJECT_NAME} ${SRC_LIST})
    target_link_libraries(${PROJECT_NAME} glfw3)@

    I've added FindGLFW3.cmake from "FindGLFW3.make":https://raw.github.com/zero57/CMakeScripts/master/FindGLFW3.cmake
    But still got 'undefined reference' error.

    I will be glad to hear any feedback from you guys. Cheers.

    1 Reply Last reply
    0
    • B Offline
      B Offline
      bodzio131
      wrote on last edited by
      #2

      Paste complete error message, please. Very often 'undefined reference' error is not connected with particular library (in this case OpenGL), but with some other not fulfilled dependencies.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved