Hello there, I've been wondering if something like typedef String^ string were possible. I've tried it, but it didn't work. Currently trying to put my current project in a windows forms application, win32api was a bit too complicated for now.
EDIT: with the stuff uncommented I get these errors:
1>c:\users\rianne\documents\visual studio 2010\cli blend\SYS.h(11): error C2061: syntax error : identifier 'string'
1>c:\users\rianne\documents\visual studio 2010\cli blend\stdafx.h(27): error C2143: syntax error : missing ';' before '^'
1>c:\users\rianne\documents\visual studio 2010\cli blend\stdafx.h(27): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\rianne\documents\visual studio 2010\cli blend\stdafx.h(27): error C2226: syntax error : unexpected type 'std::string'
@coder777
Yes you can use STL/unmanaged classes in CLI.
@Rii
If you want to use the name string for your typedef dont use the std namespace. Also void StringtoDouble(string &s, double &d); is probably an issue as String^ is a managed pointer(or reference, I forget) so you likely dont need the &. It also looks like you are including stdafx in stdafx?
Edit: Depending on where you put the typedef you may need to declare it as typedef System::String^ string;
@webJose: Thank you, I will do that next time ^^
@coder777: would it still be a bad idea to be usingnamespace std; in a central header of a c++ only project?
@naraku9333: using the std namespace while trying to define the CLI String^ as string was kinda dumb of me >_< could've thought of that ._."
I tried to typedef System::String^ string; sadly it still didn't work after removing usingnamespace std;, and also not after removing #include <string>
the #include "StdAfx.h" is different from the header "stdafx.h" somehow, it's a required include for every class(I don't know why, and I don't even see a file named like that in my project folder O_o), so I put it in there.
..And now after commenting out the include it somehow still compiles without error s: I have no idea why it was so persistent with including that file with the capital S and A.(I never had a file like that)
I guess this topic can be closed now, I'm gonna try something else in order to avoid merging these things into 1 project.