The type of namespace 'Logging' does not exist in the namespace 'Sitecore' - sitecore

Added Sitecore.Logging dll (from nuget) in the project but I still get the error.
It was working fine until I added a log4net dll (as part of some other nuget dependency). After this there was an ambiguous reference error. Then when I tried to specify Sitecore.Logging.LogManager/ Sitecore.Logging.ILog I get the error .
The type of namespace 'Logging' does not exist in the namespace 'Sitecore'

The Sitecore.Logging.dll does not contain classes in the Sitecore.Logging namespace, though you may be forgiven for expecting that to be the case - it is certainly the convention.
Opening it up with a decompiler reveals a forked version of log4net hiding in there.
You are probably looking for the log factory in Sitecore.Diagnostics.Log in the Sitecore.Kernel.dll

Right click the newly added log4net dll -> properties -> Aliases-> give a different name like 'log'. This will resolve the ambiguity in the code.

Related

no override found for 'vtkPolyDataMapper'

I'm trying to use vtk in my code, but I'm having problems running an example. I have almost no clue about the reasons since it's the first time I'm using it and I'm not very experienced.
I'm using visual studio 2012 and x64 platform.
Since I don't really know which libs should I use I added all of them to the "Additional Dependencies".
The example is given in this link.
The problem is that when I run it, the window shows this message
Generic Warning: In C:\location\VTK6.0.0\Rendering\Core\vtkPolyDataMapper.cxx, line 27
Error: no override found for 'vtkPolyDataMapper'.
which corresponds to this line
// Return NULL if no override is supplied.
vtkAbstractObjectFactoryNewMacro(vtkPolyDataMapper)
And the error that visual studio shows is
First-chance exception at 0x000007F7AA106C8F in Test.exe: 0xC0000005: Access violation reading location 0x0000000000000000.
Does anyone know how to solve this problem or at least what does this error mean?
I too was getting this error. The error means that the linker can't find the definition for the vtkPolyDataMapper method. One has to note which vtk rendering backend they used, during build. It will probably be either vtkRenderingOpenGL, or vtkRenderingOpenGL2. Go to your build/lib folder and search for either one of these. I have VS 2015 Community and had the vtkRenderingOpenGL2, with vtk-7.1 built on Windows 8.1, x86_64 Platform, Release configuration.
I fixed the issue by inserting the 3 following lines at the very top of my source files, before any other preprocessor directives:
#include "vtkAutoInit.h"
VTK_MODULE_INIT(vtkRenderingOpenGL2); // VTK was built with vtkRenderingOpenGL2
VTK_MODULE_INIT(vtkInteractionStyle);
This initializes the specified VTK modules. CMake includes these by default, but other compilers such as VS do not.
The last two lines can be combined into the following:
#define vtkRenderingCore_AUTOINIT 2(vtkRenderingOpenGL2, vtkInteractionStyle)
According to the VTK migration guide, if you are not using CMake to compile your code, you need to add some #defines. For VTK 6.0, these lines need to go before any other VTK #includes:
#define vtkRenderingCore_AUTOINIT 4(vtkInteractionStyle,vtkRenderingFreeType,vtkRenderingFreeTypeOpenGL,vtkRenderingOpenGL)
#define vtkRenderingVolume_AUTOINIT 1(vtkRenderingVolumeOpenGL)
You are missing include(${VTK_USE_FILE}) in your CMakeLists.txt file.
Assuming your are using OpenGL2, you should initialise the vtkRenderingOpenGL2 module, ensuring its object factory is correctly registered:
VTK_MODULE_INIT(vtkRenderingOpenGL2)
You should call this macro in the global scope (ex. main.cpp) as documented in the source code:
Initialize the named module, ensuring its object factory
is correctly registered and unregistered. This call must be made in
global scope in the translation unit of your executable (which can
include a shared library, but will not work as expected in a static
library).
#include "vtkAutoInit.h"
VTK_MODULE_INIT(vtkRenderingOpenGL);
The above snippet if included in the global scope will ensure the
object factories for vtkRenderingOpenGL are correctly registered and
unregistered.
How do you know which module to include?
The easiest method is to search in the VTK build folder for "vtkClassThatNeedsAnOverride", i.e. "vtkPolyDataMapper" in your case (note the use of quotes ".) and looking for a *ObjectFactory in your search results:
Rendering/OpenGL2/vtkRenderingOpenGL2ObjectFactory.cxx:
this->RegisterOverride("vtkPolyDataMapper",
"vtkOpenGLPolyDataMapper",
"Override for vtkRenderingOpenGL2 module", 1,
vtkObjectFactoryCreatevtkOpenGLPolyDataMapper);
It may be even more beneficial to look for RegisterOverride("vtkPolyDataMapper".
Which object factories exist?
To obtain a list of all existing modules that you could initialise, you can search for _AutoInit_Construct. *_AutoInit_Construct is the method that is called by VTK_MODULE_INIT.
As an alternative, you can look at all classes that derive from vtkObjectFactory.
A second alternative is to look for all calls to RegisterOverride.
Further information
VTK 6 Migration: Factories now require defines
Build System Migration: You do not need to call VTK_MODULE_INIT manually using cmake by calling include(${VTK_USE_FILE}) in your CMakeLists.txt
Note that I originally wrote this answer for a duplicate question, but I think the general information about solving this problem may be of interest for other people with the same error message.
I would recommend following the guide here, with the VTK_MODULE_INIT macro being the most reliable, with the guide here providing a high level overview of the changes needed. You must link to vtkRenderingOpenGL for example to get most of the standard overrides. If you use CMake then specifying it on the COMPONENTS argument to find_package would cause it to be added to VTK_LIBRARIES, and including VTK_USE_FILE would cause the correct compiler definitions to be added.
I had the same issue at my platform;
Visual Studio 2015
Windows 7
VTK 6.3
I followed VTK/Build System Migration from Marcus D. Hanwell's post, and it works. My additonal lines are;
#include <vtkAutoInit.h>
VTK_MODULE_INIT(vtkRenderingOpenGL);
VTK_MODULE_INIT(vtkInteractionStyle);
on the top of preprocessor. The difference from RestlessC0bra's post is probably OpenGL version.
When using ParaView's Catalyst libraries you have to add the following in addition to include("${PARAVIEW_USE_FILE}"):
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS ${VTK_DEFINITIONS})
A quick hack solution: In CMakeList.txt file, replace vtkRendering${VTK_RENDERING_BACKEND} with vtkRenderingOpenGL2. The reason why we need this is because Cmake does not know where the rendering core is. By specifying it, we can use the rendering core to override the proper method.
The proper solution should be replace the whole find_package paragraph with:
find_package(VTK REQUIRED COMPONENTS vtkCommonCore)
find_package(VTK COMPONENTS
vtkFiltersSources
vtkInteractionStyle
vtkRendering${VTK_RENDERING_BACKEND})
The first find_package lets the CMake know where to find the packages, then second find_package would know where to find vtkRendering${VTK_RENDERING_BACKEND}.

Clojure compilation

I have a problem with clojure compilation: when i used the "(compile app.clj)" function in the cmd.exe(executed in the main folder of clojure) on windows and in the terminal(in the home directory, clojure installed from ubuntu software center) in linux- clojure throw the classnotfoundexception and doesn't found the source when it was ready with the required settings. Please, somebody help me for setup the compilation. Thanks!
First of all, you are not using compile function properly.
Documentation clearly states that parameter must be a namespace symbol. I do not know namespace of app.clj, but it should look like my-project.app. Therefore correct call would be something like:
(compile 'my-project.app)
There might also be other problems (like not defining proper classpath), but they can be easily resolved using Leiningen. If you are not using it already, you definitely should.

Member declaration not found

I have worked on a C++ project using a regular text editor. Later, I imported all the files to Eclipse to make it debugging easier.
In Eclipse a weird thing happens. It complains "Member declaration not found" even if I have included the header file. The header file has the function definition.
How do I fix this problem?
"Member declaration not found" is an error produced by the Eclipse static analysis tool (codan). If you get this error, but the compilation succeeds this is a false positive. Older versions of this tool are known to give some false positives, see for example this bug report. So I recommend updating Eclipse CDT to the most recent version.
Another thing that may cause this error is an unresolved include that prevents Eclipse from parsing a portion of your code correctly. Selecting Index -> Search For Unresolved Includes in the context menu of the project will give you the list of unresolved includes. See this answer for the details of how to fix it.
Here's an example:
class C {
void f(std::vector<int>&);
};
void C::f(std::vector<int>&) {} // Member declaration not found
The above example causes "Member declaration not found" error in Eclipse CDT even if you have <vector> included but unresolved (due to misconfigured include paths).
I also experienced this problem several times in Eclipse though building is successful. We can simply solve this problem by rebuild the C/C++ index in project menu. :)
I got this problem in Eclipse, but building in terminal was successful. So I just rebuild the C/C++ index in Eclipse:
Right click on the project -> index -> rebuild.
I noticed that "Member declaration not found" will report also when you create a class with a name that is already used or is a a keyword.
I found an error in my .cpp file that creates this message. I had namespace std { in the front of the file, and I placed new functions that I was creating after the closing } for namespace. Moving the closing } to the end of the file so that the defined files were now in the namespace fixed the error message.
Example that creates the error.
#include "MyStrFuncs.h"
**namespace** std {
MyStrFuncs::MyStrFuncs() {
// TODO Auto-generated constructor stub
}
MyStrFuncs::~MyStrFuncs() {
// TODO Auto-generated destructor stub
}
} // This ends the **namespace**
//Additional functions will now generate the member declaration not found error...
int MyStrFuncs::str2i(string strIn) {
int results;
istringstream convert(strIn);
if( !(convert)>>results) results = 0;
return results;
}
// Fix by moving closing } for namespace to here. Good luck.
Even with the CDT 9.2.1 and Eclipse Neon 4.6.3 "Member declaration not found" problems are reported.
As answered by Srijeyanthan, the following should resolve it:
Project > C/C++ Index > Rebuild.
I also experienced this problem while splitting source and header files in eclipse.I resolved this by "implementing methods" eclipse instead of manual typing and building the project.By implementing methods "inline functions" will be added to source file.

