A is main project. There are Four three subproject- B, C D added in main project A. All of three sub project generate a static library file ie .a
Subproject B require C in order to compile so C is added as a static library inside B subproject.D also require C to compile and generate lib file so C is also added inside D subproject as a static library.
Now main project A require B and D to compile and generate .app file. So both B and D added as a library files inside A project.
Now issue is while compiling project I am getting duplicate symbols linking error because C is added two times in main project via B and D.
duplicate symbol _OBJC_IVAR_$_Operation._requestKey in:
/Users/sandeep/Library/Developer/Xcode/DerivedData/square-fananfxhlvhxxgfqnkzssqckfmmj/Build/Products/Debug-iphonesimulator/libTeamCBService.a(Operation.o)
/Users/sandeep/Library/Developer/Xcode/DerivedData/square-fananfxhlvhxxgfqnkzssqckfmmj/Build/Products/Debug-iphonesimulator/libCBService.a(Operation.o)
duplicate symbol _OBJC_IVAR_$_Operation._sequenceNumber in:
/Users/sandeep/Library/Developer/Xcode/DerivedData/square-fananfxhlvhxxgfqnkzssqckfmmj/Build/Products/Debug-iphonesimulator/libTeamCBService.a(Operation.o)
Please let me know how can I resolved this problem so that there will be no kinking error. Is there a way to add C inside multi subproject to avoid duplication issue.
Related
I have independent modules (Spring Boot Application with imbedded Tomcat) in a multimodule project. Have requirement to merge artifact of all modules in one JAR. By passing parameters of specific module, I should able to run the jar which should load that module.
e.g -
I have module A, B and C with all the properties file associated to individual module.
Module A, src/main/resources/application-A-.properties
Module B, src/main/resources/application-B-.properties, -
Module C, src/main/resources/application-C-.properties
Creating a new module D which dependent on A, B and C as
Module D with resources as below,
config/A/application-A-.properties
config/B/application-B-.properties
config/C/application-C-.properties
Once we create a Fat JAR or Uber JAR (say, D-shade-test.jar) then I should be able to run the application by calling jar with parameter, like
java -jar D-shade-test.jar --spring.config.location=classpath:/config/A/application-A-.properties
Thanks in advance.
I create a new F# console application project in Visual Studio 2015
I create a simple new module file called Calc.fs like so:
module Calc
let add a b = a + b
I add an F# script file to the project like so:
open Calc
let c = add 1 2
I get the following compiler errors in the script file:
The namespace or module 'Calc' is not defined
and
The value or constructor 'add' is not defined
Why is my module not recognized by my script file? How can I fix this?
Please note that my script file appears after the module in the order of files in the project:
.fsx files are not compiled together with the rest of the project; they don't "know" about any other code unless you explicitly make it known to them. This is true for any external DLLs (and in fact even many in the .NET Framework) as well as other F# code.
You need to add
#load "Calc.fs"
at the top of the script file to tell the compiler to load that code before evaluating the rest of the script.
I have three projects in XCode.
ProjectA, a pure C project
ProjectB, a objective C project
ProjectC, a mix of objective C and Swift
ProjectA is a static library project used in ProjectB.
Header files from projectA are in copy file target, it is in ProjectB\lib\ProjectA.a and \lib\include folder.
ProjectB is linked as a sub project in ProjectC.
ProjectC imports some header file from ProjectB.
Those header files in ProjetB have imported header files in ProjectA.
My problem is, ProjectA is not visible in ProjectC. ProjectC compilation fails since ProjectC imports headers from ProjectB and B has header files imported from projectA.
What is the way to solve this C->A dependency on .h files?
In ProjectA.
file DesTypes.h:
// some types are defined here.
In ProjectB.
ProjectA.a is linked as static lib.
File CryptoUtil.h :
#import DesTypes.h
// some function prototypes used types from Destypes. The .h is in search header path. So no problem.
I need the import here since some function prototype uses the types from DesTypes.h.
Otherwise importing DesTypes.h in CryptoUtil.m file would solve the problem.
In ProjectC
File MyViewController.h:
#import CryptoUtli.h
// Here I get compile error for chaining. I do not use anything from DesType.h.
I have a static framework B which I use inside a framework A. B has a class C I want to also expose in A, i.e. in the illustration below I want the App to be able to use the class.
App > framework A > static framework B > class C
If I try to include the header for C in the public headers of A, I get 'duplicate interface definition'. But as the code is compiled into A from B, I just need to expose the class interface – presumably that will allow the App to link correctly...?
I achieved this through a bit of a workaround.
When a static library/framework is compiled into another framework/static library, its symbols are still exposed (verify through nm <binary> | grep <symbol>). This means you just need your App code to know about those symbols – i.e. including the header for class C in framework A.
In your headers in framework A, you need to include the class C header. When compiling the framework you need to use "ClassC.h", but when the framework is being used you need <FrameworkName/ClassC.h>, as that is its location in the framework included by the App. To do this you use a macro which is removed in a run script phase.
So, in your framework A target build phases, make sure your header for Class C is in the 'public' section of your copy headers phase, then add a 'Run Script' phase and paste the following:
TARGET_MACRO="TARGET_FRAMEWORK"
cd -P "$BUILT_PRODUCTS_DIR/$WRAPPER_NAME/Headers/"
perl -0pi -e "s/\#if ${TARGET_MACRO}.*?\#else\r?\n?(.*?)\r?\n?\#endif/\1/sg" *.h
Change `TARGET_FRAMEWORK" to be whatever, or leave it.
In Framework A build settings, under preprocessor macros, add TARGET_FRAMEWORK=1 for all build configurations.
Then, in your Framework A headers that include Class C, use:
#if TARGET_FRAMEWORK
#import "ClassC.h"
#else
#import <FrameworkA/ClassC.h>
#endif
I am porting a static library project composed entirely of "C" files to iOS and when I try to use the library in an application I get a bunch of undefined symbols.
The problem appears to be name decoration. For example, let's say I have the function:
unsigned int hello_world(int arg1, int arg2);
When I use "nm" to look at the .a file I see the following:
For file1.c where the function is implemented:
0000002c T __Z10hello_worldii
For file2.c that calls the function:
U __Z10hello_worldii
But for file3.c that also calls the function and for which the symbol is undefined I get:
U _hello_world
All three .c files are in the library project. The prototype is in a header file that is included by both file2.c and file3.c. Are the __Z10 and ii C++ name decorations? If so, why are these C files being compiled as C++?
EDIT:
Codo's question in regard to the "Compile Sources As" setting led me to try changing it to "C" from "According to File Type". This forced all files to be compiled as "C" and resolved the function name mangling problem but I still had 42 undefined symbols which almost all turned out to be variables. I noticed that there were no initializers for these variables so I added an initializer to one of them and when I rebuilt the project that uses the library, I only had 3 undefined symbols. It appears that adding just one initializer to a variable enabled the linker to resolve all references to that modules variables. The 3 remaining undefined symbols appear to be yet another problem(s).
EDIT2:
Of the 3 remaining errors, 1 was an uninitialized variable from another module and 2 were in-lined functions that needed to be declared static.