I want to use Xcode for C/C++ project.
I don't care about build/compilation, all i want is to use it as editor.
Needs:
- Find symobol , References , callers etc
I've opened a console project, i can search for a symbol in the same file but nothing else. (for example, right click + jump to definition gives me a question mark ('?').
Any pointer to what needs to be done ?
Thanks,
Shaul.
From my experience, XCode is not designed to work well with C++. For example, you'll find that simple refactoring, such as renaming a function and automatically renaming usages, doesn't work well with XCode. I find AppCode works a lot better for (Obj)C++ development. Worth a look.
Thare are two approches
You need to create a library of your c++ project and add that library in your project
Add C++ project in your xcode and make it build as target source
let me now if you need a walkthrough
Ok, I found the solution.
When adding files to the Xcode project, on the bottom , need to click 'Options' and then choose 'Create groups' instead 'Create folder references'
This options will add all the sources and headers to 'Compile sources' and 'Headers' (Under 'Build Phases')
Related
I try to use Xcode (v.7.3.1) for my C++ project (build system - make), but the experience is quite poor (and it was always like that since old versions like v4 when I started using it) - code completion doesn't work, color syntaxing works oddly (no coloring sometimes, or partially colored code), no "jump-to-definition" functionality, can't switch b/w header/source files with shortcuts. Basically, it's just a text editor where I have to use "Find" and Cmd+Shift+O all the time.
Is this intentional and Xcode will never get any proper support for C++ projects with external build system (make) or am I misconfiguring my project? How can I re-index files in the project? How can I make code completion work?
Thanks,
I believe there is a way to use Xcode with makefiles by adding an external build target, file->new->target->External Build System.
This is an older tutorial but the steps may be worth looking through: http://web.ist.utl.pt/jose.alberto.coelho/mac/MakefilesXcode.pdf
I've never had a problem with the syntax highlighting, but I remember the refactoring support being limited for C++ in some ways.
So, I ended up using this workaround: even though, I use external build system, I create Console Application project in Xcode and choose C++ language in settings. Then, I simply add my source files to the project (just drag folders from the Finder window) and then manually create project targets of type External Build System as I need. I don't use default target and don't use generated main.cpp file at all.
My files get indexed with no problems. I'm also able to debug code as I used to.
I still think Xcode developers should review indexing process for the projects with external build system...
Thanks for all the insights though!
I am trying to learn C++ from some Stanford Course and they have a custom library which contains a bunch of header files(.h) and their associated source (.cpp) files.
I want to create new C++ projects in xcode 6.x to try out code and include those custom header files in my new projects.
I have no freaking idea how to include those files in my project so that i can peacefully #include "blahblahblah.h" and use functions from that header file without issues.
I am new to both xcode, c++(although i know some coding part) and anything else with this process.
Summary:
I have a folder Library which contains a series of .h and .cpp
files.
I have XCode 6.x.x/Eclipse installed.
I want to create a new C++ project and use #include
"OneOfThoseHeaderFiles.h" and then use a function or something from
those header files.
Also assume i have no clue how to run some command line codes that i see a lot of.
If someone can please tell me in the most simple way(preferably step-by-step) i would be so eternally grateful and sing praises to you until the day i die :)
Note: Either XCode or Eclipse is fine. I really just want to start coding.
I have spent the better part of a whole week trying out xcode, eclipse etc and trying to follow a ton of steps to get it working but i just cant get how to add the files without issues. Either the info seems to be for Xcode 4.x and every menu seems changed or the suggestions are so complicated that a novice like me cant figure it out.
First off, almost all the information for Xcode will be available on the Apple Developer's portal:
https://developer.apple.com/library/prerelease/ios/documentation/ToolsLanguages/Conceptual/Xcode_Overview/start_project.html#//apple_ref/doc/uid/TP40010215-CH2-SW5
To create a simple static library on Xcode 6 you start by creating a new project, then under OS X - Framework and Library select Library, on the next window change the Framework to None (Plain C/C++ Library) and static (since that is what your are stating).
Once your project is created, add the existing headers and sources to your project, either by dragging them with the mouse or with the add files drop menu from the right click functionality, you can create a new group in Xcode if you want some order for them.
When adding the files, on the add window shown you can select to either copy them or use their current location.
If needed you might have to change the "header search path" in your target configuration under "Build Settings", if it is the first time you are using Xcode some of this will sound weird but I am sure you will find most of it on the Apple Developers portal in great detail.
If you want to test the files without having to create an external static library you could create a command line project and test them faster and easier.
I'm using the Eclipse IDE for C/C++ running on an iMac, OS X Yosemite.
In my C++ project, I want to hide certain files from the Project Explorer, YET they still be included in the project. I'm trying to run a series of tests for an empirical study I'm doing. Files I'm trying to hide are for test purposes and as such I don't want the participants to be able to see the contents of my test files.
I found the following StackOverflow thread, which does exactly what I want, except for the fact that when I do it, Eclipse excludes the files from compiling.
Eclipse: how to hide custom files in Project Explorer
How can I merely hide the files without excluding from compiling?
Thanks in advance!
W.r.t Project Explorer/Navigator view its not possible to merely hide the custom resources based on name patters.
Refer this post for more info : https://stackoverflow.com/a/2396496/1391924
However note that: In C/C++ Projects view you can hide resources based on your own file name patterns.
Refer this help.
I have lots of useful platform independent code made in C/C++ such as string/number/private data management, etc.
Now, as a starter to programming to iOS, I want to re-use the library for my project.
I don't think I can use it directly, but before starting, I want to check, but not easy to find the answer at this time.
What I want is
Implement a C++ library with public header files for iOS (not MacOSX) in Xcode.
Build them and get libProject.dynamic / libProject.a / other header files.
Integrate them into Xcode so that other separate client app (object-c) can use it.
If someone help me brief introduction how to achieve above or any other reference would be appreciated.
Thanks,
Hana
In Xcode, you can simply choose "New Project" from the "File" menu, and from the project template chooser, click on "Framework & Library" under the "iOS" section. There is a single entry - "Cocoa Touch Static Library". Use that as your Xcode project template to make the static library. Then you can include it in your other projects just like you would any other static library.
I'm using Xcode 4 for my C++ programming. I want to add a framework, specifically an OpenGL framework, and I'm not quite used to where things are yet. It says in the help documentation that I should select the target, and from there I get the summery pane where I can add a linked framework/library. When I do that, the summery pane doesn't show up. It does show up when my target is a cocoa application, but since I'm programming in C++, I choose the command line tool, and select the language from there. So, how exactly do I add the OpenGL framework to my target?
maybe go under "build phases" (instead of "summary") and then click "Link Binary With Libraries" and add button then search OpenGL.framework
im not sure 100%, im new to this too :)
The easiest way is to go to your project settings, and under Linking -> Other Linking Flags add:
-framework OpenGL
In your project, create a group 'frameworks' (not really necessary but keeps things organized)
With Finder goto: /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks
Locate the OpenGL.framework folder
Drag and drop the folder into your XCode project (in the frameworks group)
Don't copy the files(!)
Probably you want to copy 'GLUT.framework' as well.