How to unconditionally copy headers in Xcode? - xcode

I have set a header file's role in Xcode to private so that it will get copied to the desired location by the Copy Headers build phase. It works as expected if there is not already a header file of that name in the target location. But if there is an existing file, it does not overwrite it. Even if the header file has changed in the project it doesn't seem to update the copy in the target location. The Build Results windows shows a line "Copying MyFile.h" but the file is the old one.
This doesn't seem right and is definitely not what I want. How can I force Xcode to unconditionally copy (and overwrite if necessary) header files in the Copy Headers build phase?

Are you sure that you have actually changed the header file in the project? If Xcode says "Copying MyFile.h", then it's copying it. But if you accidentally changed the copy, instead of the original, then Xcode is simply doing what it thinks is right: copying the authentic version from the project over the altered version in the build product.
It would help if you'd paste the entire "pbxcp" line for that header, then it would be easy to see exactly what's going on.

I took this question over to the Xcode mailing list and had some back and forth there. It turns out that Copy Headers copies the file to a subfolder of the build folder, not to the absolute address I specified. Maybe it is not intended for what I am doing.
I've reverted to using Run Script to do the file copying.

Related

VSTS Copy and Publish Build Artifacts copying the whole project instead of the necessary files

I am trying to copy my build to a particular drop location. But instead of copying the some important files and directories it is copying all the solution file and directories there like .csproj files and .csfiles and also all the folders present there.
I only want to copy dlls(projects dlls and references dlls of the project) and some data Folders and files to drop location so that I can use them to execute my test cases. But it ends up copying the whole solution.
Below are the setting I am using to copy and publish build artifacts.
Can Anyone tell me how can it be done?
Note: when I tried to put $(build.sourcesdirectory)\bin in the copy root it gave me an error that "Cannot bind argument to parameter 'Path' because it is null".
I also tried putting only **.dll in my contents but then it copies nothing. The folder created in drop location comes empty.
You're telling it to publish **/*test*.dll, from the root of the build agent. That minmatch pattern is saying "find everything in every subfolder that matches test.dll", so the results you're getting aren't surprising.
What you probably want to do is specify the path to the binary output location of your test projects. Without seeing the structure of your code or what MSBuild variables you're providing/overriding, it's impossible to give more guidance. Look at the documentation on pre-defined variables and that should give you some ideas.
In general, you want to set your output folder (via MSBuild arguments) to $(Build.ArtifactStagingDirectory), so only build outputs go there. Then you can use that as your Copy Root.

Dereferences a xml file from xcode

I made a huge mistaking in renaming my xml file from xcode and I'm not sure how to fix it. My app has a feature that reads all local xml files built with the project. So now it is reading 2 of the same xmls with different names.
I tried deleting the file, added it back in, and Dereferencing it but no luck. I also made sure to delete my app and re building the project. When I do a full system scan for the xml file nothing pops up. The xml file is currently in the Trash.
Another issue might have been with the svn remote server but I tried svn rm --delete filename and it said the file does not exist. ( I tried the project directory as well as a few other sub directories).
Is there a way to Dereference/delete the file from the project?

Finding hidden images in xcode?

I am trying to change image name , and i get :
The file could not be renamed because a file with that name already exists
I CANT find that image in there,(project assets) it was deleted.
How can i be sure that its not in there ?
Thanks.
Xcode shows what's in the project, not what's in the project's folder.
Open the folder of the file you want to rename (right click on the file in Xcode -> Show in Finder), and you'll probably see another file with the name you were trying to rename to. Remove that other file (if you're sure you don't need it).
What I would do move forward is get out of the IDE:
Remove the file from Xcode, but not the filesystem, by "Deleting" the file and selecting "Delete Reference Only"
Rename the file in the filesystem(finder or terminal)
Re-add it to the project file.
Caveat: Confirm you aren't renaming the file with the same name, but with only a case change, that gets a little weird, mostly with SCM tools, but also OSX filesystems are case-insensitve by default, so File.m and file.m are the same file.

XCode 3.1.2, header file not found

