cygwin warning: COMDAT symbol does not match section name - gcc

I am using g++ (5.4.0) on cygwin, to compile and link some cpp files. Compilation goes through fine, but during linking I get many errors like:
lib.a: warning: COMDAT symbol '.pdata$_ZnwmPv' does not match section name '.pdata'
lib.a: warning: COMDAT symbol '.xdata$_ZnwmPv' does not match section name '.xdata'
I am not able to figure out what this message means, nor how to fix the problem. I tried a google search, and got this link: https://sourceware.org/bugzilla/show_bug.cgi?id=15041
It seems to indicate that the problem is fixed and checked in, way back in 2013.
So does my error message mean that this fix is not available in the gcc of cygwin? Or is there something else that I need to do to fix/bypass this problem?
Also, is there any way I can get more details on what exactly is the mismatch? That may indicate what I need to fix in my code.
Some more details : The warning occurs only in cygwin, and not in ubuntu, so I have also added the cygwin tag to this question and also mentioned cygwin in the question. And it happens only when I add the following code to my classes. If the addObject2 method is deleted, and the private member _obj2Array is made public and its code is moved to the application, then the warning goes away.
myObject1.h:
class myObject1: public myParent {
... // constructors, etc
vector<myObject2*> _obj2Array;
public:
void addObject2(myObject2* obj2);
}
myObject1.cpp:
void myObject1::addObject2(myObject2* obj2) {
_obj2Array.push_back(obj2);
}

Related

Ignore Sphinx autodoc warnings for rtype values

Right now autodoc seems to throw warnings for any rtype value that is not just an object type (a class instance, int, list, dictionary, etc). So a return value such as "list of tuples" will throw a warning. Is there any way to ignore these warnings (either individually or on the whole)? I don't want to ignore the whole file, just those specific warnings.
An example of this warning might be something like:
/path/to/code.py:docstring of path.to.code.method:: WARNING: py:class reference target not found: list of tuples
And in some cases, I'm seeing errors for objects that I know are legit classes imported in the code like:
/path/to/code.py:docstring of path.to.code.method:: WARNING: py:class reference target not found: Response
In that example, "Response" is part of rest_framework.response, so it's a pretty commonly used class object.
These warnings happen anytime I do a fresh make docs. It's not clear to be that it can be reproduced in another environment.
The solution here was that the classes in question were not in a toctree, so were not part of the docs. Basically, autodocs wants to be able to link to classes mentioned in type variables. If it can't do that, it will throw an error saying "I have no idea what "Response" is (or whatever the class happens to be that you return). Not an error, because it assumed you're right, but a warning that it can't find it. So the solution here was to create an index.rst that included the class, then a Response.rst (for example) including the relative path to the class. Below is an example of this process. It assumes that Response is in a rest.py.
error: /path/to/code.py:docstring of the.code.rest.GetAccount.get:: WARNING: py:class reference target not found: Response
In my case, this needed the following:
add a line item for response to modules/code/rest.rst
add response.rst in the same directory
include the line `.. automodule:: code.rest.Response
Then delete and rebuild docs and it should be good to go.

OS X Swift Compiler Error - Segmentation Fault

I am making some variable declarations in a NSViewController custom class. The declarations are:
var filterSettings: Dictionary<String, String> = ["Location": "All", "Status": "All", "PPRDate": "All", "Project Manager": "All"]
let locationFilterSettings: Set = ["All", "Newcastle", "Sydney", "ACT & Southern NSW", "Western Sydney", "Grafton"]
let statusFilterSettings: Set = ["All", "Active", "Inactive"]
var PPRDateFilterSettings: Set<NSDate> = [] // this value needs to be set programiticaly by loading up the available PPR Dates --- use PPRDateFilterSettings.insert(dateVariable)
var projectManagerFilterSettings: Set<String> = [] // this value needs to be set programatically by loading up the available PMs
When the program compiles I get one error that shows up in the issues navigator: - a compiler error is not shown against any particular line in the code.
When I go to the issue navigator it shows against this class the following error. All other classes compile correctly with no errors:
"Swift Compiler Error Command failed due to signal: Segmentation fault: 11"
I admit to not knowing how to debug this error.
I do know that if I comment out the let locationFilterSettings.. line in the code that the compiler error goes away.
I have just added this code for the variables shown above and do make any other reference to the filterSettings valuable yet. No other changes have been made to the code which was compiling and running as expected.
Any advice on where/how to debug the issue please let me know. I am not sure what to do next.
I should add that I am running the latest version of Xcode and OSX.
I have also tried playing with optional declaration as suggested in one of the answers here:-->Swift compiler segmentation fault when building but to no avail.
EDIT: Some additional information.
I deleted and re-installed Xcode. The error still occurred.
Having declared the variables within the class I wasn't actually referencing them within any functions so I tried println the variables at a few spots in the code. The error still occurred.
I moved the declarations from the global level within the class to within one of the functions. The error disappeared.
So- three above partially solved the issue for me. I wanted the variables to be available through the class so now I may need to pass them around as parameters (which seems to work). However, I still do not understand why the error was occurring and if it was a syntax thing that I was missing.
Ok - I have now been able to compile the code without an error with the properties declared at the top of the Class.
The issue was the use of the short form declaration relying on the type of item being inferred.
let propertyName: Set = ["item1", "item2"]
when I initialised the property using the following syntax
let propertyName: Set<String> = ["item1", "item2"]
it compiled without an error. The short form declaration worked when the property was declared within a function.

DXUTSetD3D11Device function missing from DXUT

I'm writing a basic program using direct3d and DXUT.
I am creating a direct3d device manually with D3D11CreateDeviceAndSwapChain() and passing it to DXUT using the DXUTSetD3D11Device() function which, according to the documentation should be correct.
What confuses me is that I get an LNK2019: unresolved external symbol error when calling DXUTSetD3D11Device(). I can call other DXUT functions such as DXUTCreateWindow() just fine, also I have built DXUT myself and have linked to it properly.
When I look in DXUT.h I can find the declaration of DXUTSetD3D11Device() but when I look in DXUT.cpp I can't find any reference to this function, so I think this might be why I'm getting this linker error.
This seems to be the same problem as mine.
I'll leave the relevant pieces of code here, just in case:
bool DXUTEngine::Initialise()
{
HR(DXUTCreateWindow(m_appname));
if(!m_pDirect3D->Initialise(DXUTGetHWND(), m_width, m_height))
{
OutputDebugString(L"\n\n Failed to initialise Direct3D\n\n");
return false;
}
HR(DXUTSetD3D11Device(m_pDirect3D->GetDevice(), m_pDirect3D->GetSwapChain()));
return true;
}
Here's where I create the device:
result = D3D11CreateDeviceAndSwapChain(NULL, driverType, NULL, 0, &featureLevel, 1,
D3D11_SDK_VERSION, &swapChainDesc, &m_pSwapChain, &m_pDevice, NULL, &m_pContext);
At the moment I either think I'm doing something very wrong or that this function just doesn't exist. I'd really appreciate any help.
Thanks in advance.
From the link you post which point to MSDN forum, the DXUT11 framework was delivered in source code, so there is no lib files. so the error was not about any link errors.
Another important thing is: function DXUTSetD3D11Device has no implementation in DXUT framework. if you want to use it, you should implement it yourself.

Errors when adding a wxStaticText with wxSmith

I am really new to c++ development(2 days) and everything has gone well so far, but when I add a wxStaticText through wxSmith, the auto-generated code won't compile:
error: 'StaticText1' was not declared in this scope
StaticText1 = new wxStaticText(this, ID_STATICTEXT1, _("Label"), wxPoint(8,8), wxDefaultSize, 0, _T("ID_STATICTEXT1"));
error: 'ID_STATICTEXT1' was not declared in this scope
const long dlgAbout::ID_STATICTEXT1 = wxNewId();
I also have a wxButton on the dialog, but does the exact same things and the compiler doesn't have those errors for the auto-generated button code:
btnClose = new wxButton(this, ID_BUTTON1, _("Close"), wxPoint(88,96), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON1"));
and
const long dlgAbout::ID_BUTTON1 = wxNewId();
Full Source at http://pastebin.com/iyFF31eJ
Since the code you pasted compiles for me, it must mean that the code you pasted is not the code that your compiler is attempting, and failing, to compile. I think that you need to check that you may have a couple of versions of the dlgAbout.h file floating around and the compiler is using the wrong version, without the definition of ID_STATICTEXT1

Including DirectShow library into Qt for video thumbnail

I'm trying to implement http://msdn.microsoft.com/en-us/library/dd377634%28v=VS.85%29.aspx on Qt, to generate a poster frame/thumbnail for video files.
I have installed both Windows Vista and Windows 7 SDK. I put:
#include "qedit.h"
in my code (noting there is also one in C:\Qt\2010.04\mingw\include), I add:
win32:INCLUDEPATH += $$quote(C:/WindowsSDK/v6.0/Include)
to my *.pro file. I compile and get " error: sal.h: No such file or directory". Finding this in VC++ I add
win32:INCLUDEPATH += $$quote(C:/Program Files/Microsoft Visual Studio 10.0/VC/include)
And now have 1400 compile errors. So, I abandon that and just add:
win32:LIBS += C:/WindowsSDK/v7.1/Lib/strmiids.lib
to my *.pro file and try to run (without including any headers):
IMediaDet mediadet;
But then I get "error: IMediaDet: No such file or directory".
#include "qedit.h"
gives me the same error (it looks like it's pointing to the Qt version) and
#include "C:/WindowsSDK/v6.0/Include/qedit.h"
goes back to generating 1000's of compile errors.
Sigh, so much trouble for what should be 10 lines of code...
Thanks for your comments and help
Since you say you are "a C++/Qt newbie" then I suspect that the real issue may be that you are attempting to load the library yourself rather than simply linking your application to it?
To link an external library into your application with Qt all you need to do is modify the appropriate .pro file. For example if the library is called libfoo.dll you just add
LIBS += -L/path/to/lib -lfoo
You can find more information about this in the relevant section of the qmake manual. Note that qmake commonly employs Unix-like notation and transparently does the right thing on Windows.
Having done this you can include the library's headers and use whatever classes and functions it provides. Note that you can also modify the project file to append an include path to help pick up the headers eg.
INCLUDEPATH += /path/to/headers
Again, more information in the relevant section of the qmake manual.
Note that both these project variables work with relative paths and will happily work with .. to mean "go up a directory" on all platforms.
Note that qedit.h requires dxtrans.h, which is part of DirectX9 SDK.
You can find dxtrans.h in DirectX SDK from August 2006. Note that dxtrans.h is removed from newer DirectX SDKs.
Do you have access to the source of the external library? The following assumes that you do.
What I do when I need to extract a class from a library with only functions resolved, is to use a factory function in the library.
// Library.h
class SomeClass {
public:
SomeClass(std::string name);
// ... class declaration goes here
};
In the cpp file, I use a proxy function outside the extern "C" when my constructor requires C++ parameters (e.g. types such as std::string), which I pass as a pointer to prevent the compiler from messing up the signature between C and C++. You can avoid the extra step if your constructor doesn't require parameters, and call new SomeClass() directly from the exported function.
// Library.cpp
#include "Library.h"
SomeClass::SomeClass(std::string name)
{
// implementation details
}
// Proxy function to handle C++ types
SomeClass *ImplCreateClass(std::string* name) { return new SomeClass(*name); }
extern "C"
{
// Notice the pass-by-pointer for C++ types
SomeClass *CreateClass(std::string* name) { return ImplCreateClass(name); }
}
Then, in the application that uses the library :
// Application.cpp
#include "Library.h"
typedef SomeClass* (*FactoryFunction)(std::string*);
// ...
QLibrary library(QString("MyLibrary"));
FactoryFunction factory = reinterpret_cast(library.resolve("CreateClass"));
std::string name("foobar");
SomeClass *myInstance = factory(&name);
You now hold an instance of the class declared in the library.

Resources