troubleshooting Question

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

Avatar of funcoding
funcoding asked on
C++Programming
1 Comment1 Solution830 ViewsLast Modified:
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

ASKER CERTIFIED SOLUTION
funcoding

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros