|
Well, if you're using C++/CLI, you can do String ^ = "hello world". Your overall question makes me think that you're pretty lost, and probably taking on a project that's too hard for your skill level. So, you may also be confused about what this forum is for. It's for .NET C++, not C++ in general. The visual C++ forum is for that.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
|
Sushant,
We are here to help you solve a specific programming program not to help you write the whole application or, worst yet, write the whole application. If you need some ideas, please search the web with Google with the key words such as "8-puzzle game programming AI".
Geo
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
You should do your own homework.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
hello
I looking for a script that can index a folder.
I'm working with borland C++ 6.0.
Great,
Marc
1 day, 24 hours, 1440 minutes, 86400 seconden and then start the next day.
|
|
|
|
|
marc1990 wrote: I'm working with borland C++ 6.0.
So, you posted your question on a Visual Studio site, on a Managed C++ message board...
Great,
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I'm sorry.
Could you recommend a other forum??
Great,
Marc
|
|
|
|
|
No problem.
I haven't used Borland in many years but I would start here[^].
I'm not sure what kind of script you're looking for but if you look at the list of message boards
at the top of this page you may find a more appropriate board to post the question on.
Good luck!
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
hi!
can someone give me a sample code on how to pass 2 different structs to a function with lpvoid as parameter and how to convert back to the structs from lpvoid.
the structs should be received by the lpvoid... how to combine the 2 different structs together? and how to split the lpvoid back to the 2 structs?
the structs are something like
typedef struct
{ int dataStructCount;
DWORD totalSize;
} strHeader;
typedef struct
{ int num;
lptstr str;
} dataStruct;
this will be used for writing and reading data from named pipe.. the header will be used to determine the count of dataStruct send/read.
thanks for any help!
newbie
|
|
|
|
|
Newbie,
First of all, you are in the wrong forum! This is the C++/CLI or Managed C++ forum. C++/CLI uses the .NET Framework and depends on Garbage Collection (GC) for memory management. It appears you are writing C or possibly C++ code. You should get better assistance int the Visual C++/MFC forum.
However, LPVOID is really a typedef of void* . Thus, LPVOID is a pointer to any type. Unfortunately, once a pointer of a type, in your case strHeader and dataStruct , is casted to a void pointer, LPVOID , its type information is lost. Thus, if you have a function that accepts void pointers, the compiler will not help you with type checking.
void Foo(LPVOID header, LPVOID data)
{
strHeader* theHeader = (strHeader*) header;
dataStruct* theData = (dataStruct*) data;
}
int main()
{
strHeader header;
dataStruct data;
Foo(&strHeader, &dataStruct);
return 0;
}
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
oooopppss! sorry! i did not notice the message board... i thought i was posting in vc++/mfc forum...
i have reposted the qxn there...
thanks for your reply!
however, for the foo function... i only have 1 LPVOID paramter...
thus the strHeader and dataStruct should be combined together and passed as 1 data to function Foo....
newbie
|
|
|
|
|
Hi
I'd like to be able to take a set of bitmaps and write them to an avi file without having to use vfw or anything platform specific since it has to be cross-platform
i don't need audio or anything else - just a sequence of images - any ideas?
|
|
|
|
|
|
hi
thanks for the reply but that article show's how to load an avi file as a resource - what i need to do is save a sequence of images as an avi file without using vfw.
|
|
|
|
|
If cross-platform is your goal, then using C++/CLI that depends on the .NET Framework would be a bad idea. You are in the wrong forum.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
I'm trying to understand how I can create a DLL that contains a wrapper (managed code), to use a C++ (unmanaged) class using C# or VB.NET.
I found some articles (es http://www.codeproject.com/useritems/WrappingUsingManagedCpp.asp[^])that suggest this way:
(SimpleClass is my C++ class)
namespace Managed{<br />
public __gc class WrappClass<br />
{<br />
private:<br />
SimpleClass* pClass;<br />
public:<br />
WrappClass(){ pClass=new SimpleClass()}<br />
~WrappClass(){ delete pClass; }<br />
int Foo();<br />
};<br />
}<br />
It will be well compiled...but the linker tells that operators 'new' and 'delete' are unknown (error LNK2020)....
What is wrong??? I wrote only 20 code lines!!
Is there some settings in Visual Studio to solve this problem?
Have you got some link to a simple project like mine ... that is working?
Thanks
Cheers,
Russell
|
|
|
|
|
Looks like you are using VC++ 2005. If you want to use the old syntax, you need to specify /clr:oldsyntax in the compiler settings.
But I'd recommend that you use the new syntax instead.
Regards,
Nish
Fly on your way like an eagle
Fly as high as the sun
On your wings like an eagle
Fly and touch the sun
|
|
|
|
|
mmm...no, I'm using VS2003 (recently updated from internet with some patches).
i tryed to use /clr:oldsyntax....but it doesn't know this option (the option /clr it is just included into che command line).
I also tryed to use gcnew (instead new) but it is an unknown command.
it is driving me crazy
thanks
Cheers,
Russell
|
|
|
|
|
Ok, VC 2003 only has the old syntax (you don't need to use /clr:oldsyntax and it's not even an option anyway). You cannot use keywords like gcnew with it because those are all C++/CLI syntax added in VC++ 2005.
You should look for articles/books focusing on the old syntax (usually called MC++ or Managed C++).
Regards,
Nish
Fly on your way like an eagle
Fly as high as the sun
On your wings like an eagle
Fly and touch the sun
|
|
|
|
|
Many thanks
Sorry to disturb you again, but the problem looks bigger:
I create a new very simple project: a class library in VC NET, it is the only one file that I edited...
<br />
<br />
#pragma once<br />
<br />
using namespace System;<br />
<br />
namespace LibreriaDiClassiCppNET<br />
{<br />
public __gc class Class1<br />
{<br />
Class1(){<br />
}<br />
~Class1(){<br />
}<br />
void Foo(){<br />
int* p;<br />
p=new int;<br />
delete p;<br />
}<br />
<br />
};<br />
}<br />
errors came during the link process...it don't like new and delete operator.
If I cut that 2 lines then the DLL is created (OK, it is empty, but it works)
Can you tell me why?
Cheers,
Russell
|
|
|
|
|
What are the exact error messages you get?
Regards,
Nish
Fly on your way like an eagle
Fly as high as the sun
On your wings like an eagle
Fly and touch the sun
|
|
|
|
|
Hi,
the error is LNK2001 in doth cases ('new' and 'delete' operators).
It tells
error LNK2001: unresolved external symbol "void * __cdecl operator new(unsigned int)" (??2@$$FYAPAXI@Z)
error LNK2001: unresolved external symbol "void __cdecl operator delete(void *)" (??3@$$FYAXPAX@Z)
As you can see the compiler works, the problem is the linker....but i haven't change anything into the settings of the solution: it is a new project (library of classes in C++ NET).
I think that I'm missing some rule that tells that I can't use 'new' and 'delete' into the dll in classes in managed code,...but, if exist, it looks like a very strange rule! : this operators are basically and very important in C++ (managed or unmanaged).
Let me know, thanks
Cheers,
Russell
|
|
|
|
|
Russell,
Since you are using native C++ wrapped in Managed C++, I believe you must include stdio.h and any applicable libraries. Managed C++ actually uses __gc new to create managed objects. Also, you need to be aware of the VS 2003 MC++ loader lock problem. Please, read: http://www.codeproject.com/scrapbook/semicolon_2.asp[^]. After dealing with that issue (and others) for years, I was very happy to upgrade to 2005 and learn the new syntax.
Geo
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Hi.
I'm calling managed (C#) code from (unmanaged) Fortran. The Fortran code uses an unmanaged C/C++ Flat API (in a DLL), which calls into a managed C++ wrapper (currently in a separate DLL), which then calls into C# code...
I'm using Visual Studio 2005 for everything except the Fortran stuff. The Fortran code is built with Visual Studio 6.0. I have to use it because that's what the Fortran coders use.
How do I go about debugging my Fortran-to-C# bridge? Can I somehow launch an instance of VS 2005, load my DLLs, and attach to the running Fortran process to debug it? Or is there a way to debug using VS 6.0? Will I have to resort to WinDBG or something (which I've never used)?
Help. Thanks.
Just Mike
|
|
|
|
|
OK, let me reply to my own post to be more specific. I have more information.
I understand how to specify the executable for a C++ DLL (managed or unmanaged). When I do that and "Start New Instance" from VS, the executable launches as expected. However, when I try to do something that should stop me at a breakpoint, I see VS "wake up" in the sense that my breakpoint becomes live (red dot), and it even acts a little like I'm stopped at the breakpoint. But I don't see a current statement pointer, and I can't step through the code. What am I missing?
Furthermore, there doesn't seem to be an option to do something similar from a C# assembly (DLL). This is a C++ forum, of course, so I suppose that question isn't appropriate here. But it all seems related.
Help appreciated. Thanks.
Just Mike
|
|
|
|