Avatar of funcoding
funcoding

asked on 

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

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

C++Programming

Avatar of undefined
Last Comment
funcoding
ASKER CERTIFIED SOLUTION
Avatar of funcoding
funcoding

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
C++
C++

C++ is an intermediate-level general-purpose programming language, not to be confused with C or C#. It was developed as a set of extensions to the C programming language to improve type-safety and add support for automatic resource management, object-orientation, generic programming, and exception handling, among other features.

58K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo