having errors in Xcode while compiling saying that used twice - ios

:0: error: filename "SurveyViewController.swift" used twice: '/Users/raeessamman/Downloads/fwdsurver/SurveyViewController.swift' and '/Users/raeessamman/Desktop/IOS Development projects/SammanMRA-cobsccomp191p-036/NIBM COVID19/NIBM COVID19/Controller/SurveyViewController.swift'
:0: note: filenames are used to distinguish private declarations with the same name
Command CompileSwiftSources failed with a nonzero exit code

search with this name "SurveyViewController" in your project
you will find that you declare it twice. you must change or delete one of them.
if you didn't find it you must search in "project.pbxproj" file and you will find two paths with the same name.
to open the "project.pbxproj" file you should go to "YourApp.xcodeproj" then you double click in it, menu will open select "show package contents" then you will find 2 files one of them is "project.pbxproj".

Related

Weird hidden characters in exported XLIFF file

Whenever I try to 'Export For Internationalization', the exported file contains a weird hidden character, making it unparsable for XLIFF editors. The problem seemed to be in the original .string files, somehow the weird character was inserted in those files. I have since deleted the weird character but whenever I export it still sneaks into the xliff file. I tried cleaning and rebuilding the project, restarting Xcode... none of that seems to work.
Is Xcode somehow using a cached version of the 'bad' .strings file containing the bad character?
Using Xcode
If I try Editor > Export For Localization
I get:
/usr/bin/xmllint exited with status 1
Using Terminal
When I run it from Terminal like so:
xcodebuild -exportLocalizations -localizationPath
/Users/Kymer/Downloads/Wolf -project Wolf.xcodeproj -exportLanguage fr
I get the following errors:
parser error : attributes construct error
parser error : Couldn't find end of Start Tag trans-unit
parser error : PCDATA invalid Char value 19
parser error : PCDATA invalid Char value 19
parser error : Opening and ending tag mismatch
parser error : invalid character in attribute value
parser error : attributes construct error
parser error : Couldn't find end of Start Tag
parser error : PCDATA invalid Char value
/Uxcodebuild: error: /usr/bin/xmllint exited with status 1
In both cases the exported xliff file contains the weird hidden character upon inspection with Sublime Text:
If I manually remove the bad characters the file is perfectly readable by xliff-editors but that's not a good long-term solution of course.
I found the problem: when exporting to an XLIFF file Xcode doesn't look at your .string files, it is all generated from the project itself (i.e. it looks at all NSLocalizedString calls and your storyboards). Which makes sense. I found the weird hidden character in one of my code files. Removing it from the source file fixed the export issue.
Easiest XLIFF workflow
I'll also mention this for future reference: the easiest way to add a new language to your project is to first use the command line:
cd to the your project and run:
xcodebuild -exportLocalizations -localizationPath <path> -project <projectname>.xcodeproj -exportLanguage <language code>
That creates a new XLIFF file and will correctly set the target language in the file (source language will be your base language). A translator can now easily add all necessary translations. Afterwards you can import the translated XLIFF file back into Xcode (select target and Editor > Import localizations). Xcode will then generate all necessary .string files.
Updating existing language: If you add new UI elements and want to update an existing localization language, you can simply export an existing localization (select target and Editor > Export for localization). That XLIFF file will contain all previous translations together with the new strings. A translator simply has to fill in the 'blank' lines. There's no need to touch the .string files yourself, because managing that manually is a pain (especially with the crazy Storyboard ID's).

Xcode "no such file or directory" if filename contains $$ sign?

Using xcode 6 and including files with names like Some$$Class.h and Some$$Class.m leads to problems. Xcode shows to error:
clang: error: no such file or directory: '/Users/test/Some$ClassX.m'
clang: error: no input files
How can I force Xcode to handle files with $$in its name correctly?
There is a very! dirty hack.
If you look to the error message, you can see that the build process of Xcode replaces the $$ of Some$$Class.m with a single $. (Obviously there is no problem with Some$$Class.h) It is an escape sequence.
Some$$Class.m -> Some$Class.m
Therefore you can use Some$$$$Class.m to get Some$$Class.m.
Simply add an (empty) File with the name Some$$$$Class.m to your project to show Xcode that it exists. You have to do this once.
Generate your Some$$Class.m as you did as many times as you want.
When building Xcode will believe that it compiles and links Some$$$$Class.m, but in fact compiles and builds Some$$Class.m.
But you should really, really avoid these names. If the files are generated automatically it should be possible to rename them automatically.

Remove the path in objcopy symbol names

