Can't compile for mobile (but compiles for desktop)
-
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 :)
-
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.
-
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.
-
Here is the pro:
@# Add files and directories to ship with the applicationby 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.uiPlease 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 :)
-
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?
-
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.
-
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.