I have a custom control to which I am trying to add a property which can be set in the Object Inspector. According to this documentation, I need to place the property under the __published section of my header file.
__published:
__property bool ShowErrorIcon = { read=FShowErrorIcon,write=FShowErrorIcon };
I set up the property to read and write to the private bool FShowErrorIcon
private:
bool FShowErrorIcon;
However, when I launch the form that contains one of these controls I get the following error:
"Error reading RgnSearchBar.ShowErrorIcon: Property ShowErrorIcon does not exist."
This is confusing me, because the property is clearly visible in the ObjectInspector when the control is selected. What step am I missing here?
You have an older version of the component binaries on your HDD. The version of the component that is loaded in the IDE is newer then the version that is getting linked into your executable. Somewhere, an older version is on the search path before the newer version, so the compiler/linker is linking the old version. You need to find and remove that older version.
Related
I'm trying to add a 3d model to the resources of an Appx in a cmake build. I have it successfully working with most formats, but files ending in .obj are being treated as compiled object files.
The cmake Visual Studio generator seems to always treat any file with an extension .obj as an object file and adds it to the vcxproj with the tag.
Is there a way to change the internal type of a file that cmake is using? Can I specify that this file is NOT an "EXTERNAL_OBJECT"?
Setting the VS_DEPLOYMENT_CONTENT to 1 doesn't help.
Adding it to the RESOURCES property doesn't help.
It looks like it might be an issue in the cmake source code itself where it checks if a file type if EXTERNAL_OBJECT before checking any other flags or types, and I can't figure out how to unset that type.
As per this issue on the cmake gitlab repo https://gitlab.kitware.com/cmake/cmake/issues/18820, there is a hacky fix solution but no "correct" fix yet.
Brad King:
As a very hacky not very futureproof workaround that abuses current implementation details, try:
get_property(loc SOURCE myfile.obj PROPERTY LOCATION)
set_property(SOURCE myfile.obj PROPERTY EXTERNAL_OBJECT 0)
The first line forces this code and therefore this code to run, causing CMake to initialize the EXTERNAL_OBJECT property earlier than it normally would. Once that is done then we can set the property back to 0.
A possible fix would be to teach the latter code (in CheckExtension) to not set the EXTERNAL_OBJECT property if it is already set. We can't change the default behavior of treating .obj files as objects to link, but we can at least make an explicit property setting work without the above hack.
I have confirmed that this works for the .obj files in our solution.
I'm compiling Linux libraries (for Android, using NDK's g++, but I bet my question makes sense for any Linux system). When delivering those libraries to partners, I need to mark them with a version number. I must also be able to access the version number programatically (to show it in an "About" dialog or a GetVersion function for instance).
I first compile the libraries with an unversioned flag (version 0.0) and need to change this version to a real one when I'm done testing just before sending it to the partner. I know it would be easier to modify the source and recompile, but we don't want to do that (because we should then test everything again if we recompile the code, we feel like it would be less error prone, see comments to this post and finally because our development environment works this way: we do this process for Windows binaries: we set a 0.0 resources version string (.rc) and we later change it by using verpatch...we'd like to work with the same kind of process when shipping Linux binaries).
What would be the best strategy here?
To summarize, requirements are:
Compile binaries with "unset" version (0.0 or anything else)
Be able to modify this "unset" version to a specific one without having to recompile the binary (ideally, run a 3rd party tool command, as we do with verpatch under Windows)
Be able to have the library code retrieve it's version information at runtime
If your answer is "rename the .so", then please provide a solution for 3.: how to retrieve version name (i.e.: file name) at runtime.
I was thinking of some solutions but have no idea if they could work and how to achieve them.
Have a version variable (one string or 3 int) in the code and have a way to change it in the binary file later? Using a binary sed...?
Have a version variable within a resource and have a way to change it in the binary file later? (as we do for win32/win64)
Use a field of the .so (like SONAME) dedicated to this and have a tool allowing to change it...and make it accessible from C++ code.
Rename the lib + change SONAME (did not find how this can be achieved)...and find a way to retrieve it from C++ code.
...
Note that we use QtCreator to compile the Android .so files, but they may not rely on Qt. So using Qt resources is not an ideal solution.
I am afraid you started to solve your problem from the end. First of all SONAME is provided at link time as a parameter of linker, so in the beginning you need to find a way to get version from source and pass to the linker. One of the possible solutions - use ident utility and supply a version string in your binary, for example:
const char version[] = "$Revision:1.2$"
this string should appear in binary and ident utility will detect it. Or you can parse source file directly with grep or something alike instead. If there is possibility of conflicts put additional marker, that you can use later to detect this string, for example:
const char version[] = "VERSION_1.2_VERSION"
So you detect version number either from source file or from .o file and just pass it to linker. This should work.
As for debug version to have version 0.0 it is easy - just avoid detection when you build debug and just use 0.0 as version unconditionally.
For 3rd party build system I would recommend to use cmake, but this is just my personal preference. Solution can be easily implemented in standard Makefile as well. I am not sure about qmake though.
Discussion with Slava made me realize that any const char* was actually visible in the binary file and could then be easily patched to anything else.
So here is a nice way to fix my own problem:
Create a library with:
a definition of const char version[] = "VERSIONSTRING:00000.00000.00000.00000"; (we need it long enough as we can later safely modify the binary file content but not extend it...)
a GetVersion function that would clean the version variable above (remove VERSIONSTRING: and useless 0). It would return:
0.0 if version is VERSIONSTRING:00000.00000.00000.00000
2.3 if version is VERSIONSTRING:00002.00003.00000.00000
2.3.40 if version is VERSIONSTRING:00002.00003.00040.00000
...
Compile the library, let's name it mylib.so
Load it from a program, ask its version (call GetVersion), it returns 0.0, no surprise
Create a little program (did it in C++, but could be done in Python or any other languauge) that will:
load a whole binary file content in memory (using std::fstream with std::ios_base::binary)
find VERSIONSTRING:00000.00000.00000.00000 in it
confirms it appears once only (to be sure we don't modify something we did not mean to, that's why I prefix the string with VERSIONSTRING, to make it more unic...)
patch it to VERSIONSTRING:00002.00003.00040.00000 if expected binary number is 2.3.40
save the binary file back from patched content
Patch mylib.so using the above tool (requesting version 2.3 for instance)
Run the same program as step 3., it now reports 2.3!
No recompilation nor linking, you patched the binary version!
I have a VS Package project from which I need to access Roslyn or Microsoft.CodeAnalysis' Workspace OR Solution object from the loaded IVsSolution.
I need to know how I could achieve that ?
I found this stackoverflow discussion here which suggests to use PrimaryWorkspace static property of Workspace class which I can't find in Microsoft.CodeAnalysis.Workspace
EDIT:
I found out that Microsoft.CodeAnalysis does not have this yet but I downloaded the older release of Roslyn from Nuget.org which has this. But now PrimaryWorkspace Property is giving me NULL :( I am using Isolated Shell.
The VisualStudioWorkspace is exported through MEF. If you are already using MEF in you package, you can just [Import] it.
If not, you can QueryService() for the SComponentModel service and then get the VisualStudioWorkspace from that.
Within the Initialize() function of your VSPackage, you can use the following:
var componentModel = (IComponentModel)Microsoft.VisualStudio.Shell.Package.GetGlobalService(typeof(SComponentModel));
var workspace = componentModel.GetService<Microsoft.VisualStudio.LanguageServices.VisualStudioWorkspace>();
I believe you'll also need to add an additional reference to: Microsoft.VisualStudio.LanguageServices.dll
As noted by #Vizu, you can now add this via NuGet:
Install-Package Microsoft.VisualStudio.LanguageServices
if a file is checked out in ClearCase; it would use the earlier version and still would build, is this correct? I'm thinking they had a checkout that was to fix a build issue and the build failed because of the checkout
as far as I know, clearcase using the current file, so if file is checked out in a view and you build this view it will take the checked out file
However, note that if you do uncheckout and you are not using cmake, it might miss this change, since the timestamp of the file after the uncheckout operation is older
The config spec of a view usually starts with:
element * CHECKEDOUT
That means that, yes, your view will select the current file, whatever the other selection rules are.
I recommend checking for files in checkout, but also hijacked files (modified locally without having been checked out, for snapshot view, or even eclipsed files for dynamic views) before starting a build.
Check also for any other "private" files (not initially present and selected in the view), because they also can influence a build by their presence.
If you have two separate projects that is somehow connected. How can one make a reference to the source of the other project?
For referencing the source of your own project you use:
source:some/file
But since I want to refer to code in another project my thought was that I could write something like:
other_project:source:some/file
Anyone that knows if this is possible in some way? I have read http://www.redmine.org/wiki/redmine/RedmineTextFormatting#Redmine-links but found no clues there.
Apparently this was implemented in Redmine 1.2.0 (released 2011-05-30). The syntax is exactly the one you suggested in the question, other_project:source:some/file, other_project being the project identifier.
It is possible in a couple of ways - although neither solution is particularly neat.
use an external html link to the other_project source code, where other-proj is the identifier for the other project.
"other project source":http://myserver:3000/projects/other-proj/repository/entry/file.txt
define the source path via the parent directories, so from the source directory of your current project go up 3 directory levels before navigating back down to the repository of your other project. Note the source link needs to be inside double quotes to work. This method at least keeps the source tag at the front of the link.
source:"../../../other-proj/repository/entry/file.txt"
The Redmine Text Formatting page says the format is:
source:repo_identifier|some/file
Even so, the selected answer works for my version of Redmine (1.4.2), but it may have been changed in later versions. This link format was added to that wiki page on 2012-08-27, after OP asked their question.