Watching Variables with same name in IAR watch window - iar

Need some help, in one project I have started working on, I found that the same name variables (static defined) in separate files, and when I tried to add these variables into the "Live Watch" or "Watch Window", IAR display "Unknown or ambiguous symbol", which is for obvious reasons as it gets confusing which one to display as the same name is used in multiple files.
I searched over the internet and found one page.
https://www.iar.com/support/tech-notes/debugger/resolving-variables-with-same-name-in-c-spy/
And it works fine when the files are in the project directory, if the same name variable is inside some folders, then I am not able to access the variables.
Can anyone please suggest what is the correct format to access these variables?
Thanks in advance.

In the above project, there was a mistake done by me, the filename name is "tes2.c" the "t" is missing, and due to this it was not working.
if I type tes2\testvarI am getting the output, so it was my mistake.
But there is some more point, which I got after contacting the IAR support team, and I will share this information below.
If the "pre-include" file is specified in your IAR IDE, then this doesn't work, this is a known issue and is present till now, and they will fix this in the next upcoming releases.
Actually, in my main project, there is a "pre-include" file and that's why even after entering the correct information, I am not getting the proper data on the "Live Watch" or "Watch Window". The example shown here was a demo project to show the issue I am facing.
Now there is another possibility to view/watch the static variables.
Click on "View" --> "Statics" this will list down all the status variables in your project and this works well even when the "pre-include" file is included in the IAR IDE.

Related

Where to put assets in xcode? [duplicate]

This question have been asked numerous times, but I have not managed to get an answer that I am happy with. Probably because the most answers is of "how do I do this?" type and also get "this way you do this" answers.
The problem I have is that I need to use absolute paths when I want to reference to images in Xcode (version 6.0.1). I am quite sure that I could place the images in my working directory which is something like:
/Users/patrikek/Library/Developer/Xcode/DerivedData/ChessGame-
ftpbqerfsenxxbfvneyzfwdmtwjk/Build/Products/Debug
Then add the file to some Xcode group in project navigator (eg. images/myImg.png) and I would be able to reference the file as myImg.png (since I have not foldered the image inside my working directory). I am also quite sure that the project navigator stuff would not b required for this to work.
And after this introduction comes the questions:
1) Is it necessary to place all images and other resources in the current working directory? Also, if not what is the best way to store folders in a program and is it necessary to name the folder containing images to Resources?
2) Is it possible to arrange files using the project navigator? What I am after is to use the project navigator only and let Xcode worry about the details of copying files and so. It seems somehow unnecessary to have a project navigator, when the physical files are not packaged in the same way. It does also seem error prone to update the project navigator and the physical hierarchy independently of each other.
An example:
I create a folder images in the Project navigator, inside that folder am I placing a reference to the image using the usual way in the project navigator. Is it now possible to make Xcode arrange so that I can do a call images/myImg.png when I want to load the image in some function (without me doing anything, since if I move many images to my working directory I may forget one and I may also spell images wrong by mistake if I create another folder in my working space). Also what have happened inside Xcode when this action was done?
Since I am not at all familiar with Xcode yet I may have got something wrong here, but the core of this problem is to find out where the files physical location must/should be and if there is some way to let Xcode do this by using the project navigator.
BR Patrik
Xcode does not manage images the way you have presumed that it does. Take a look at the 2013 WWDC "What's New in Xcode" video to see how Xcode 5 and Xcode 6 organize and manage images for any given project. When you have configured the asset catalogues for your project correctly, it wouldn't matter where the original images live on disk. As long as you have dragged the right assets into the right catalogues, your projects will work. The good news is that you only need to configure images once and change only the ones that change once done. For details, see this wwdc video: http://devstreaming.apple.com/videos/wwdc/2013/400xex2xbskwa5bkxr17zihju9uf/400/ref.mov
Once an image is configured in the asset catalogue, you can refer to it with or without it's file extension. For example, you can refer to "example.png" as "example" in your code. Hence, "myImg.png" can be "myImg" or "myImg.png" in code. No need to worry about which subdirectory contains it.
Now if your question has to do with runtime assets, again your development system directory structure would not matter. If that is the case, then you might have to re-ask your question. I would be glad to help you there as well--if that's what you want to know.

How to reference to images and other objects in Xcode and where to place them physically?

This question have been asked numerous times, but I have not managed to get an answer that I am happy with. Probably because the most answers is of "how do I do this?" type and also get "this way you do this" answers.
The problem I have is that I need to use absolute paths when I want to reference to images in Xcode (version 6.0.1). I am quite sure that I could place the images in my working directory which is something like:
/Users/patrikek/Library/Developer/Xcode/DerivedData/ChessGame-
ftpbqerfsenxxbfvneyzfwdmtwjk/Build/Products/Debug
Then add the file to some Xcode group in project navigator (eg. images/myImg.png) and I would be able to reference the file as myImg.png (since I have not foldered the image inside my working directory). I am also quite sure that the project navigator stuff would not b required for this to work.
And after this introduction comes the questions:
1) Is it necessary to place all images and other resources in the current working directory? Also, if not what is the best way to store folders in a program and is it necessary to name the folder containing images to Resources?
2) Is it possible to arrange files using the project navigator? What I am after is to use the project navigator only and let Xcode worry about the details of copying files and so. It seems somehow unnecessary to have a project navigator, when the physical files are not packaged in the same way. It does also seem error prone to update the project navigator and the physical hierarchy independently of each other.
An example:
I create a folder images in the Project navigator, inside that folder am I placing a reference to the image using the usual way in the project navigator. Is it now possible to make Xcode arrange so that I can do a call images/myImg.png when I want to load the image in some function (without me doing anything, since if I move many images to my working directory I may forget one and I may also spell images wrong by mistake if I create another folder in my working space). Also what have happened inside Xcode when this action was done?
Since I am not at all familiar with Xcode yet I may have got something wrong here, but the core of this problem is to find out where the files physical location must/should be and if there is some way to let Xcode do this by using the project navigator.
BR Patrik
Xcode does not manage images the way you have presumed that it does. Take a look at the 2013 WWDC "What's New in Xcode" video to see how Xcode 5 and Xcode 6 organize and manage images for any given project. When you have configured the asset catalogues for your project correctly, it wouldn't matter where the original images live on disk. As long as you have dragged the right assets into the right catalogues, your projects will work. The good news is that you only need to configure images once and change only the ones that change once done. For details, see this wwdc video: http://devstreaming.apple.com/videos/wwdc/2013/400xex2xbskwa5bkxr17zihju9uf/400/ref.mov
Once an image is configured in the asset catalogue, you can refer to it with or without it's file extension. For example, you can refer to "example.png" as "example" in your code. Hence, "myImg.png" can be "myImg" or "myImg.png" in code. No need to worry about which subdirectory contains it.
Now if your question has to do with runtime assets, again your development system directory structure would not matter. If that is the case, then you might have to re-ask your question. I would be glad to help you there as well--if that's what you want to know.

VS2010 does not find #include via environmental variable

I'm currently running into a problem that drives me a little bit mad. I hope it's a little stupid mistake on my side.
For convenience, I added an environmental variable in Windows 7, VS_BOOST_INCLUDE_HEADER with the value set to D:\01_Programs\boost_1_55_0\. My VC C++ include directories contain $(VS_BOOST_INCLUDE_HEADER).
Remark: I changed that variable this morning, but I've rebooted my computer since than multiple times.
Now my VS project complains it can't find any of the boost includes anymore, e.g. <boost/asio.hpp>. If I add the whole path manually to the include paths (adding D:\01_Programs\boost_1_55_0\ as text to my VC C++ include directories), everything works as expected.
To avoid a simple typo, I added a post-build event:
echo $(VS_BOOST_INCLUDE_HEADER)
That works as expected:
1>PostBuildEvent:
1> D:\01_Programs\boost_1_55_0\
All my other environmental variables still work as expected, even those that were renamed this morning as well.
Any ideas?
What am I doing wrong?
Maybe I'm late to the party, but a possible scenario is when you
run VS as administrator
adjusted a User environment variable
Then it would make some sense for VS to see the System environment only and still use the old value.
If you decide to use property sheets the msdn has clear docs
"If you have a common, frequently used set of properties that you want
to apply to multiple projects, you can use Property Manager to capture
them in a reusable property sheet file"
Under the view menu, chose property manager and add a new sheet.
You can then make your project inherit its settings from this property sheet, thereby just setting this in one place.

