Results 1 to 6 of 6

Thread: Qt sub-project undefined reference to `main'

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,332
    Qt products
    Qt5
    Platforms
    Windows
    Thanks
    317
    Thanked 871 Times in 858 Posts

    Default Re: Qt sub-project undefined reference to `main'

    .../glibc-2.19/sysdeps/x86_64/start.S:118:
    Looks like you are building with a 64-bit compiler. Are you linking to 64-bit libraries?

  2. #2
    Join Date
    Apr 2013
    Location
    Prague
    Posts
    258
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    3
    Thanked 65 Times in 59 Posts

    Default Re: Qt sub-project undefined reference to `main'

    Where did you added the main.cpp? A multitarget project consists of a "root" project (which you will make) and subprojects. The "root" project contains:
    Qt Code:
    1. TEMPLATE = subdirs
    To copy to clipboard, switch view to plain text mode 
    and directives controlling the order or making the subprojects. Either the "depends" directives
    Qt Code:
    1. <build next>.depends = <build first>
    To copy to clipboard, switch view to plain text mode 
    for example
    Qt Code:
    1. testapp.depends = library
    To copy to clipboard, switch view to plain text mode 
    (more such directives can be present) or the "ordered" directive:
    Qt Code:
    1. CONFIG += ordered
    To copy to clipboard, switch view to plain text mode 
    in the later case, the subprojects will be made in the order they have been added to the project. No SOURCES directive in the main project (see Chris post).

    Supposing you are using Creator, do the following:
    (1) Create the root project. It will contain only one line for now.
    Qt Code:
    1. TEMPLATE = subdirs
    To copy to clipboard, switch view to plain text mode 
    Save.
    (2) Add a subproject: Right-click the "root" project directory and select "Add Subproject". Select the name of the subproject (for example testapp). This will create a subdirectory "testapp". Create a profile for testapp. It must be testapp.pro, otherwise the profile won't be found. The testapp subproject is a "full sized" project containing sources (for example main.cpp) resources and other things.
    (3) Add another subproject.
    ...
    (4) Return to the root project and specify dependencies.
    (5) Go to the configuration page of the Creator and select what it should make: Select "Run" and set the root project.

  3. #3
    Join Date
    Sep 2014
    Posts
    9
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt sub-project undefined reference to `main'

    Thank ChrisW67, d_stranz and Radek for your suggestion, I was able to fix it, just remove
    Qt Code:
    1. config
    To copy to clipboard, switch view to plain text mode 
    from the root pro file

Similar Threads

  1. undefined reference
    By deepakswaroop in forum Newbie
    Replies: 1
    Last Post: 2nd March 2011, 06:46
  2. Undefined reference
    By eekhoorn12 in forum Qt Programming
    Replies: 2
    Last Post: 6th January 2011, 15:45
  3. undefined reference
    By digidas in forum Newbie
    Replies: 9
    Last Post: 19th May 2010, 13:04
  4. undefined reference
    By jayreddy in forum Qt Programming
    Replies: 1
    Last Post: 20th November 2009, 13:45
  5. Undefined reference to crt
    By derektaprell in forum Installation and Deployment
    Replies: 0
    Last Post: 20th October 2009, 08:34

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.