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
Related
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);
}
Right so essentially I am creating a user interface and have attempted to add a QtWidgets.QLineEdit to a QVBoxLayout as well as a QtWidgets.QLabel to a different QVBoxLayout. Unfortunately it is not working and throwing up an error:
in build_gui_adddata_device
self.labellayout.addWidget(self.labelsupplierid)
TypeError: QBoxLayout.addwidget(QWidget; int stretch=0, Qt.Alignment alignment=0): first argument of unbound = method must have type QBoxLayout
I have defined labellayout as thus:
print("e")
self.labellayout = QtWidgets.QVBoxLayout
"e" was printed, which is how I know that there is no issue with the definition of the layout itself.
Just for reference this is the QtWidget I was trying to add:
print("f")
self.labelsupplierid = QtWidgets.QLabel("Supplier ID: ")
Again "f" was printed
This is the line that is causing the problem:
print("i")
self.labellayout.addWidget(self.labelsupplierid)
I don't understand why my code isn't working, I am honestly perplexed. My syntax seems to be correct and I have made other build_gui functions that have executed exactly the same type of code (with different widgets, might I add) that have been successful.
Please can someone enlighten me. Many Thanks.
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.
File A:var x: number = 5;
File B:var x = function (): number { return 5; };
Error:Subsqeuent variable declarations must have same type.
Removing all references (///<reference path='/Scripts/example.ts' />) has NO effect on my project. Everything still compiles, Intellisense still works. To my understanding, this is definitely not intended behavior. Any variable declared in any file is available in all files, like the one that caused the error above. I've been aware something weird was going on but I'm about to embark on a project where File B is going to have lots of variables of the same name as A, but they must remain separate. So this is an issue. But I can't find any reading on what's going on here. Everyone says you control Intellisense with the reference directive and you must use it.
Can't find anything about this in Project Settings>TypeScript, nor Tools>Options.
It's expected behavior. Use modules to separate variables in different files
// file 1
module First {
var x = 3;
}
// file 2
module Second {
var x = function (): number { return 5; };
}
See also TypeScript module documentation and
javascript module pattern
Another option would be using AMD or CommonJS compilation option of the TypeScript, see this article
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.