How do I set up project as startup among a group of projects within a workspace in CodeBlocks? - codeblocks

I have created a workspace with different projects in CodeBlocks.
Each project has its own entry point (main).
However when I compile and run it always picks the same project.
How can I define wich is my startup project when I click RUN on CodeBlocks?
This is context menu on VisualStudio but here I do not see it.
Thank you

There is no concept of a startup project in a C::B workspace.
If you have a workspace foobar containing projects foo and bar then
one of those projects is always the active project. The active project
is the one that will be built (CTRL-F9) or run (CTRL-F10) from the Build menu.
By default the active project is the last project that you created. To make
bar the active project if it is not, right-click bar in the workspace
tree-view and select Activate from the menu (or simply double-click bar in the tree-view). Whenever you save the project your choice of active project is saved.
If you build the entire workspace from the Build menu, then by default
foo and bar are built in order of appearance in the workspace tree-view.
If you want to move foo from, say, first to second position in the default build
sequence, right-click foo in the tree-view and select
Project tree -> Move project down.
If you always want bar to be built before foo, because foo depends on
bar, right-click foo in the tree-view, navigate Properties... ->
Project dependencies... and tick the checkbox that makes foo depend on bar.

Related

Xcode 11, where can I manage Build Phase?

I've migrated my app into Xcode 11.
I want to remove legacy resources that copied at Build Phase, but I can't find old Build Phase menu.
Please make sure that you have selected Target instead of Project.
The problem is that you have the project selected (in the "project and targets list", which may be a collapsed pane for your Xcode).
So first, make sure the button to the far left of the "Info" tab shown in your screenshot is toggled on (so you can see your project and targets list).
Then simply select a target. Now you'll see the Build Phases tab. Only the targets of a project have build phases.
Note: If you don't like to keep the targets list shown, you can simply use the popup menu next to the pane's toggle button - which appears when the pane is not shown - to toggle from project to a target.

Edit GUI without using base internationalization

I set my Xcode 5 project to use a build target of OSX 10.6, unchecked "Use Autolayout" for MainMenu.xib and followed this answer to turn off base internationalization. This resulted in my MainMenu.xib file being removed from my project. When I build and run my project the window layout is how I left it, but going into finder, opening MainMenu.xib in Interface Builder and changing it's layout does not effect my project when I go to build and run it again.
How do I change the GUI for projects set to a build target of 10.6?
Can be added again to the project by:
Drag MainMenu.xib from Finder to the project files panel in Xcode.
A dialog will open, select copy items (if needed), created folder references, and add to the project's target (not "test"), click Finish and it should work!
If a more complete answer is added, I will best answer it instead of my own.

Embed exe of a project into exe of another project and keep it up-to-date

I have a solution S with 2 projects, A and B. B needs the exe of A as an embedded resource.
So I right click on B > Add > Add existing item... > I pick [...]\S\A\bin\debug\A.exe and for this new item I set Build Action = Embedded Resource.
Everything works well. But if I look to such item's Full Path property I see the path [...]\S\B\A.exe. This means that any rebuild of project A won't affect the embedded resource in project B.
How can I keep embedded resource in project B up-to-date with the original exe resource produced by project A?
Yes, this is by design. The IDE normally copies the resource into your project directory, a strong counter-measure to help you avoid some bad day in the future where you can't build your program anymore because the resource is missing and you forgot to make a backup.
Which is not what you want here. Remove the item and use Add + Existing item again. Note that there's a down-arrow glyph on the Add button. Click that arrow and pick "Add as Link". Now that copy won't be made and your project will refer to the actual file.
You still have to ensure that A.exe is available and up to date before you build B. Right-click the B project in the Solution Explorer window, Build Dependencies and tick the A project. A will now always be built before B.

Where are my targets in Xcode 4?

In Xcode 3, I had a list of targets in the left column. They're not there anymore. There's a list in the Scheme pull-down, but I can't find them anywhere else. Have they changed name to "Schemes"?
Click the button as below images
Targets are still there. Click on the project (the very first object in the tree) in the project navigator and you'll get a view with project settings on the right and targets on the left.
Click on the top level item in the left hand project view - it will show you the project and the targets in the main pane - along with their configurations
No, targets and schemes are not the same thing. Your targets are still there: in the navigator in the left, click on the Project icon (it says "1 target, iOS SDK 4.3" or something similar underneath the usual .xcodeproject icon). THe main view now shows the project editor, where you can see and edit all your targets.
Schemes are basically ways to aggregate targets in useful ways when performing common actions like building and testing.
Yep, they are inside "Schemes" now. Each scheme can contain differing targets/build configurations.
If you click the dropdown and choose "Edit Scheme..." where your targets used to be in Xcode 3, then click "Run AppName..." or "Test" in the left side tree, under the "Info" tab you'll find the Build Configuration dropdown that contains Debug, Release, etc. in addition to the target Executable.

Xcode : Adding a project as a build dependency

Im playing around with the soundcloud api, in its instructions it says to
drag SoundCloudAPI.xcodeproj into your project
add it as a build dependency
I can drag the project in pretty easily, but how does one accomplish the next step?
To add it as a dependency do the following:
Highlight the added project in your file explorer within xcode. In the directory browser window to the right it should show a file with a .a extension. There is a checkbox under the target column (target icon), check it.
Right-Click on your Target (under the targets item in the file explorer) and choose Get Info
On the general tab is a Direct Dependencies section. Hit the plus button
Choose the project and click Add Target
Select your project in the navigator on left.
Open up the drawer in the middle pane and select your target.
Select Build Phases
Target Dependencies is an option at that point.
Tough one for a newbie like me - here is a screenshot that describes it.
Xcode 10.2.1
Under TARGETS in your project, right-click on your project target (should be the same name as your project) and choose GET INFO, then on GENERAL tab you will see DIRECT DEPENDENCIES, simply click the [+] and select SoundCloudAPI.
Just close the Project you want to add , then drag and drop the file .
Xcode add a project as a dependency
Xcode 10
drag-n-drop a project into another project - is called cross-project references[About]
add the added project as a build dependency - is called Explicit dependency[About]
//Xcode 10
Build Phases -> Target Dependencies -> + Add items
//Xcode 11
Build Phases -> Dependencies -> + Add items
In Choose items to add: dialog you will see only targets from your project and the sub-project
Today I faced with the same problem.
As the result of the first run I got next error:
Lexical or Preprocessor Issue: 'SDKProjectName*/*SDKProjectName.h'
file not found.
But before running, I, obviously, added my SDK into the demo project, just drag&drop .xcodeproj file into my test project's source tree. After that, I moved into Build Phases tab in setting of the main xcodeproj file (of the demo) and added my SDK as target dependency and embed framework into corresponding tabs.
But at the result, I got an error above!
So, the problem was into empty line on the Header Search Paths option. I just wrote "../**" as value for this key and project compiled successfully. So, after that, you can add #include <SDKName/SDKName.h> into any project, which includes this SDK.
ps. My test app was created into root SDK folder.

Resources