So im a bit confused by what to-do with this current pop-up im having from QT. Not entirely sure what it means.
So i'm trying to create a C++ Library, as a static linked library. Currently the library has no code in it whatsoever.
Immediately hitting the build button to make sure everything runs fine the following pop-up below is displayed.
Im not sure what this means exactly. Or indeed, why it is even being shown in the first place. building any of my other project files works fine without issue. But this does not.
.
As for what i have, i am using the Qt SDK, version 4.8.1.
Any help solving this issue would be greatly appreciated :).
A library [usually] needs to be invoked from an executable - The dialog box you are seeing is asking you to specify an executable that will bring your library into life and call functions within it.
You need to write a client executable (or use an existing executable) to use your library and specify the path in this dialog box.
The button you clicked was probably the Run button:
, not the build button: .
Related
I am trying to use XCode to write a very simple console app. It really only had one requirement that I can link to a static library which I built from source code that I downloaded from GitHub. After spending a few hours yesterday trying to figure out the peculiarities of using a static library in XCode I finally got that working. Today while working on the code I clicked on the XCode 'Fix It' button in one of the errors I had in the code and now I am stuck with this modal dialog that says I can't save the file string. I don't want to save the file string. I think XCode is trying to make a change to one of the standard C++ header files. I just want to build my project but every time I do the modal shown below pops up twice and I have to dismiss it before the build completes. I thought I would be able to Undo, or command+z or just close the string file that XCode keeps wanting to update but i can't find that file open anywhere in the editor. Anyway I'm giving up on using XCode for working in C++. It's a mess and wastes way too much time. If you just need to do simple C++ stuff on a Mac you are probably better off using a makefile and textedit. But, I'm just curious about this one last problem
I am building a C++ OpenGL card game in Xcode 4.3.3, with the intention of running it on both 64-bit and 32-bit Macs, which is not my problem. My problem is that I have reached a point in the development of the program where I would like to test that it works on a different 32-bit Mac (mine is 64-bit) without having to install Xcode. This, obviously, requires me exporting it as an .app. I can find and run the exported Unix Executable File from my project, after some cd'ing, through Terminal, but that is undesirable for me and the intended audience of the program. I have trawled the google and Stack Overflow, looking for anything to help me, but all the things mentioning Archiving seem to have been unsuccessful with my particular project, and I think that's because it's a C++ command line tool project. So, can someone please help me export my project as a .app?
Thanks in advance.
The simplest way of doing this would be to create a Cocoa project, go to 'build phases' and remove all the objective-c frameworks from the 'link with libraries' build phase, remove any objective-c files added by the template (app delegate, etc.) and then replace main.c with your main.cpp file.
There's nothing really special about a Cocoa project except for the fact that it links against Cocoa and calls NSApplicationMain() from its main() function.
There are also a bunch of .plist entries used by Cocoa which you'll no longer need. But they won't affect the way OS X treats your application.
I'm searching for an XCode Settings solution but here's my current way to create an app:
You have to take your binary file (let say myapp) and put it in "MyApp.app/Contents/MacOS/myapp" then it can now be launched as a .app. That's a trick.
Just go to the targets folder in the file navigator on the left, and there will be an executable listed there. Left click on that executable and click "show in finder". (I'm describing from memory so I may have the exact details wrong.) The file path is ridiculously long (there is an arbitrary alphanumerical pathname involved, I have no idea why), so you probably won't be able to find it with the command line.
If you want you can change the extension of the file from nothing to ".app", it shouldn't affect the nature of the file at all. Also if you want a custom icon, you can "get info" on it in the finder, then click on the icon in the info window, and use Cmd-V to paste it in (obviously you have to have your icon copied to the clipboard). There is also a way to do this inside of Xcode, but I don't remember it.
I am currently working on building a Cocos2d-x game for the BB10 platform using the BBTemplateProject sample provided with Cocos2dx. I am new to C++ programming, and the current game is a port of a java project Iv been working on for a while. In order to save game data (scores, some settings etc), I intend to use the QtSQl Library which BB10 provides.
I have successfully run some sample Qtsql code in a sample Cascades application and it works fine.
However, integrating the same code into my Cocos2dx BB10 project just doesnt work .
I use the momentics IDE and have added the qt4, QtCore, QtDeclarative, paths/symbols to the project but still recieve the following errors
undefined reference to `QObject::QObject(QObject*)'
undefined reference to `vtable
undefined reference to `QSqlDatabase::defaultConnection'
.. and a bunch of other Q- related object errors.
After reading up on Qobject here http://developer.blackberry.com/cascades/reference/moc.html
I suspect that the MOC compiler is not appropriating referenced or a similar issue. Also, given the same code works well when integrated in an auto generated cascades project in the Momentics IDE, I am led to believe it is some sort of moc compiler issue. Given that I am quite new to C++ development, I still havent been able to figure out how to add the appropriate qmake file rules to the Momentics IDE in order to recognise Qobjects . Help is needed in this area.
Will definitely appreciate any pointers on how to go about this from experienced c++ devs or better ways to store data within cocos2dx blackberry 10 projects.
Thanks in advance.
Edit :
Here's , my progress thus far in trying to use QtSql for database interaction. QtSQl requires QtCore which contains QObject above. Thus far I have been unable to successfully integrate QtCore library.
I have done the following.
Added the /usr/include/qt4 and /usr/include/QtCore and /usr/include/QtSql to my include list using the following procedure
Right click over your project in Project Explorer and choose Properties
Expand the tree to C/C++ General / Paths and Symbols
Change the Configuration in the Paths and Symbols frame to [All configurations]
Click the Includes tag and select GNU C in the Languages list (or do this for every language).
Click Add... and type ${QNX_TARGET}/usr/include/qt4 and press OK
Click Add... and type ${QNX_TARGET}/usr/include/qt4/QtCore and press OK
Used the Momentics IDE add library function to add both QtCore and QtSql to the project. RightClick->configure->add Library and Standard BlackBerry Platform Library. The library gets added successfully.
I basically followed the steps detailed in this related post Adding QtCore Library in blackberry 10 sdk . But now get this error.
\win32\x86\usr\bin\ntoarm-ld: cannot find -lQtCore
The OP in that post mentions solving "some linker problems" but fails to mention how. I have also tried modifying the bar-descriptor.xml file adding the following lines
<env var="LD_LIBRARY_PATH" value="app/native/lib:/usr/lib/qt4/lib"/>
<asset path="${QNX_TARGET}\${CPUVARDIR}usr\lib\qt4\lib\libQtCore.so" type="Qnx/Elf">lib/libQtCore.so.4</asset>
Error still remains.
How do I solve this "linker" or library-no-found error ? Many Thanks.
First, if you plan to use the same application on both BlackBerry 10 and, I guess, Android as you are coming from Java, I'd try to use something smaller than Qt, like SQLite library, to keep it as simple as possible to port between the two platforms. But you can obviously use QtSQL on BB10 and something else in Android, you'll just have more code to write.
Second, regarding your issue: the undefined reference to QObject::QObject(QObject*) means that you are using this symbol (the QObject constructor, which you are probably calling because one of you class inherits from QObject), but nothing is providing it. You have probably added QtCore to your include path as the compiler found it, but not the linker: you need to specify that you want your application to be linked with QtCore.so (or maybe QtCore4.so, I don't have the SDK right now to check the exact name). You'll find everything you need on how to do this here.
About moc: moc stands for Meta Object Compiler. It basically parses your headers, looking for metadata on your classes: mainly properties, signals and slots. More specifically, everything that requires the Q_OBJECT macro. If you don't use theses functionalities, you don't need to run moc.
If you have to run it (because you use some meta object functionalities): you have two options. Option one: use QMake to compile your project. You'll have to recreate your project from scratch as a Qt project (maybe not differentiated of Cascades projects on Momentics, however it's just a matter of removing libraries you're linking to, not a big deal) to do this. Option two: add custom rules to run moc on headers needing it. It will generates some moc_yourclass.cpp files that you'll need to include in your project. I don't know how to do add a custom step on Momentics, but I think it should be doableā¦
I'm trying to set up SDL with Xcode using the tutorial here.
http://www.sdltutorials.com/sdl-tutorial-basics
I have everything set up correctly according to this tutorial, and there are no errors after building. The only problem is that when I run the program, the SDL_Surface never appears. The console says nothing and no errors are thrown. I've been searching for solutions for says, but I am unable to find anything that relates to my issue. I put my code up here on Git if anyone would like to check it out and tell me what I'm doing wrong. Thanks so much!
https://github.com/syobonaction/rubicon.git
This is a silly but easy mistake to make!
In your project, you have included main.m (included in a default cocoa application project) and have not included SDLMain.m, so your SDL code is never executing, and instead you are just running a blank Cocoa application!
To fix this, click on SDLMain.m, open the utilities pane on the right, and click the checkbox to add SDLMain.m to your target. Next, go to Supporting Files in your left navigation pane, find main.m, and delete it from your project. You don't need main.m at all, because all it does is start a Cocoa application, which you don't want to do! (SDLMain.m will also start a cocoa application, but not before linking the cocoa application to the SDL system.)
I have never been clearly understand all these linking/building/dependency business. Now, I am trying to build the FreeType library (which is in C++), into the *.a library file for the iPhone (because another library I am trying to use, openFrameworks, would depend on FreeType).
I know that to compile C++ with iPhone I simply need to rename *.cpp to *.mm. (I have tried with some simply programs in main() and it works) But how can I build the library in Xcode then ? (without the main() I suppose)
On the other hand, it would be great if you guys could recommend some books or documents on such linking/building topics, which I found myself most confused about.
PS. I have already got the paid version of Xcode and some sample apps compiled onto the iPhone.
Renaming .cpp files to .mm would mean they'll be treated as Objective-C++ code rather than C++ code. I don't think that'd be a good idea, even if it should still work. Besides, FreeType is written in C, not C++.
Google for "compiler linker" and you'll find quite a few documents on how they work. That should help for documentation.
It's entirely possible to compile static libraries for the iPhone; what you can't do is compile dynamic libraries or frameworks - you could, but it's not encouraged.
Open your project
In the source/target browser, select the "Targets" node (with the little red and white target icon).
Right-click on the node, and in the popup menu select "Add", followed by "New Target".
A dialog opens. On the left hand side, there's an iPhone OS and a Mac OS X section. The iPhone OS section should already be selected; if not do so.
You should have three choices of targets, one of it is a static library. Select it, click OK.
Give the library a name in the next page. Click finish.
Your "Targets" node has includes a child for your static library now. You can add sources either via the file menu, or by dragging it onto the "Compile Sources" child node.
Hope that helps.
First, you do not need to rename any files to compile C++ code for the iPhone. Secondly, you'll want to create a separate project for the library. It looks like the iPhone target types don't include "static library", so you might need to create a Mac OS X project and modify it to output an ARM .a file. Not trivial, but probably doable.
Alternatively, if you're not going to be using this code in a lot of otherwise unrelated projects, you could include the source files directly into your App project. Collect them all into their own group, and you'll hardly know they are there.