i am having an error as duplicate symbol _winsocks in /users/..../xxx.o and /users/..../yyy.o
can any one tell me how to avoid this error in XCODE.
I don't know about XCODE specifically, but this sort of error means that both object files define the the __winsocks symbol (which means they were compiled with something (maybe a header file) that defines this. If you can provide the compile/link instructions for each of them, then maybe we can give you more help.
Related
Is there any way for SymInitialize and SymFromAddr methods to automatically load symbols from a custom symbol store. I'm trying to resolve an address to a readable function name using SymFromAddr(). It seems to work fine if I have symbols for the given module stored locally, however I'd like it to automatically download them from the path given to SymInitialize, just like WinDbg does it.
I call SymInitialize like that:
SymInitialize(procHandle, "SRV*c:\\symbols*http://msdl.microsoft.com/download/symbols;http://mycustomstore.com/symbols", TRUE);
SymFromAddr returns error 487 "Attempt to access invalid address." as it can't find the symbol since it has never even attempted to download it.
Is there any way to force download them?
As it turned out dbghelp.dll needs symsrv.dll in order to load symbols. It was struggling to find it, so needed a bit of help.
I've used dbghelp logging to help track down the issue https://msdn.microsoft.com/en-us/library/ms680687.aspx
If you want to use a HTTP symbol store, you define it with
.sympath SRV*c:\mysymbols*http://example.com/symbols
To add the Microsoft symbol path, use
.symfix+ c:\microsoftsymbols
Looking at the WinDbg symbol path now gives you:
0:000> .sympath
srv*c:\mysymbols*http://example.com/symbols;SRV*c:\microsoftsymbols*http://msdl.microsoft.com/download/symbols
which tells us that your symbol path was not correct, since it didn't have the second SRV*...* part but just http://.... If you copy/paste the symbol path from your code to WinDbg, it probably wouldn't work as well.
I developing a game in Unity and I have used Admob, Facebook and GameCenter in it. It was working fine on iOS until I have added the OpenIAB for in-app purchase, though it works fine in Unity Editor.
I am getting this error in xcode:
duplicate symbol __Z14MakeStringCopyPKc in:
/Users/UmerAzeem/Library/Developer/Xcode/DerivedData/Unity-iPhone-ejwaywhkiokzjofdpwnbebkbleai/Build/Intermediates/Unity-iPhone.build/Debug-iphoneos/Unity-iPhone.build/Objects-normal/armv7/FBUnityUtility.o
/Users/UmerAzeem/Library/Developer/Xcode/DerivedData/Unity-iPhone-ejwaywhkiokzjofdpwnbebkbleai/Build/Intermediates/Unity-iPhone.build/Debug-iphoneos/Unity-iPhone.build/Objects-normal/armv7/AppStoreDelegate.o
ld: 1 duplicate symbol for architecture armv7 clang: error: linker
command failed with exit code 1 (use -v to see invocation)
See error screenshot here
I have tried almost all the solution that I could find over the internet, but still don't understand how can I remove this duplication error, I have tried looking for duplicate files too, but it also went in vain, someone help me out of this, would appreciate it.
Thanks.
Look up in your project for:
MakeStringCopy
And make sure it exists (if exists) only once. If it appears more then once, rename one (make sure to rename it where it being called as well) and try to build again.
I have recently face the same issue. I know Umer Azeem got the answer but to help someone else who may suffer from the same issue I was in.
According to my application flow I am using printer related third party class to print. To use that I have created object of that class in both of my files ImagePrintViewController and PrintResultViewController separately and passed required data to it.
In my scenario I am getting same error with variable name like _printerSetup in two of my files/Library/Developer/Xcode/DerivedData/../x86_64/ImagePrintViewController.o
and /Library/Developer/Xcode/DerivedData/../x86_64/PrintResultViewController.o.
I have search in both of my file for the above variable name. But I couldn't find that.
After searching long on this I got a idea to delete reference of my second file i.e. BRPrintResultViewController.h and BRPrintResultViewController.m after merging code in my first file.
With this I found my solution and my code runs fine after this.
PLATFORM
Visual Studio 2010 Proffesional
MY PROBLEM
I have a solution called solution A. I have projects 'a' (static library containing internal and external header and source files) and 'b' (executable to see if 'a' functions can be used).
I intend to use static library 'a' functionality in another executable project 'c' which is in a different Solution C. What I have done is the following:
1) Added the static library folder (relative path) to the Include Directories section in my 'c' project properties (both debug and release configurations).
2) Checked the intellisense messenger to see whether or not the imports were successful.
Before I build solution C, everything was fine. However, as soon as I build it popped LNK2019 error because there is a function foo()that seemed to be unresolved. The (reported) function signatures are:
extern void foo(params);
extern void bar(void);
Just to remind the readers, foo(params) function is in static library 'a' in Solution A.
The error message I got was:
error LNK2001: unresolved external symbol _foo
error LNK2001: unresolved external symbol _bar
MY digagnosis so far
The obvious diagnosis would be that:
1) the function signature reported seem to have a mismatch with my orignal one (I checked using real man's find and replace tool in visual studio; there is no mismatch).
2) Check for any include guards that is blocking it (I have checked once again, but it doesn't have any that will cause this problem).
The one things that I need to mention is that exec. project b in Solution 'C' can use foo and bar in static library a easily. That may be because they are in the same solution and by simply adding the project directory to Include Directories in the project b properties will do the job. But when I try to use it in a different solution, it is breaking down. I did a full clean and rebuild of the solution, but no luck.
I am starting to think that it cannot find the definition in the same header file and gets confused. Although the definition is in the identically-named source file, it may still get confused.
I am struggling to find a solution to this without having a full modification. Does anyone know what to do?
I think I solved this problem by simply using "Add Reference" by right-clicking on the executable project where I was using it. However, I still had to manually import the static library project 'a' into the foreign solution C so that the referencing can be made.
I know it is not probably a good way of doing things, but it is definitely safer and I am pretty sure that it is going to work - one way or the other.
Here's a different one from the usual confusion over duplicate symbol errors... :-)
I'm working on some legacy Mac code in an Xcode project that has the same global, "trace", defined in several different source files - for instance:
File1.c: SInt32 trace;
File2.c: Boolean trace;
etc. It's clear the original author meant them to have file-specific scope, but just neglected to prefix any of these lines with "static". That's fine, easy enough to fix.
But I'm kind of shocked the linker isn't flagging these! It looks to me like Xcode's linker (I presume gnu ld) only emits duplicate symbol warnings or errors for functions, that are linked into the code segment - but not global variables that are linked into the data segment. Instead, it silently conflates them, which is causing bugs.
So... how do I convince Xcode to emit link errors for duplicate global variables? Or get this information in some other way that can be a routine part of my build?
Well, I thought I'd answered my own question... :-)
I posted earlier:
So if you're using Xcode with LLVM GCC
4.2, go to the build settings dialog, find the "LLVM GCC 4.2 - Code
Generation" section, and check the "No
Common Blocks" checkbox. This enables
the compiler's "-fno-common" option,
and changes the object file generation
so that ld will choke and emit an
error if you have two globals in
different source files with the same
name.
Unfortunately, that doesn't seem to solve all instances. It seems to work fine if all the globals have the same type.
But the example in the question is taken straight from the code, where a variable named "trace" is defined as a global in two different files with two different types. And that's still not caught by the build system when I check that checkbox.
Is there a "call stack" for compiler errors in Visual Studio 2005 (C++)?
For example, I am using a boost::scoped_ptr as the value in a QHash. This is however causing the following compile error:
1>c:\qt\include\qtcore\../../src/corelib/tools/qhash.h(743) : error C2248: 'boost::scoped_ptr<T>::operator =' : cannot access private member declared in class 'boost::scoped_ptr<T>'
From the build output I know which of my source files is causing the error and the line number in the qhash.h that is causing the error but I am trying to track down the line number in my source file that is generating the error (hence the "call stack" idea).
Please note, I am not looking for the solution to the problem of using a scoped_ptr in a QHash but the problem of tracking down where compile errors are generated. This would also be useful for helping track down weird warnings. More often than not I run into this problem when using templated classes.
Thanks!
Sometimes with strange errors it helps to preprocess the file and look at that output. With VS look for "Generate Preprocessed File" under preprocessor settings (or set the /P switch). This will generate XXX.i from XXX.cpp which may help you figure out the problem.
Make sure you turn off the switch after, with this option turned on it won't generate an obj file.
If you look at the build output, you should see which project and which .cpp file was being compiled when this error occurred.
There is really no notion of "call stack" here, because the compiler processes one source file at a time. You have a compiler error in the header file, so you need to find out which source file including that header was being compiled.
These types of errors can be hard to track down. Usually I end up comment out code and finding the offending line and working from there. After doing it a while you will learn to better read the error messages and understand what tripped up the compiler. As it stands the compilers error messages are just horrible.
In this case it is saying that you have an object of type boost::scoped_ptr<T> that it is trying to copy but the class won't let you (operator= and the copy ctor are both hidden). So you need to look at how the class is used and see why it is trying to copy it. Maybe a scoped_ptr isn't what you need. Maybe you need a shared_ptr?