Visual Studio C++ does not update new code after building

Before anything, I will first say that I've been looking everywhere for a solution to this problem for an hour now. There are many identical problems out there but none of the solutions help me.
I'm trying to debug a small project. When I started working on the project, I could place break points wherever I wanted and I would hit them. But for some reason, now when I place breakpoints outside of the main program (in a class definition, for example), the breakpoints hollow out while the code is running and I get a message saying the source code is different from the original version.
This led me to believe it was running a previous build, so I made an obvious change by having the code output some random letters "dajfhdjhfds";
I hit F7 as usual. Got a message saying Build: 1 succeeded. Hit F5, the program runs but does not display the random letters.
I clean my solution, then build and the changes show. I 'rebuild' the solution, and the changes show. The breakpoints also work.
But then if I make further changes, the breakpoints stop working and the changes don't appear in the program. Visual Studio is always running old code. I don't want to have to clean my solution every time I want to debug new code.
I've reset my settings, I checked off "build" in the configuration manager, I even started a whole new project and copied my code into new files. Same issue.
The problem resided in the fact that I copied the code from the original project into a brand new project saved elsewhere. When I tried to build the project in the new location it would always build it in the old location (Strange since I copied code directly into brand new files).
When I tried to run the files it would look for the built code in the new location. Therefore it would always get out of date code.
Problem can be fixed by putting the new code back in the old location!
Thanks everyone
I had this problem occur also, using WinForms. I was adding message boxes to test code and nothing was happening, only the pre-existing message boxes worked. I'm not sure 'exactly' how I fixed it, but after clicking "Build Solution", "Rebuild Solution", "Clean Solution" and "Build (program name)" all under the 'Build' menu the problem went away. Unlike the previous problems I had not copied+pasted any code between solutions.
I've started running into an identical problem and I think it all started when I re-created the project under a new name.
That is, I had to copy everything.
Problem is I don't know what DIDN'T get fully copied and is now responsible for requiring a rebuild to get my code changes. Checked the solution and project files in a text editor and no signs of the old folder structure.

Eclipse CDT Generate method stubs from header file?

I'm wondering if there is a command or plugin for eclipse that will take a header file of mine and auto-generate all of the method stubs into the CPP file from that header? I've googled and the lack of results would say not so, yet I can see in the CDT preferences under templates that there is an option to enable stub generation... but cannot find the command to use it. Thanks!
Okay so, after doing some more searching I found the solution myself. In the header file, right click in white space and select "Implement Method" and a window will appear showing a list of method declarations within the header. You can select some or all, then click "Finish" and be done with it or "Next" to follow the rest of the guided wizard process.
Edit
I've noticed at times when using this that the formatting of the generated stubs can be screwed up, or can screw up the formatting of your existing CPP file. If that does happen, just right click within the CPP file white space, click "Source" and select "Format" to correct the issue.
Another Edit
For some reason after all this time, there's been a bunch of activity of people trying to edit my answer to change it completely. All the edit is trying to communicate is that there is apparently a CTRL+3 shortcut to bring up the implement methods window.
I got a little lost in the Eclipse CDT and could not find the Implement Method selection described above. So for clarity sake I am posting this.
In Eclipse CDT Mars (and maybe previous versions):
Right click on white-space inside the .h or header file. Initial menu appears...
Click on Source->Implement Method...
Popup window appears; check methods (stubs) to create in .cpp / implementation file.
.
You could also check out http://www.lazycplusplus.com/. It is more powerful than generating method-stubs. It generates header and source files. I managed to integrate it in Visual Studio, so it runs on every build. Maybe you can do that in Eclipse, too.
Edit:
On my blog http://itmuckel.de I wrote an article about integrating Lazy C++ in Eclipse. It works really good. Here is the direct downloadlink of the tutorial: http://itmuckel.de/wp-content/uploads/2016/04/lzz_integration.pdf
It is written in german, but the screenshots of Eclipse show the english version. Besides that Google Translate will do a good job, too.