We help IT Professionals succeed at work.
Get Started

QT build isse "collect2: Id returned 1 exit status"

funcoding
funcoding asked
on
828 Views
Last Modified: 2012-05-11
I am trying to get started with QT GUIs and went through a hello world program. Added QFileDialog and a Quit button. I then wanted to use the filename from QFileDialog as my video file source and display a video. Came across Phonon in QT help to display videos and was trying to add a video player when I started getting the ":: error: collect2: ld returned 1 exit status" error.

I would appreciate if someone can help me understand what I am doing wrong. Also, suggestion based on best practices as to where I should place the Videoplayer declaration/definition would be appreciated.

What I noticed was if I limit the Videoplayer line to just the player declaration, that is:
Phonon::VideoPlayer *player;
I don't get this error. Certainly its something simple and conceptual I am missing...
#include "hello.h"
#include "ui_hello.h"

hello::hello(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::hello)
{
    ui->setupUi(this);
    Phonon::VideoPlayer *player = new Phonon::VideoPlayer(Phonon::VideoCategory,this);
    
}

hello::~hello()
{
    delete ui;
}

void hello::on_pushButton_Quit_clicked()
{
    hello::close();
}

void hello::on_pushButton_Open_clicked()
{
    QString path;

    path = QFileDialog::getOpenFileName(this,"Open file...","/","Video(*.avi);All Files(*.*)");

    ui->lineEdit_FilePath->setText(path);

}

Open in new window

Comment
Watch Question
This problem has been solved!
Unlock 1 Answer and 1 Comment.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE