Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Can't compile for mobile (but compiles for desktop)
QtWS25 Last Chance

Can't compile for mobile (but compiles for desktop)

Scheduled Pinned Locked Moved Installation and Deployment
10 Posts 4 Posters 3.8k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    Etchelon
    wrote on last edited by
    #1

    Hi there,
    I'm coding a calculator (my first app ever, so I know very little about IDEs and deployment and stuff like that) with Qt and Qt Creator.
    The project correctly compiles for desktop target (Qt 4.7.4), both in debug and release with the same warnings (unrelated to the environment used, all about C++ syntax, like "reaches end of non void function").

    When I try to compile for Harmattan (I have a Nokia N9 and want to install my calculator, for testing), I get the error message "multiple definitions of 'main'", already defined in 'main.cpp'. O rly??

    When compiling for Symbian I get yet another error, but I'm really just interested in getting the app to run on my N9. What's going wrong?? The error suggests that some files that some files for Harmattan, that are automatically handled by Qt Creator, already contain a main function...but it seems unreal to me, why would that be??

    Thanks in advance :)

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      welcome to devnet

      When reading about your problems, it sounds a bit like you some tangling braces or macro block.
      But that should be found already by the creator.

      Is the routine where you are getting the warning on the desktop short? You may want to post it here.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • E Offline
        E Offline
        Etchelon
        wrote on last edited by
        #3

        This is what happens:
        http://dl.dropbox.com/u/34618667/multiple_main.jpg
        Weird, isn't it? Obviously, there's no other part in my code where I dare to define main()...

        Atm I'd like to keep the rest for myself. If need be I may post more.

        1 Reply Last reply
        0
        • G Offline
          G Offline
          goetz
          wrote on last edited by
          #4

          Can you share the .pro file with us please?

          http://www.catb.org/~esr/faqs/smart-questions.html

          1 Reply Last reply
          0
          • E Offline
            E Offline
            Etchelon
            wrote on last edited by
            #5

            Here is the pro:
            @# Add files and directories to ship with the application

            by adapting the examples below.

            file1.source = myfile

            dir1.source = mydir

            DEPLOYMENTFOLDERS = # file1 dir1

            symbian:TARGET.UID3 = 0xE2C762B1

            Smart Installer package's UID

            This UID is from the protected range

            and therefore the package will fail to install if self-signed

            By default qmake uses the unprotected range value if unprotected UID is defined for the application

            and 0x2002CCCF value if protected UID is given to the application

            #symbian:DEPLOYMENT.installer_header = 0x2002CCCF

            Allow network access on Symbian

            symbian:TARGET.CAPABILITY += NetworkServices

            If your application uses the Qt Mobility libraries, uncomment

            the following lines and add the respective components to the

            MOBILITY variable.

            CONFIG += mobility

            MOBILITY +=

            SOURCES += main.cpp
            tokenize.cpp
            mathematics.cpp
            main.cpp
            grammar.cpp
            calculator.cpp
            HEADERS +=
            ui_simple.h
            tokenize.h
            mathemathics.h
            errorF.h
            characters.h
            calculator.h
            FORMS +=
            simple.ui

            Please do not modify the following two lines. Required for deployment.

            include(deployment.pri)
            qtcAddDeployment()

            OTHER_FILES +=
            qtc_packaging/debian_harmattan/rules
            qtc_packaging/debian_harmattan/README
            qtc_packaging/debian_harmattan/manifest.aegis
            qtc_packaging/debian_harmattan/copyright
            qtc_packaging/debian_harmattan/control
            qtc_packaging/debian_harmattan/compat
            qtc_packaging/debian_harmattan/changelog
            @
            Automatically generated by Qt Creator 2.4.1 upon the creation of a new Qt Widget Project of type Mobile Qt Application.

            Thanks to you I noticed that main.cpp is included twice in SOURCES...I think this happened because the Qt Widget template project comes with main_window.h, main_window.cpp, and main.cpp and I copied and pasted all my sources into the folder. main.cpp was overwritten but it seems like the .pro file didn't notice and included it two times...

            Now that I corrected this, it seems to compile but... "installing package failed - file not found". Seems like I'm destined to use my calculator only on PC :(

            Thanks again for your time :)

            1 Reply Last reply
            0
            • M Offline
              M Offline
              mlong
              wrote on last edited by
              #6

              You have main.cpp in your SOURCES twice.

              Software Engineer
              My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

              1 Reply Last reply
              0
              • E Offline
                E Offline
                Etchelon
                wrote on last edited by
                #7

                Yes thanks, I already noticed, as I said in my post ^_^
                Now I have to figure out why the app won't install.

                Btw are u the guy in Qt Developer's video about the AccuWeather app? If so, congratulations, I love your app :D

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  mlong
                  wrote on last edited by
                  #8

                  bq. Btw are u the guy in Qt Developer’s video about the AccuWeather app? If so, congratulations, I love your app :D

                  Oh, heh. Yep, that's me. Thanks! I've worked really hard on it.

                  So, if you correct the SOURCES variable and do a clean build, what error are you getting now?

                  Software Engineer
                  My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

                  1 Reply Last reply
                  0
                  • E Offline
                    E Offline
                    Etchelon
                    wrote on last edited by
                    #9

                    Don't know what happened, it didn't want to install. I just disconnected the phone and reconnected it and it finally worked.
                    All this gives me a feeling of...how to say, non robustness...anyway at least it works!

                    Now I have to find a way to lock orientation to portrait. I already found something, will have to work on it! But that's another story :D

                    Thanks to all.

                    1 Reply Last reply
                    0
                    • M Offline
                      M Offline
                      mlong
                      wrote on last edited by
                      #10

                      Well, as someone who's been using this stuff to develop for Harmattan since before most people knew for sure that it existed, let me say that it's plenty robust, but like anything, there are always little quirks from time to time. Glad it's working for you now.

                      If you're using Qt Components (you should be) then locking to portrait shouldn't be a big issue at all.

                      Software Engineer
                      My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved