How to enable/ disable "Automatic Reference Counting"? - automatic-ref-counting

Using Xcode 4.2, how can one enable/disable "Automatic Reference Counting"?
ANSWERED Under Build Settings, flip "yes" and "no" depending whether you want ARC enabled.

Globally:
Go to "Build Settings", look for "Apple LLVM compiler 3.0 - Language". Set the field
"Objective-C Automatic Reference Counting" to "No".
For individual files:
Go to "Build Phases", select the file, double-click the "Compiler Flags" column and put
"-fno-objc-arc" in it.

To enable ARC per-file, you can also set your "Compiler Flags" under "Build Phases" to -fobjc-arc. Make sure your compiler is set to Apple LLVM compiler 4.x and not LLVM GCC 4.2.

In XCode 4.6 this property has now changed to CLANG_ENABLE_OBJC_ARC

Related

g++ is used by qmake and gcc is configured by the kit

"/usr/bin/g++" is used by qmake, but "/usr/bin/gcc" is configured in the kit.
please update your kit of choose a mkspec for qmake that matches your target environment better.
couldn't find any way how to change the complier used by qmake to match the one configured by the kit.
one Tools > Options > Build & Run > kit . there is no way to change the qmake complier back to gcc. and the problem is there is only gcc and clang auto detected by qt 5.9
Tools->Options->build & run->compiler has the settings you need to fix that,
or add new kit, this my kit settings
The problem was that i installed Two versions of Qt and i think there config or something overlapped so the g++ option didn't appear until i remove both versions and installed Qt 5.9.1 again the g++ option appeared and now i don't have the issue any more .

Error in Instaling QVTKWidgetPlugin

Hie,
I am new to VTK.I want to use QVTKPluginWidget in Qt designer.
I am using Visual Studio 2008 with MSVC compiler
CMake- 2.8.10.1
Qt Version -4.8.3
VTK - 5.0
As per VTK User's Guide we have to configure VTK Lib with Cmake with setting
few options like,
VTK_USE_GUISUPPORT=Turn On
configure
Desired Qt version cmake take itself
configure
then
set qt_qmake_executable
ON Build Example
configure
after doing this i am getting this warning in Cmake
CMake Warning (dev) at GUISupport/Qt/CMakeLists.txt:113 (ADD_LIBRARY):
Policy CMP0003 should be set before this line. Add code such as
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)
as early as possible but after the most recent call to
cmake_minimum_required or cmake_policy(VERSION). This warning appears
because target "QVTKWidgetPlugin" links to some libraries for which the
linker must search:
vfw32, opengl32
and other libraries with known full path:
C:/Qt/4.8.3/lib/QtGuid4.lib
E:/DebugLibrary/VtkBin/bin/Debug/vtkRendering.lib
CMake is adding directories in the second list to the linker search path
in
case they are needed to find libraries from the first list (for backwards
compatibility with CMake 2.4). Set policy CMP0003 to OLD or NEW to enable
or disable this behavior explicitly. Run "cmake --help-policy CMP0003"
for
more information.
This warning is for project developers. Use -Wno-dev to suppress it.
Generating done
Then have to build this library in Visual studio then Copy the
QVTKPluginWidget.dll in Plugin/Designer Folder.
Then we should get QVTKWidget in designer
But i am not getting that in designer after doing this process.Kindly help
me.
You have to build VTK with BUILD_SHARED_LIBS=ON (as described here http://www.vtk.org/Wiki/VTK/Tutorials/QtSetup) to use the widget in Designer.

Building Qt statically [duplicate]

I used 4.7.2 for the past months. Now I downloaded 4.7.3. Now I am searching to type "configure -static". But I don't know where the hell "the qt path". Can anybody shed a light on this issue.
Download the source package here. Download and install your favorite perl distribution. I must warn you that Strawberry perl comes with its own toolchain and that may get used instead of the MinGW you downloaded. Use ActivePerl if you don't want any trouble, or build it yourself.
Unzip it to say, C:\Qt-source so that there is a configure.exe in C:\Qt-source
Open the toolchain's command prompt
a) If you're using the Visual Studio compiler, search in the "start" menu for a CMD shortcut in the Visual Studio folder. The Windows SDK also has this shortcut.
b) If you're using MinGW, either use the accompanying mingwvars.cmd, or open a command prompt, (Run->"cmd.exe") and type set PATH=C:\path\to\mingw\bin;%PATH%. Try gcc -v to see if it can be found.
Make a build directory, preferable something like C:\Qt. Do set QTPATH=C:\Qt and set PATH=C:\Qt\bin;%PATH% and cd C:\Qt, and type:
..\Qt-source\configure -static
After configure finishes, you'll either have to type nmake (Visual Studio) or mingw32-make.
Go do something else, because it will take a while.
Some tips that result from my experience, and add a bit more to the answer of rubenv:
Pass the install directory as a flag of the configure; be sure to choose a different directory from the one where you have stored a non-static version of Qt!
Some modules will likely cause you troubles when compiling statically because you need to resolve the dependencies statically; one example is webkit, so if you don't need it be sure to disable it
It is generally not a good idea to build the debug symbols into a static library, so I normally debug with the dynamic version, and use the static Qt to generate releases only.
Therefore, my configure looks something like this:
configure -static -prefix C:\Qt\4.8.6_static -no-webkit -release

Is LLVM the default compiler in Xcode 4?

So I just installed Xcode as I registered to dev program so do I actually have to change the compiler from somewhere in Xcode or is LLVM on default? Thanks in advance!
"LLVM GCC 4.2" is the default in the initial 4 release it seems. (i.e.: The LLVM back-end with the GCC 4.2 parser.)
You can verify this by creating a new project, selecting the main project target (the bit at the top of the left hand pane) and then selecting the "Build Settings" option in the main area. If you then select "All" (the default is "Basic") and scroll down, you'll see "LLVM GCC 4.2" selected as the default.
You can of course change this to GCC 4.2 (the Xcode 3.x default) or pure LLVM.
There's a bit more information on the various settings (they're effectively identical to Xcode 3.2.x) in the existing Xcode 3.2.1 GCC CLANG and LLVM demystification question.

Hardcoded QMAKESPEC in Qt Creator?

I installed Qt SDK (Qt framework + Qt Creator) but didn't like the layout of folders so I deleted it (without uninstalling), moved framework in one place and Qt Creator in another and installed Qt framework and Qt Creator separately placing each over the respective old one.
The problem is Qt Creator in Projects/Build Settings/Build Steps keeps showing the old path to the specification file:
-spec c:/qt/2009.03/qt/mkspecs/win32-g++
Setting QMAKESPEC environment variable either in the system or in Projects/Build Environment doesn't change anything.
How can I force Qt Creator to see and use new location of the specification file?
This does not fully solve the issue but if you add '-spec' (without quotes) in the additional arguments box in build steps -> qmake, then it removes the win32-g++ argument.
NOTE: I have NOT been able to build the project after doing this (i changed it to win32-icc and win32-msvc2008 as i have both the intel c++ compiler and VS2008) but the build fails with the error ---- "*** MIssing Separator. Stop." in the makefile
I don't have Qt Creator installed, but I suppose it may store this setting somewhere on filesystem, look in your %HOME% or %APPDATA% for directories associated with Qt Creator and search the files inside for this path.
Have you tried going into Projects->Build Settings->General and clicking on the "Manage Qt Versions" and making sure that everything there is all correct?

Resources