I'm trying to utilize Cryptopp AES Library on C++ Form App. by using the Visual Studio 2015 with Update 2.
The thing is that I have to use "No common Runtime Support". However when I do this, It gives me some errors, like:
Severity Code Description Project File Line Suppression State
Error C2653 'Application': is not a class or namespace name SON c:\Users\Win\documents\visual studio 2015\Projects\SON\SON\MyForm.cpp 18
Severity Code Description Project File Line Suppression State
Error C2871 'Data': a namespace with this name does not exist SON c:\users\win\documents\visual studio 2015\projects\son\son\MyForm.h 9
Severity Code Description Project File Line Suppression State
Error C2871 'Drawing': a namespace with this name does not exist SON c:\users\win\documents\visual studio 2015\projects\son\son\MyForm.h 10
Severity Code Description Project File Line Suppression State
Error C3861 'EnableVisualStyles': identifier not found SON c:\Users\Win\documents\visual studio 2015\Projects\SON\SON\MyForm.cpp 18
But, when I build the code with Common Language Runtime Support, it doesn't give any error, but this time I couldn't create a UI for Form App.
Here are my CPP code, I didn't make any changes on it
#include "MyForm.h"
#include <iostream>
#include <string>
using namespace System;
using namespace System::Windows::Forms;
#include "C:\Users\Win\Desktop\cryptopp562\osrng.h"
using CryptoPP::AutoSeededRandomPool;
[STAThread]
void Main(array<std::string^>^ args)
{
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
MyForm form;
Application::Run(%form);
}
Thanks in advance.
You need to change MyForm form to [Application name]::MyForm form
Related
I have a solution with two projects: a WPF sample application called "WPFSample" and a class library project called "ReferencedAssembly". "WPFSample" references "ReferencedAssembly".
The project "ReferencedAssembly" contains a couple of classes. Every class has its own namespace, i.e. "MyClassLibrary" or "MyClassLibrary.MyOtherTypes". A sample class with the namespace "MyClassLibrary" is called "Movie".
Now I want to map the .NET namespace to the XAML namespace using the URL "http://schemas.emmbee.de/". For this purpose I added the following lines to AssemblyInfo.vb in the "WPFSample" project and build it afterwards:
Imports System.Windows.Markup
<Assembly: XmlnsPrefix("http://schemas.emmbee.de/", "ra")>
<Assembly: XmlnsDefinition("http://schemas.emmbee.de/", "ReferencedAssembly.MyClassLibrary")>
<Assembly: XmlnsDefinition("http://schemas.emmbee.de/", "ReferencedAssembly.MyClassLibrary.MyOtherTypes")>
In XAML I add the namespace definition like this:
<xmlns:ra="http://schemas.emmbee.de">
If I want to use the "Movie" class with
<ra:Movie/>
I receive the error, that the class "Movie" doesn't exists in namespace "http://schemas.emmbee.de".
If I instead add a namespace definition in this way:
<xmlns:ra="clr-namespace:ReferencedAssembly.MyClassLibrary;assembly=ReferencedAssembly">
all works fine.
What is wrong with the XmlnsDefinition?
I found it out.The Namespace mappings
Imports System.Windows.Markup
<Assembly: XmlnsPrefix("http://schemas.emmbee.de/", "ra")>
<Assembly: XmlnsDefinition("http://schemas.emmbee.de/", "ReferencedAssembly.MyClassLibrary")>
<Assembly: XmlnsDefinition("http://schemas.emmbee.de/", "ReferencedAssembly.MyClassLibrary.MyOtherTypes")>
must be included in the "AssemblyInfo.vb" in the assembly "ReferencedAssembly", not in the assembly "WPFSample".
I want to learn Angular so I started with there tutorial here, its really basic but that does not stop me from get ALOT of exception.
I installed latest and stable of every compinent Git, Node and python but when running
npm install
I got some exceptions, I then reinstalled components to a older specific version(no backward compability here). This got my a couple of steps but yet again other exceptions was thrown like this :
C:\Program Files
(x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.t
argets(44,5): error MSB8020: The builds tools for v120 (Platform
Toolset = 'v12 0') cannot be found. To build using the v120 build
tools, either click the Proj ect menu or right-click the solution, and
then select "Update VC++ Projects..."
Why would it need MSBuild? Anyway, I changed the config like this
npm config set msvs_version 2012
And now I get even more exceptions!?, like these :
C:\Users\bob\angular-phonecat\node_modules\karma\node_modules\socket.io\node_modules\socket.io-client\node_modules\ws>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
bufferutil.cc
C:\Users\bob\.node-gyp\4.2.3\include\node\v8.h(336): error C2988: unrecognizable template declaration/definition [C:\Users\bob\angular-phonecat\node_modules\karma\node_modules\socket.io\node_modules\socket.io-client\node_modules\ws\build\bufferutil.vcxproj]
C:\Users\bob\.node-gyp\4.2.3\include\node\v8.h(336): error C2059: syntax error : 'using' [C:\Users\bob\angular-phonecat\node_modules\karma\node_modules\socket.io\node_modules\socket.io-client\node_modules\ws\build\bufferutil.vcxproj]
C:\Users\bob\.node-gyp\4.2.3\include\node\v8.h(469): error C2988: unrecognizable template declaration/definition [C:\Users\bob\angular-phonecat\node_modules\karma\node_modules\socket.io\node_modules\socket.io-client\node_modules\ws\build\bufferutil.vcxproj]
C:\Users\bob\.node-gyp\4.2.3\include\node\v8.h(469): error C2059: syntax error : 'using' [C:\Users\bob\angular-phonecat\node_modules\karma\node_modules\socket.io\node_modules\socket.io-client\node_modules\ws\build\bufferutil.vcxproj]
C:\Users\bob\.node-gyp\4.2.3\include\node\v8.h(576): error C2061: syntax error : identifier 'WeakCallbackType' [C:\Users\bob\angular-phonecat\node_modules\karma\node_modules\socket.io\node_modules\socket.io-client\node_modules\ws\build\bufferutil.vcxproj]
C:\Users\bob\.node-gyp\4.2.3\include\node\v8.h(642) : see reference to class template instantiation 'v8::PersistentBase<T>' being compiled
C:\Users\bob\.node-gyp\4.2.3\include\node\v8.h(637): error C2253: 'PersistentBase<T>' : pure specifier or abstract override specifier only allowed on virtual function [C:\Users\bob\angular-phonecat\node_modules\karma\node_modules\socket.io\node_modules\socket.io-client\node_modules\ws\build\bufferutil.vcxproj]
C:\Users\bob\.node-gyp\4.2.3\include\node\v8.h(844): error C2253: 'Global<T>' : pure specifier or abstract override specifier only allowed on virtual function [C:\Users\bob\angular-phonecat\node_modules\karma\node_modules\socket.io\node_modules\socket.io-client\node_modules\ws\build\bufferutil.vcxproj]
C:\Users\bob\.node-gyp\4.2.3\include\node\v8.h(847) : see reference to class template instantiation 'v8::Global<T>' being compiled
C:\Users\bob\.node-gyp\4.2.3\include\node\v8.h(852): error C2988: unrecognizable template declaration/definition [C:\Users\bob\angular-phonecat\node_modules\karma\node_modules\socket.io\node_modules\socket.io-client\node_modules\ws\build\bufferutil.vcxproj]
C:\Users\bob\.node-gyp\4.2.3\include\node\v8.h(852): error C2059: syntax error : 'using' [C:\Users\bob\angular-phonecat\node_modules\karma\node_modules\socket.io\node_modules\socket.io-client\node_modules\ws\build\bufferutil.vcxproj]
C:\Users\bob\.node-gyp\4.2.3\include\node\v8.h(915): error C2989: 'v8::HandleScope' : class template has already been declared as a non-class template [C:\Users\bob\angular-phonecat\node_modules\karma\node_modules\socket.io\node_modules\socket.io-client\node_modules\ws\build\bufferutil.vcxproj]
C:\Users\bob\.node-gyp\4.2.3\include\node\v8.h(319) : see declaration of 'v8::HandleScope'
C:\Users\bob\.node-gyp\4.2.3\include\node\v8.h(949): error C2989: 'v8::EscapableHandleScope' : class template has already been declared as a non-class template [C:\Users\bob\angular-phonecat\node_modules\karma\node_modules\socket.io\node_modules\socket.io-client\node_modules\ws\build\bufferutil.vcxproj]
C:\Users\bob\.node-gyp\4.2.3\include\node\v8.h(135) : see declaration of 'v8::EscapableHandleScope'
C:\Users\bob\.node-gyp\4.2.3\include\node\v8.h(979): error C2989: 'v8::Data' : class template has already been declared as a non-class template [C:\Users\bob\angular-phonecat\node_modules\karma\node_modules\socket.io\node_modules\socket.io-client\node_modules\ws\build\bufferutil.vcxproj]
C:\Users\bob\.node-gyp\4.2.3\include\node\v8.h(74) : see declaration of 'v8::Data'
C:\Users\bob\.node-gyp\4.2.3\include\node\v8.h(1118): error C2989: 'v8::Script' : class template has already been declared as a non-class template [C:\Users\bob\angular-phonecat\node_modules\karma\node_modules\socket.io\node_modules\socket.io-client\node_modules\ws\build\bufferutil.vcxproj]
C:\Users\bob\.node-gyp\4.2.3\include\node\v8.h(96) : see declaration of 'v8::Script'
C:\Users\bob\.node-gyp\4.2.3\include\node\v8.h(1559): error C2989: 'v8::StackTrace' : class template has already been declared as a non-class template [C:\Users\bob\angular-phonecat\node_modules\karma\node_modules\socket.io\node_modules\socket.io-client\node_modules\ws\build\bufferutil.vcxproj]
C:\Users\bob\.node-gyp\4.2.3\include\node\v8.h(101) : see declaration of 'v8::StackTrace'
C:\Users\bob\.node-gyp\4.2.3\include\node\v8.h(1622): error C2989: 'v8::StackFrame' : class template has already been declared as a non-class template [C:\Users\bob\angular-phonecat\node_modules\karma\node_modules\socket.io\node_modules\socket.io-client\node_modules\ws\build\bufferutil.vcxproj]
C:\Users\bob\.node-gyp\4.2.3\include\node\v8.h(100) : see declaration of 'v8::StackFrame'
C:\Users\bob\.node-gyp\4.2.3\include\node\v8.h(2031): error C2989: 'v8::Value' : class template has already been declared as a non-class template [C:\Users\bob\angular-phonecat\node_modules\karma\node_modules\socket.io\node_modules\socket.io-client\node_modules\ws\build\bufferutil.vcxproj]
C:\Users\bob\.node-gyp\4.2.3\include\node\v8.h(108) : see declaration of 'v8::Value'
Is it really supose to be this hard to install Angular on a Windows 8.1 computer? Or are my environment faulted in any way?
How do I solve this problem? Have search alot but no help.
I've installed Node/NPM/Angular on 4 differents machines of mine. This is what I've done to make it all work:
Visual C++ 2005
Visual C++ 2008
Visual c++ 2010
Python 2.7
I don't know why, I've just followed the console erros and all worked.
Yes, it is hard. The reason for this is that (dependend on the node modules you install) node-gyp rebuilds things to make them run on the platform, in your case Windows 8.
There are lots and lots of questions how to solve these kind of errors. Prepare yourself to install Python and Visual Studio like explained here.
Good luck! Working with node.js on Linux or OSX is much easier....
I have namespace "Client" with form MainWindow and form MyForm
MainWindow creates MyForm.
MainWindow.h
#pragma once
namespace Client {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
public ref class MainWindow : public System::Windows::Forms::Form
{
public:
MainWindow(void)
{
InitializeComponent();
}
....
....
....
}
in MyForm.h i write this:
#pragma once
namespace Client {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
public ref class MyForm : public System::Windows::Forms::Form
{
private:
MainWindow ^f; //this is my problem
public:
MyForm(void)
{
InitializeComponent();
}
......
......
......
}
After compile, i have this error in line MainWindow ^f;:
1>c:\users\user\desktop\testlist\client\MyForm.h(17): error C2143: syntax error : missing ';' before '^'
1>c:\users\user\desktop\testlist\client\MyForm.h(17): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1> MyForm.cpp
If i write this Client::MainWindow ^f;:
1>c:\users\user\desktop\testlist\client\MyForm.h(17): error C2039: 'MainWindow' : is not a member of 'Client'
1>c:\users\user\desktop\testlist\client\MyForm.h(17): error C2143: syntax error : missing ';' before '^'
1>c:\users\user\desktop\testlist\client\MyForm.h(17): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1> MainWindow.cpp
1 errror - The form is a member of Client, why?
if add #include "MainWindow.h", errors are on MainWindow ^f;:
1>c:\users\user\desktop\testlist\client\MyForm.h(19): error C2143: syntax error : missing ';' before '^'
1>c:\users\user\desktop\testlist\client\MyForm.h(19): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1> MainWindow.cpp
How can i fix this problem?
______________________________Update for ArnonZilca
Myform - its a ref class, so i use ref struct and instead of mreoer myvar; i write mreoer ^myvar;
Errors in mreoer ^myvar; :
1>c:\users\user\desktop\testlist\client\MyForm.h(20): error C2143: syntax error : missing ';' before '^'
1>c:\users\user\desktop\testlist\client\MyForm.h(20): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\user\desktop\client\client\MyForm.h(155): error C2227: left of '->Print' must point to class/struct/union/generic type
1> MainWindow.cpp
_________________________________UPDATE
So in Myform.h i write this:
#pragma once
namespace Client {
ref class MainWindow;
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
public ref class MyForm : public System::Windows::Forms::Form
{
private:
MainWindow ^f; //this is my problem
public:
MyForm(void)
{
InitializeComponent();
}
......
......
......
}
and if i use this variable (^f) in MyForm.h i have this errors on line where i using it:
\users\user\desktop\client\client\MyForm.h(155): error C2027: use of undefined type 'Client::MainWindow'
1> c:\users\user\desktop\client\client\MyForm.h(8) : see declaration of 'Client::MainWindow'
MainWindow have public method void Print () { cout << "HEY" << endl; }
In MyForm.h i do this: f->Print();
This tends to be a bit rough on programmers that are used to more recent languages. But this is normal kind of problem to have, C++/CLI inherits the compilation model of the C++ language. It is a single-pass compiler, all definitions must be known before you can use them. A model that dates from the previous century, back when 64KB of RAM fit in shoebox and cost an arm and three legs.
Technically it isn't quite that bad, C++ is more like a 1.5 pass compiler. You can refer ahead to class members inside inline function definitions. Which doesn't exactly help to diagnose this kind of problem :)
But you must do the C++ dance here, your MyForm.h file can contain a forward declaration, ref class MainWindow; gets that done. But any code that dereferences members of f must only appear in MyForm.cpp file. That .cpp file can #include both MyForm.h and MainWindow.h so all type definitions are available. And yes, that does mean that you may well have to move methods that were added by the designer from the .h file to the .cpp file. Do not panic, it's normal.
It seems you forgot to include the header where Client::MainWindow is defined
I downloaded a code a link after i run it from VS2010 the error show up
Warning 3 The tag 'RemoteDesktopWpf' does not exist in XML namespace 'clr-namespace:VncSharpWpf;assembly=VncSharpWpf'. Line 44 Position 14. C:\VNCSHARPWPF\VncSharpWpf-0.0.2_2\VncSharpWpf_Example\MainWindow.xaml 44 14 VncSharpWpf_Example
Warning 2 Importing key file "VncSharpWpf.pfx" was canceled. VncSharpWpf
Warning 1 Cannot import the following key file: VncSharpWpf.pfx. The key file may be password protected. To correct this, try to import the certificate again or manually install the certificate to the Strong Name CSP with the following key container name: VS_KEY_1F91AEA45AB30623 VncSharpWpf
Delete VncSharpWpf.pfx from project VncSharpWpf, and you can build the project.
I'm using VS2010. Silverlight 4, NUnit 2.5.5, and TypeMock
TypemockIsolatorSetup6.0.3.619.msi
In the test project MVVM is implemented, PeopleViewModel is a ViewModel which I want to test.
Please advise if you use other products for unit testing of MVVM Silverlight. Or please help to win this TypeMock. TIA
This is the code of the test:
[Test]
[SilverlightUnitTest]
public void SomeTestAgainstSilverlight()
{
PeopleViewModel o = new PeopleViewModel();
var res = o.People;
Assert.AreEqual(15, res.Count());
}
While running the test in ReSharper i get the following error:
TestA.SomeTestAgainstSilverlight : Failed******************************************
*Loading Silverlight Isolation Aspects...*
******************************************
TEST RESULTS:
---------------------------------------------
System.MissingMethodException : Method not found: 'hv TypeMock.ArrangeActAssert.Isolate.a(System.Delegate)'.
at a4.a(ref Delegate A_0)
at a4.a(Boolean A_0)
at il.b()
at CThru.Silverlight.SilverlightUnitTestAttribute.Init()
at CThru.Silverlight.SilverlightUnitTestAttribute.Execute()
at TypeMock.MockManager.a(String A_0, String A_1, Object A_2, Object A_3, Boolean A_4, Object[] A_5)
at TypeMock.InternalMockManager.getReturn(Object that, String typeName, String methodName, Object methodParameters, Boolean isInjected)
at Tests.TestA.SomeTestAgainstSilverlight() in TestA.cs: line 21
While running test in NUnit i get:
Tests.TestA.SomeTestAgainstSilverlight:
System.DllNotFoundException : Unable to load DLL 'agcore': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at MS.Internal.XcpImports.Application_GetCurrentNative(IntPtr context, IntPtr& obj)
at MS.Internal.XcpImports.Application_GetCurrent(IntPtr& pApp)
at System.Windows.Application.get_Current()
at ViewModelExample.ViewModel.ViewModelBase.get_IsDesignTime() in C:\Documents and Settings\USER\Desktop\ViewModelExample\ViewModelExample\ViewModel\ViewModelBase.cs:line 20
at ViewModelExample.ViewModel.PeopleViewModel..ctor(IServiceAgent serviceAgent) in C:\Documents and Settings\USER\Desktop\ViewModelExample\ViewModelExample\ViewModel\PeopleViewModel.cs:line 28
at ViewModelExample.ViewModel.PeopleViewModel..ctor() in C:\Documents and Settings\USER\Desktop\ViewModelExample\ViewModelExample\ViewModel\PeopleViewModel.cs:line 24
at Tests.TestA.SomeTestAgainstSilverlight() in C:\Documents and Settings\USER\Desktop\ViewModelExample\Tests\TestA.cs:line 22
UPDATE: I'm not following the question. I've switched to other tools.
This message looks like a mismatched files issue. Try creating a new test project from scratch.
Start by adding references to Typemock.dll and Typemock.ArrangeActAssert.dll. From the CThru directory add both CThru.dll and CThru.Silverlight.dll.
Add a reference to System.Windows (located at C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\System.Windows.dll).
Try creating a new test method, and decorate it with SilverlightUnitTest attribute:
using NUnit.Framework;
using CThru.Silverlight;
[TestFixture]
public class SilverlightTest
{
[Test, SilverlightUnitTest]
public void EmptyTest()
{
}
}
Run this empty test. If you're still having the problem you described, please contact support at typemock.com for further assistance.