I have been trying to build a code that has dependencies with other header files that are not in the project directory. I added the paths to these header files in both HEADER_PATH and USER_PATH. However, I still see error while building. It says that the file is not found. I verified that the file exist in the path added to the header search path in project settings.
How do I make sure that all my header files referenced in the project is included and the paths are being picked by Xcode during compilation?
I tried copying all the files to the project with no luck. This is the first time iam using Xcode, so its kind of frustrating. Iam a linux guy and comfortable with make files. Is there a Make file for xcode which i can modify to include the header file directories.
You might want to check the order of your source files in your target's build phases to ensure that your dependencies are compiled before your source files that reference them.
Select your project in the Project Navigator.
Select your target.
Click on the Build Phases tab.
Click on Compile Sources to expand the section.
Drag the dependencies to the top of the list.
Are you sure you spelled the header file name correctly ? Is the case correct ? Did you use user quotes "" rather than system quotes <> ?
Assuming you've checked all the obvious things such as the above then one other thing to try is to quit Xcode, delete the "build" folder in your project directory, and try again - sometimes the build folder gets in a pickle internally.

How can I remove files from a QtCreator project

Might be a very newbie question, but I can't find a way to remove files from my projects in QtCreator. Thanks!
If your project is generated from CMake, the file list is determined by the CMakeLists.txt file, and you cannot add or remove files manually from the source tree in QtCreator. Especially if your CMakeLists file specifies the glob operator for a project's file list, you must manually remove the files from disk and re-run CMake from within QtCreator by going to Build->Run CMake (QtCreator 3.3.0). This will update the file list but also regenerate the project (cbp) file - re-running CMake outside of QtCreator will not update the project file and you will have ghost entries of deleted files showing up in the source tree if you deleted them from disk.
Right-click the file you want to remove, and choose "Remove File..."
Checking the "Delete file permanently" check box will delete the file, otherwise it will just be removed from the project.
Find your project file .pro in qt creator or other text editor
Find the file/folder name you want to remove in the .pro file
Delete all the files you want to remove
save and close the project
Reload the project
DONE
Could not find one-touch action as in Eclipse to delete a class:
1) Press right click on the file/class, and then choose "remove file..."; (u can tick "permanently" to remove from HDD if you like).
2) Do it to .CPP and .H files.
3) Then check in your .pro file the class are not there anymore.
Note: Some compilers will keep searching for this file/class in compilation. Just delete the compilation directory and compile again.
If you mess up like me and accidentally add a lot of files to the qml.qrc, it might help to know that these are listed in the actual qml.qrc file which you can edit to remove these files.
I also run into this problem.
I wanted to remove a header file.
But remove action in context menu was disabled I didn't know why.
The file name was qtextdocument.h.
I wanted to change the name to textdocument.h.
I tried to do various ways, but the filename was strictly fixed.
My removal procedure was as follows:
I dare to add an empty file to the file directory (in header file directory).
Anyway, I set the file name as textdocument.h when Qt Creator asked me to set the filename.
A confirmation warning popped up.
(Qt Creator cannot add the file automatically, we must add the file name to CMakeTextLists.txt)
I changed the filename in CMakeTextLists.txt from 'qtextdocument.h' to 'textdocument.h' in the row of set(PROJECT_SOURCES).
Finally, the update was confirmed. 'qtextdocument.h' was removed and the name is changed to 'textdocument.h'.
If you only want to remove a file, only you have to do is to delete the filename when you are in step 3.
After updating the project tree, the actual file is in your computer.
If you want to delete the file completely, you select file system and remove the file, not from project.
I don't know why, but in the case of filesystem mode, remove action is enabled.
So I might & should have told you that you select "filesystem mode" and remove the file at the first time...
(Sorry I have found out this fact later.)
Both of the two ways, I think we must rewrite the contents of CMakeTextLists.txt.
I also run into the case , the update removed the filename as soon as I deleted the filename from CMakeTextLists.txt.
I believe this case I directly make a file in the actual directory. On the contrary, above case is the files are added from Project menus.
go directly delete the project folder from your hdd.
For Linux, edit ~/.config/QtProject/QtCreator.ini
Under [ProjectExplorer], delete the project name and its corresponding configuration file from the following two lists:
RecentProjects\DisplayNames
RecentProjects\FileNames
e.g., given the following
RecentProjects\DisplayNames=proj1, proj2, proj3
RecentProjects\FileNames=<proj1_dir>/CMakeLists.txt, <proj2_dir>/proj2.pro, <proj3_dir>/proj3.pro
to delete proj1 from the qtcreator startup page, edit the above two lists as
RecentProjects\DisplayNames=proj2, proj3
RecentProjects\FileNames=<proj2_dir>/proj2.pro, <proj3_dir>/proj3.pro

Resources