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. Collect2.exe:-1: error: error: ld returned 1 exit status [SOLVED]
Forum Updated to NodeBB v4.3 + New Features

Collect2.exe:-1: error: error: ld returned 1 exit status [SOLVED]

Scheduled Pinned Locked Moved Installation and Deployment
5 Posts 3 Posters 118.2k 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.
  • W Offline
    W Offline
    Whiterabbott
    wrote on 15 Dec 2013, 02:27 last edited by
    #1

    I have installed Qt 5.1.1 on my windows 8 machine. I am compiling with mingw and want in link to gsl.
    I set my paths to: C:\Program Files (x86)\GSL-1.13;C:\Qt\Tools\mingw48_32\bin

    My pro file is QT += core

    TARGET = gsl_test
    CONFIG += console
    CONFIG -= app_bundle
    CONFIG +=qt

    TEMPLATE = app

    SOURCES += main.cpp

    INCLUDEPATH += C://ProgramFiles(x86)//GSL-1.13//include
    LIBS +=-LC://ProgramFiles(x86)//GSL-1.13//lib -lgsl -lgslcblas -lm

    main.cpp

    #include <iostream>
    #include <iomanip>
    #include <fstream>
    #include <math.h>
    using namespace std;

    #include <gsl/gsl_sf_bessel.h> // gsl Bessel special function header file

    int
    main (void)
    {
    double x = 5.0; // just a random test value

    double y = gsl_sf_bessel_J0 (x); // see the GSL manual for details

    cout << "J0(" << x << ") = "
    << setprecision(18) << setw(20) << y << endl;

    return 0;
    }

    The errors that I get are,

    C:\Qt\Tools\QtCreator\bin\untitled\main.cpp:-1: error: undefined reference to `gsl_sf_bessel_J0'

    collect2.exe:-1: error: error: ld returned 1 exit status

    The compile output is,
    18:07:33: Running steps for project untitled...
    18:07:33: Configuration unchanged, skipping qmake step.
    18:07:33: Starting: "C:\Qt\Tools\mingw48_32\bin\mingw32-make.exe"
    C:/Qt/Tools/mingw48_32/bin/mingw32-make -f Makefile.Release
    mingw32-make[1]: Entering directory 'C:/Qt/Tools/QtCreator/bin/build-untitled-Desktop_Qt_5_1_1_MinGW_32bit-Release'
    g++ -Wl,-s -Wl,-subsystem,console -mthreads -o release\gsl_test.exe release/main.o -lglu32 -lopengl32 -lgdi32 -luser32 -LC://ProgramFiles(x86)//GSL-1.13//lib -lgsl -lgslcblas -lm -LC:\Qt\5.1.1\mingw48_32\lib -lQt5Gui -lQt5Core
    release/main.o:main.cpp:(.text.startup+0x23): undefined reference to `gsl_sf_bessel_J0'
    collect2.exe: error: ld returned 1 exit status
    Makefile.Release:77: recipe for target 'release\gsl_test.exe' failed
    mingw32-make[1]: *** [release\gsl_test.exe] Error 1
    mingw32-make[1]: Leaving directory 'C:/Qt/Tools/QtCreator/bin/build-untitled-Desktop_Qt_5_1_1_MinGW_32bit-Release'
    makefile:34: recipe for target 'release' failed
    mingw32-make: *** [release] Error 2
    18:07:34: The process "C:\Qt\Tools\mingw48_32\bin\mingw32-make.exe" exited with code 2.
    Error while building/deploying project untitled (kit: Desktop Qt 5.1.1 MinGW 32bit)
    When executing step 'Make'

    When I compiled this program using the command prompt with just MinGW I had an issue with permissions denied and would not create the .exe file unless I ran the command prompt as administrator. I ran qt creator as administrator but still got the same errors.

    Anyone have any ideas on what it causing these errors?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 15 Dec 2013, 20:59 last edited by
      #2

      Hi and welcome to devnet,

      The problem probably comes from the space in your linker paths. General rule of thumb on Windows: no spaces in paths, they're evil. Even when quoting them properly, they can be problematic.

      So you have two options there:

      • Reinstall your dependencies in folders without spaces
      • Use 8.3 names (you can get them using dir /x in a cmd prompt)

      If you still have symbols error, check that you link to the correct libraries

      Hope it helps

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • W Offline
        W Offline
        Whiterabbott
        wrote on 15 Dec 2013, 22:08 last edited by
        #3

        Yep, that did the trick.

        Thanks.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 15 Dec 2013, 22:32 last edited by
          #4

          You're welcome !

          Now that it building correctly, please update the thread title prepending [solved] so other forum users may know a solution has been found :)

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • G Offline
            G Offline
            Glasgow523
            Banned
            wrote on 29 Sept 2018, 05:49 last edited by
            #5
            This post is deleted!
            1 Reply Last reply
            -1

            • Login

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