PDA

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



subhash.rao
24th February 2011, 06:11
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


//.pro file
#-------------------------------------------------
#
# Project created by QtCreator 2011-02-23T22:43:47
#
#-------------------------------------------------

QT += core

QT -= gui

TARGET = testing
CONFIG += console
CONFIG -= app_bundle

TEMPLATE = app


SOURCES += main.cpp

INCLUDEPATH += /opt/apogee/include

LIBS += /opt/apogee/include




//main.cpp
#include <QtCore/QCoreApplication>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "fitsio.h"
#include<math.h>
#include <unistd.h>
#include <time.h>
#include "tcl.h"
#include "ApogeeUsb.h"
#include "ApnCamera.h"
double as;
bool asd,cond;

namespace x
{
CApnCamera *al;
};

int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
as=0.5;
cond=true;
unsigned long p=0,r=0;
unsigned short q=0;
using namespace x;
asd=al->InitDriver(p,q,r);
asd=al->Expose(as,cond);
if(asd)
printf("Initialized Properly");

return a.exec();
}


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

tbscope
24th February 2011, 06:15
LIBS += /opt/apogee/include
That is not correct. You tell the linker to link to a directory.
You should tell the linker to link to a library instead.

subhash.rao
24th February 2011, 06:47
LIBS += /opt/apogee/include
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

LIBS += /opt/apogee/include/ApnCamera.h
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.

tbscope
24th February 2011, 06:50
LIBS += /opt/apogee/include/ApnCamera.h

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.

subhash.rao
24th February 2011, 09:20
LIBS += /opt/apogee/include/ApnCamera.h

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.