Results 1 to 5 of 5

Thread: getting error:ld returned 1 exit status(using Ubuntu 10.04,Qt Creator 4.7)

  1. #1
    Join Date
    Feb 2011
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default getting error:ld returned 1 exit status(using Ubuntu 10.04,Qt Creator 4.7)

    Hi,
    I am new to this forum,I am developing a project which includes member-function of class present in a static library..Heres the code
    Qt Code:
    1. //.pro file
    2. #-------------------------------------------------
    3. #
    4. # Project created by QtCreator 2011-02-23T22:43:47
    5. #
    6. #-------------------------------------------------
    7.  
    8. QT += core
    9.  
    10. QT -= gui
    11.  
    12. TARGET = testing
    13. CONFIG += console
    14. CONFIG -= app_bundle
    15.  
    16. TEMPLATE = app
    17.  
    18.  
    19. SOURCES += main.cpp
    20.  
    21. INCLUDEPATH += /opt/apogee/include
    22.  
    23. LIBS += /opt/apogee/include
    To copy to clipboard, switch view to plain text mode 
    Qt Code:
    1. //main.cpp
    2. #include <QtCore/QCoreApplication>
    3. #include <string.h>
    4. #include <stdio.h>
    5. #include <stdlib.h>
    6. #include "fitsio.h"
    7. #include<math.h>
    8. #include <unistd.h>
    9. #include <time.h>
    10. #include "tcl.h"
    11. #include "ApogeeUsb.h"
    12. #include "ApnCamera.h"
    13. double as;
    14. bool asd,cond;
    15.  
    16. namespace x
    17. {
    18. CApnCamera *al;
    19. };
    20.  
    21. int main(int argc, char *argv[])
    22. {
    23. QCoreApplication a(argc, argv);
    24. as=0.5;
    25. cond=true;
    26. unsigned long p=0,r=0;
    27. unsigned short q=0;
    28. using namespace x;
    29. asd=al->InitDriver(p,q,r);
    30. asd=al->Expose(as,cond);
    31. if(asd)
    32. printf("Initialized Properly");
    33.  
    34. return a.exec();
    35. }
    To copy to clipboard, switch view to plain text mode 

    I am getting the following errors in build issues
    :: error: /opt/apogee/include: No such file: File format not recognized
    :: error: collect2: ld returned 1 exit status

    and these errors in compile output

    g++ -Wl,-rpath,/home/subhash/qtsdk-2010.05/qt/lib -o testing main.o -L/home/subhash/qtsdk-2010.05/qt/lib /opt/apogee/include -lQtCore -L/home/subhash/qtsdk-2010.05/qt/lib -lpthread
    /usr/bin/ld: /opt/apogee/include: No such file: File format not recognized
    collect2: ld returned 1 exit status
    make: *** [testing] Error 1
    make: Leaving directory `/home/subhash/testing-build-desktop'
    The process "/usr/bin/make" exited with code %2.
    Error while building project testing (target: Desktop)
    When executing build step 'Make'

    Can anyone please help me?
    Thanking in advance

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: getting error:ld returned 1 exit status(using Ubuntu 10.04,Qt Creator 4.7)

    Qt Code:
    1. LIBS += /opt/apogee/include
    To copy to clipboard, switch view to plain text mode 
    That is not correct. You tell the linker to link to a directory.
    You should tell the linker to link to a library instead.

  3. #3
    Join Date
    Feb 2011
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: getting error:ld returned 1 exit status(using Ubuntu 10.04,Qt Creator 4.7)

    Quote Originally Posted by tbscope View Post
    Qt Code:
    1. LIBS += /opt/apogee/include
    To copy to clipboard, switch view to plain text mode 
    That is not correct. You tell the linker to link to a directory.
    You should tell the linker to link to a library instead.
    Thanks for the reply
    If i give
    Qt Code:
    1. LIBS += /opt/apogee/include/ApnCamera.h
    To copy to clipboard, switch view to plain text mode 
    i am getting the following error in build issues
    :: error: [main.o] Error 1

    and in compile output i get

    g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_CORE_LIB -DQT_SHARED -I../qtsdk-2010.05/qt/mkspecs/linux-g++ -I../testing -I../qtsdk-2010.05/qt/include/QtCore -I../qtsdk-2010.05/qt/include -I/opt/apogee/include/ApnCamera.h -I. -I../testing -I. -o main.o ../testing/main.cpp
    cc1plus: error: /opt/apogee/include/ApnCamera.h: not a directory
    make: *** [main.o] Error 1
    make: Leaving directory `/home/subhash/testing-build-desktop'
    The process "/usr/bin/make" exited with code %2.
    Error while building project testing (target: Desktop)
    When executing build step 'Make'

    Please help me out.

  4. #4
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: getting error:ld returned 1 exit status(using Ubuntu 10.04,Qt Creator 4.7)

    Qt Code:
    1. LIBS += /opt/apogee/include/ApnCamera.h
    To copy to clipboard, switch view to plain text mode 

    That is not correct. You tell the linker to link to an include file.
    You should tell the linker to link to a library instead.

  5. #5
    Join Date
    Feb 2011
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: getting error:ld returned 1 exit status(using Ubuntu 10.04,Qt Creator 4.7)

    Quote Originally Posted by tbscope View Post
    Qt Code:
    1. LIBS += /opt/apogee/include/ApnCamera.h
    To copy to clipboard, switch view to plain text mode 

    That is not correct. You tell the linker to link to an include file.
    You should tell the linker to link to a library instead.
    There are many .so and .a files in /opt/apogee/lib..Is there any way to find out which is the one that should be use.

Similar Threads

  1. error: collect2: ld returned 1 exit status
    By Splatify in forum Newbie
    Replies: 2
    Last Post: 13th February 2011, 18:09
  2. Replies: 7
    Last Post: 10th February 2011, 23:35
  3. Replies: 2
    Last Post: 4th January 2011, 17:55
  4. error: collect2: ld returned 1 exit status
    By srohit24 in forum Qt Programming
    Replies: 3
    Last Post: 1st December 2009, 06:32
  5. collect2: ld returned 1 exit status error
    By gmsk19 in forum Qt Tools
    Replies: 11
    Last Post: 25th July 2009, 02:05

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.