using NtCreateSection from ntdll.lib

I was just trying to use NtCreateSection in my code and the information at this link states the requirement as ntdll.lib. As Im using VS2010, I went to Projects > Properties > Linker > Input > Additional Dependencies and added ntdll.lib.
However, on building the solution I get an error error C3861: 'NtCreateSection': identifier not found. I'm curious about why this happens.
A workaround I'm considering is getting a handle to ntdll using LoadLibrary and getting a handle to NtCreateSection using GetProcAddress; however Im just curious about why the earlier method did not work out.
Thanks!
Perhaps of interest is the actual documentation of the function: http://msdn.microsoft.com/en-us/library/windows/hardware/ff556473(v=vs.85).aspx
This points you to a ZwCreateSection function, which notes that NtCreateSection is the name to be used for user-mode calls to this function: http://msdn.microsoft.com/en-us/library/windows/hardware/ff566428(vr85).aspx
In the standard header/library reference in the actual documentation, it says Wdm.h is the header to be included. I would recommend checking that file for the function(s), and proceeding from there. The docs for both functions, and the guide pages linked from them, also seem to have some info on things.

The procedure entry point could not be located in the dynamic link library Core.dll

I am converting my project to use DLLs and am trying to break apart my Singleton class to avoid using templates.
My class, LudoMemory, originally inherited from Singleton. I am trying to give it the functions to destroy and create itself now and have my main engine not rely on the Singleton.
I have written a simple destroy method like such:
LudoMemory *memory_Singleton = NULL;
void LudoMemory::Destroy()
{
LUDO_SAFE_DELETE(m_Singleton)
}
and upon running the program (no compiler errors) I recieve this error:
The procedure entry point
?Destroy#LudoMemory##SAXXZ could not
be located in the dynamic link library
LudoCore.dll
LudoCore is the project that LudoMemory belongs to. Why is this happening? How can I solve it?
you don't have multiple versions of ludocore.dll on your system, do you?
Procedure entry points errors usually mean: you compiled your project against ludocore.lib version x, and when running the program, it uses ludocore.dll version y, and version y does not define LudoMemory::Destroy().
Jacob's answer about multiple DLL versions seems likely.
Also, with some build systems, you must explicitly list which functions will be exported in a DLL.
Research your build environment, and see if you must provide a list of methods to be exported as an entry-point.
In Visual Studio build environment, also you could try by disabling the References in Linker Optimization Settings [ No(/OPT:NOREF)]