Unable to jump to source code when navigating the code maps - visual-studio-2017

I am able to generate the code map for my solution but for some reason, I can't link the object on the map with the source code. For instance if I locate my cursor on the Coins object and double click or pressed F12 nothing happens and I get the message: "Cannot view content for: Coins". Thanks for any help.

Related

How to put image on button? wxwidgets c++

Hey guys I'm new in c++ wxwidgets programming.
I would like to know the easiest way to put an image into a button.
I tried :
button1 = new wxBitmapButton(side_panel, wxID_ANY, wxBitmap("image.png",wxBITMAP_TYPE_PNG), wxPoint(150,30), wxSize(30, 30),wxBORDER_NONE);
But I always get the same error:
If you expand the error dialog you see, you should see more information about the error, but my guess is that the image simply can't be found. You should check that the file image.png indeed exists in the current working directory of your program, i.e. the directory that you run it from, assuming you don't change it later.
You should also actually check for errors in your programs, even simple ones, i.e.
wxBitmap bmp("image.png");
if (!bmp.IsOk()) {
... handle the error somehow instead of blithely using an invalid bitmap ...
}

How to stop Clion tab key behaviour

When on a C++ line of code like the following
aType.aMethod(
std::make_shared< T_1>();
^^^^^-- Press tab here
)
Clion tries to move to the next parameter(i guess), but being the only parameter it goes nowhere. I want to have the tab to just insert characters(tab or space that is) and not to try to cycle the cursor among the method parameter. Is there a way to stop this alternative functionality?
I searched to no avail in
Settings|Editor|CodeStyle|C/C++
Thank you
"Try changing the "Next parameter" and "Previous parameter" keybindings to something else than Tab."
– Eldar Abusalimov Jul 5 '17 at 9:02
In addition to the accepted answer, i found that tab was assigned to Next Live Template Parameter Under : Main Menu | Navigate | Navigate in File (This is in the keymap section in settings, not the actual main menu). So when i generated definitions for the methods in my class and it jumped into the cpp if there were any auto generated functions with return initializer; as the method body it would jump to these instead of letting me indent code so i turned that off too and now i can happily implement the methods in order and fix those up when i get to them. Alternatively if you like that setting and want to keep it turned on, Hopefully knowing that you have to tidy up all instances of return initializer; before the tab key will indent code again is useful to you, i found it very confusing.
EDIT: i realise this wasn't part of the original question, but this is where googles top result brought me, so i hope you don't mind me adding this info here as its still related to the tab key doing weird things in CLion.

Context in GPS Plugin

I created a button in the toolbar using
GPS.Toolbar().append(button)
In the On_Click function of the button I want it to print the current file's name.
I wrote print GPS.Current_Context().file()
But it does'nt work and give me the error : Current_Context has no attribute file
Anyone knows why?
Use EditorBuffer to get the current view's name:
EditorBuffer.get().current_view().title()
This will give you the title of the current editor tab, which is the name of the edited file.

Signal and slot Qt

I’m trying to write a very simple calendar program (I’m trying to learn Qt). The program itself is very basic, all it does is open a dialog box which displays today’s date with a button next to it. When the button is pressed another dialog opens, which I’ll call the calendar picker.
Here is the gist of the program: First, the main dialog opens with the current date. Then when the button shown in the picture is pushed, a signal is sent to a function which opens the picker and sets up a connection between the two classes which I'll describe below! The picker opens in which you can choose a date if you want. Let's say you choose a date by double clicking it. A signal is then sent to a function which closes the picker and the function then emits a signal to the main dialog to update the date to the new date. Now here's the problem:
Both the main dialog and the picker are in separate classes and I'm trying to set up a connection between the two classes when an item is double clicked.
***EDIT: Ok, now my problem is that I have Picker *mypicker declared in my header file and when I try using it in the .cpp file for example mypicker->show(); it causes the program to crash. Anyone know why?
Any help would be appreciated!!
undefined reference to MainDialog::updateDate(QDate)
Usually means that the compiler or the linker can't find the reference to it. So in your header, you make a promise that it will exist.
Then if when matching things up later the reference was never found... you get an error.
So what probably happened is one of a few things:
In your maindialog.cpp file you have:
// Either no definition of updateDate at all, Wrong because you put in your header a declaration for one.
void updateDate(QDate date) // Wrong because it doesn't specify MainDialog
{
}
void MainDialog::updateDate() // Wrong because it doesn't match the parameter list
{
}
void MainDialog::updatedate(QDate date) // Wrong because the function name is off
{
}
QDate MainDialog::updateDate(QDate date) // Wrong because return type is off
{
}
void MainDialog::updateDate(QDate date) // Correct! Matches the header file perfectly!
{
}
Then after you get past that, and other compile errors, keep an eye on the Application Output, because the connect call is a runtime connection, so it won't report a syntax mis-alignment until at the moment a connection is attempted.
Hope that helps.

Loading Nib and Displaying Window in Objective C++

I am trying to load a Nib from a C++ constructor with Objective C++. I have searched and found enough examples to get some code together but it doesn't display the window. Or any windows for that matter.
Here is an example of the contructor:
JokeSystem::JokeSystem() : fileSystem("/Library/Application Support/Jokes/")
{
try
{
randSystem = new RandSelect<std::string>
(fileSystem.getAllFileContents("%\n"));
}
catch (std::ifstream::failure)
{
NSWindowController * errorWindowControl = [[NSWindowController alloc]
initWithWindowNibName:#"ErrorWindow"];
[errorWindowControl showWindow: nil];
}
}
The purpose of the contructor is to load the contents of a directory into a string. What I am try to do is display the error window when the files fail to open.
ErrorWindow.nib has a single window with an OK button and a NSTextView for the error, I set up a NSWindowController in the nib and connected it to the window.
My only link has been that most examples show this [errorWindowControl showWindow: self];
rather than showWindow: nil but because this is a C++ constructor I it doesn't have self and this doesn't work.
If it matters this contructor is called from the awakeFromNib method of the MainMenu.nib's primary NSObject.
Thanks
A bit of an odd way to approach Cocoa. I would encourage you to step back, learn Objective-C and then write your application with an Objective-C based Cocoa UI layer on top of whatever backing store or model layer you have.
In any case, there isn't anything particularly wrong with that code (save for the odd design).
The first thing to check is the return value of -initWithWindowNibName:. Is errorWindowControl actually non-nil? If it is nil, then the NIB failed to load.
How are you writing the Cocoa application itself? Standard app bundle using Xcode, I hope?
Also, you shouldn't be hardcoding the path to /Library/Application Support/. Actually, your application shouldn't use that directory as the only storage location; many users won't have write access to that directory and won't be able to install your app without administrator access.