I need to include a binary program in my project. I use objcopy to create an object file from a binary file. The object file can be linked in my program. objcopy creates appropriate symbols to access the binary data.
Example
objcopy -I binary -O elf32-littlearm --binary-architecture arm D:\Src\data.jpg data.o
The generated symbols are:
_binary_D__Src_data_jpg_end
_binary_D__Src_data_jpg_size
_binary_D__Src_data_jpg_start
The problem is that the symbols include the path to the binary file D__Src_. This may help when binary files are included from different location. But it bothers me that the symbols changes when I get the file from a different location. Since this shall run on several build stations, the path can't be stripped with the --redefine-sym option.
How do I get rid of the path in the symbol name?
I solved this problem by using this switch in objcopy:
--prefix-sections=abc
This gives a way to uniquely identify the data in your binary object file (ex. binary.o)
In your linker script you can then define your own labels around where you include the binary.o. Since you are no longer referencing anything in binary.o the binary will be thrown out by the linker if you use -gc-sections switch. The section in binary.o will now be abc.data. Use KEEP in your linker script to tell the linker not to throw out binary.o. Your linker script will contain the following:
__binary_start__ = .;
KEEP(*(abc.data))
binary.o
*(abc.data)
. = ALIGN(4);
__binary_end__ = .;
The switch --localize-symbols works for me.

How to get rid of this annoying W8123 warning in my IDE

This is what happened. We downloaded Quickreports 505, installed it, but had to revert to QR504. Now we are getting
[BCC32 Warning] W8123 Path 'C:\Program Files\Embarcadero\RAD Studio\8.0\Quickrep505C' not found - path ignored in option '-I'
This question has been asked on both Embarcadero, and quick report forums but all of their answers has been modify the cbproj file, which do not contain any references to quickreports.
I've tried removing all the references from the IDE but the warning still occurs. Any suggestions on how to fix what should be a simple problem.
Sources:
https://forums.embarcadero.com/thread.jspa?messageID=486503
http://forum.quickreport.co.uk/default.aspx?g=posts&t=1675
Using:
IDE: C++BuilderXE
Note I do not want to disable all warnings in the IDE, and I don't want to disable warnings in Code.
I've had the same annoying problem. To fix this I had to delete all reference to the file in the EnvOptions.proj file. This file is located in the ...AppData\Roaming\Embarcadero\BDS\8.0\ folder.
I got rid of this in my XE7 IDE directly via:
Tools > Options > Environment Options > C++ Options > Path and Directories.
There were invalid paths to libraries being referenced and showing up as warnings in the build. Select each of the ... icons to explore the list of paths included, and select Delete Invalid Paths to remove unused paths.
To enhance and update prior answers, this is what I had to do...
From the menus: [Tools] [Options]
In the Dialog box: [Environment Options] [C++ Options] [Paths and Directories]
Now at the top on the right side in the drop down pick: [32-bit Windows] (it started as Android)
The clear invalid paths in both tabs [Compiler] & [Classic Compiler]
Remove Warning Message File Path Not Found
[BCC32 Warning] W8123 Path 'C:.....' not found - path ignored in option '-I'
Version 10.4.2 Sydney
========
In IDE Right Click on Executable
Options...
C++ Compiler->Directories and Conditionals
Include file search path > (Double click)
then click on
Value from "All configurations - All platforms"
Click on ... in right hand side in text edit box on right hand side
Click on down arrow beside button "Tasks"
Delete Invalid Paths
"Save"
I have this project that I sometimes work at at the office and sometimes at home. And the paths of the external files are not the same on both computers, so I added them both in the folder lists.
Is there another way to supress these warnings without having to remove "invalid" paths from the folder lists?
Edit:
I thought I found the answer, but this setting doesn't work

Linker Error - Objective C

This error happens when I try to import the file "VARendererViewController.h" from the file "VAMenuScreenViewController"
duplicate symbol _gestureMinimumTranslation in:
/Users/Sam/Library/Developer/Xcode/DerivedData/Virtual_Human_Avatar-fwgdkxpnkzapxrdzkggtmbnfhjwb/Build/Intermediates/Virtual Human Avatar.build/Debug-iphonesimulator/Virtual Human Avatar.build/Objects-normal/i386/VARendererViewController.o
/Users/Sam/Library/Developer/Xcode/DerivedData/Virtual_Human_Avatar-fwgdkxpnkzapxrdzkggtmbnfhjwb/Build/Intermediates/Virtual Human Avatar.build/Debug-iphonesimulator/Virtual Human Avatar.build/Objects-normal/i386/VAMenuScreenViewController.o
ld: 1 duplicate symbol for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Could anyone provide me with some
You have two compilation units -- two source files -- that are defining the same symbol.
This may be because you defined the symbol in two separate .m files (or other compilation unit; .c, .mm, etc...) or because you defined the symbol in a header file and imported it into those two files. Alternatively, if you shove a variable declaration into a header file without the extern, then it'll cause a symbol by that name to be created in every .m file it is imported into.
Assuming gestureMinimumTranslation is a variable, then if you really want a global variable, it should be defined in only one .m file as follows:
int gestureMinimumTranslation;
Then, in the corresponding header:
extern int gestureMinimumTranslation;
And the other .m file should import the above header.
The linker is trying to join a set of objects with a common symbol. This often happens when the Compile Sources Build Phase has duplicate entries or a header file. Try removing these.

Resources