|
Could anyone tell me what I'm doing wrong here:
<code>
// variables defined
private: array<String^>^ m_sAddressList = gcnew array<String^>{"localhost"};
private: int m_nCurrentAddress;
...
// attempting to make a property out of them
public: property array<String^>^ m_psAddressList{
String^ get(){ return array<m_sAddressList>(m_nCurrentAddress);}
}
</code>
I'm getting the following compiler error:
error C3901: 'get': must have return type 'cli::array<Type> ^' c:\documents and settings\john\my documents\programming\visual studio 2005\projects\winbot\winbot\ConnectionOperations.h 53
Any information would be greatly appreciated.
Thanks,
John
|
|
|
|
|
The 'get' must return an array to be consistent with how you've defined the property - e.g., return m_sAddressList. It's not clear what you are attempting to return.
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C# to C++ converter and VB to C++ converter
Instant J#: VB to J# converter
Clear VB: Cleans up VB.NET code
Clear C#: Cleans up C# code
|
|
|
|
|
Forgive my ingnorance but what is with the '^' chaacter?
The way you are using it is a syntax error in C++.
INTP
“Testing can show the presence of errors, but not their absence.”
Edsger Dijkstra
|
|
|
|
|
John R. Shaw wrote: Forgive my ingnorance but what is with the '^' chaacter?
The way you are using it is a syntax error in C++.
Hi,
It would be a syntax error in standard c++ but isn't this the (Managed) C++/CLI discussion board? Therefore i would like to point out: "The carat operator (^) (often called a "hat" by C++/CLI folks) indicates that a variable or parameter refers to a reference-type object." Or did i misread your point?
regards Tobias
|
|
|
|
|
2beeOr did i misread your point?
Nope! You told me exactly what I wanted to know. I had a feeling it was something like that, as if C++ did not have enough operators already.
INTP
“Testing can show the presence of errors, but not their absence.”
Edsger Dijkstra
|
|
|
|
|
Hi,
I am trying to write a very simple application that mixes MFC with C++ Managed. I have two questions:
1. Is it possible to build the mixed project with the MFC library statically linked. I get some errors of conflict which I don't get when building with dynamically linked.
2. I want to use .NET functions that ask for System::String^ str. When I supply these functions with CString I get error. I read every where that it suppose to work.
CString str = _T("Works");
CString str2 = _T("Doesn't Work");
String ^ stringEx = gcnew String( str ); // OK
strinEx = str2; // Is not working
Thanks.
-- modified at 4:32 Thursday 20th April, 2006
eladbo
|
|
|
|
|
Hi,
You cannot assign an CString object to a string. Every string assignment in .NET creates a new string on the garbage collector and recycles the old one. There is no global defined assignment operator for this available
You could try to write:
strinEx = gcnew String(str);
This makes no difference to the other assignment.
|
|
|
|
|
Hi,
The answer to the first question is probably that it is impossible to do static linking since the code produced for managed application is not native binary code but MSIL.
For different string conversions check following article:
http://msdn2.microsoft.com/en-us/library/ms235631.aspx
Max
|
|
|
|
|
Thanks for the information
eladbo.
|
|
|
|
|
I'm trying to build a dll with the code in the article linked below for use in an otherwise C# (NET1.1) based project. The article itself only includes the class itself, and not any of the packaging needed to run. I tried creating a managed dll, and then just pasting the class data into the cpp/h files. I quickly ran into problems first with it not finding .net types, and then once I added those I started getting linker errors, and quickly got stuck since I haven't done anything c++ related in a long time. I assume I'm missing at least one include statement, but don't know which one.
The only change I've made to the code linked below was to pull the kernel32 stuff back into the main namespace.
http://www.codeproject.com/managedcpp/howtocomport.asp
the errors I'm getting from the linker at the moment are:
SerialPort error LNK2020: unresolved token (0A000025) _CxxThrowException
SerialPort error LNK2020: unresolved token (0A000027) delete
What I have at the moment is below:
SerialPort.h
#pragma once
using namespace System;
using namespace System::IO;
using namespace System::Runtime::InteropServices;
using namespace std;
#ifndef NULL
#define NULL 0
#endif
namespace SerialPort
{
}
SerialPort.cpp
#include "stdafx.h"
#include "SerialPort.h"
namespace SerialPort
{
}
stdafx.h
#pragma once
#include<new>
#include<iostream>
|
|
|
|
|
If I have a service running set up with Local System account.
I will get the "System variable" PATH value when calling
getenv("TEMP")
When I later run my client, I will get the current users TEMP path with the same call. Since that user as it's own defenition of TEMP
How can I get the "System variable" value for the TEMP variable when running as a "normal" user?
//T
|
|
|
|
|
%temp%<br />
%tmp%<br />
%tmpdir%
otherwise, %windir%\Temp
|
|
|
|
|
ok, i need a line of code to turn off all computers on a LAN i have the rest of the code i just need that one line
|
|
|
|
|
for_each(Lan.getComputers(), TurnOff());
one line...
|
|
|
|
|
|
Try this (but this have a two lines
<br />
for (i = 0; i < LANComputers.count; ++i)<br />
ShutDown(LANComputers);<br />
maybe take action!
-----------------------------------------------------------------
Surely without war there would be no loss
Hence no mourning, no grief, no pain, no misery
No sleepless nights missing the dead... Oh, no more
No more war
[Sleepless - Cradle of Filth]
|
|
|
|
|
Hi all!
ich searching for a tftp library which i can used e.g.
to write an application which can upload and download
cisco configuration files.
I searched with google but i got no usable result.
Thx for help.
Best Regards
madcat
|
|
|
|
|
Not a stand-alone library but I'm guessing you can extract the source which you want from here.
Ed
|
|
|
|
|
|
I recieve these Linker errors when i try to compile a Program that utilizes a Mixed DLL.
Universe error LNK2020: unresolved token (0600001A) CApplicationForm::.ctor
Universe error LNK2020: unresolved token (0600001B) CApplicationForm::GetCaption
Universe error LNK2020: unresolved token (0600001C) CApplicationForm::GetCaption
Universe error LNK2020: unresolved token (0600001D) CApplicationForm::GetHeight
Universe error LNK2020: unresolved token (0600001E) CApplicationForm::GetWidth
Universe error LNK2020: unresolved token (0600001F) CApplicationForm::Dispose
Universe error LNK2020: unresolved token (06000020) CApplicationForm::InitializeComponent
Universe error LNK2020: unresolved token (06000021) CApplicationForm::SetCaption
Universe error LNK2020: unresolved token (06000022) CApplicationForm::SetCaption
Universe error LNK2020: unresolved token (06000023) CApplicationForm::SetHeight
Universe error LNK2020: unresolved token (06000024) CApplicationForm::SetWidth
Here is the code Listing for the DLL header File Application.h which contains the Class Definitions. The Source is compiled into the DLL (CommonDLL.Dll) which is linked to the program.
Application.h
//******************************************************************************
//FILE: Application.h
//DATE: 06 Mar 03
//MODIFIED: 13 Apr 06
//******************************************************************************
//******************************************************************************
// HISTORY:
//
// COMMENT: Make sure to Include CommonDLL.lib to Input libraries
//******************************************************************************
//******************************************************************************
#ifndef _APPLICATION_H_
#define _APPLICATION_H_
#pragma once
//******************************************************************************
// INCLUDE FILES
//******************************************************************************
//References
#using <mscorlib.dll>
#using <system.dll>
#using <system.drawing.dll>
#using <system.windows.forms.dll>
#include "Windows.h"
#include "Menu.h"
#include "PlugInManager.h"
#include <vcclr.h>
#include <stdlib.h>
//******************************************************************************
//******************************************************************************
// DEFINES
//******************************************************************************
using namespace System;
using namespace System::Drawing;
using namespace System::Windows::Forms;
#ifdef DLLMAKE
#include "DLLMain.h"
#define DECLAREDLL DLLEXPORT
#else
#ifdef DLLUSE
#include "DLLMain.h"
#define DECLAREDLL DLLIMPORT
#else
#define DECLAREDLL
#endif
#endif
//******************************************************************************
//******************************************************************************
// CLASS CApplicationForm
//******************************************************************************
//
//******************************************************************************
__gc class CApplicationForm : public Form
{
private:
System::ComponentModel::Container *components;
protected:
int m_Height;
int m_Width;
String *m_Title;
public:
CApplicationForm();
// ~CApplicationForm();
//Methods
char *GetCaption(char *Buffer);
int GetHeight();
int GetWidth();
String *GetCaption();
void Dispose(Boolean disposing);
void InitializeComponent();
void SetCaption(char *title);
void SetCaption(String *title);
void SetHeight(int height);
void SetWidth(int width);
// static int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow);
};
//******************************************************************************
//******************************************************************************
// CLASS CApplication
//******************************************************************************
//
//******************************************************************************
class DECLAREDLL CApplication
{
protected:
gcroot<capplicationform *=""> m_Window;
...
CMenu m_Menu;
CPlugInManager *m_PlugInManager; // The manager for all plugins.
HINSTANCE m_hInst; // Instance of the Application
HMENU m_MainMenu; // Main Menu
HWND m_hDlg; // Any Dialog Box Display.
HWND m_hWnd; // The main app window
HWND m_hWndFocus; // The D3D focus window (usually same as m_hWnd)
MSG m_Message; // The Window's Message
public:
CApplication(void);
~CApplication(void);
bool GetMouseButton(unsigned long Button);
DWORD GetHeight();
DWORD GetWidth();
...
void SetDlghWnd(HWND hDlg);
//Methods
void SetCaption(char *str);
};
DECLAREDLL CApplication *GetApplication();
#endif
//******************************************************************************
//******************************************************************************
// END OF FILE
//******************************************************************************
Here is the Header Listing for the Program.
Universe.h
//******************************************************************************
//FILE: Universe.h
//DATE: 13 Sep 05
//MODIFIED: 20 Dec 05
//******************************************************************************
#ifndef _UNIVERSE_H_
#define _UNIVERSE_H_
#pragma once
//******************************************************************************
// HISTORY:
//
// COMMENT: Make sure to Include CommonDLL.lib to Input libraries
// Desc: Header file Universe.h
//******************************************************************************
//******************************************************************************
//******************************************************************************
// INCLUDE FILES
//******************************************************************************
#include "\Projects\CommonDll\Application.h"
#include "\Projects\CommonDll\INIFile.h"
#include "\Projects\EngineLib\Graphics.h"
#include "\Projects\EngineLib\Input.h"
#include "\Projects\CommonDll\TimingClock.h"
#using <commondll.dll>
//*****************************************************************************
//*****************************************************************************
// DEFINITIONS
//*****************************************************************************
// TODO: change "DirectX AppWizard Apps" to your name or the company name
#define DXAPP_KEY TEXT("Software\\DirectX AppWizard Apps\\Universe")
//*****************************************************************************
//*****************************************************************************
//
//*****************************************************************************
class CUniverse : public CApplication
{
protected:
CINIFile m_INIFile; //Place to Load and Save Settings;
...
CTimingClock m_Clock; //The Application Timing Clock
float m_Time; //The App Time.
float m_FramesPerSec; //The number of Frames Per Second
int m_Frames; //The Frame Number
STime m_WorldTime; //The Length of Time the World has been running.
public:
virtual HRESULT InitApp();
...
void RemovePlugInDlg();
};
#endif
//*****************************************************************************
// END OF FILE
//*****************************************************************************
Does anyone know what I am doing wrong to create these errors? Please let me know any Ideas on how to link both the Native side and the Managed Side of the DLL to the application. In the configuration for the project I'm linking with CommonDll.lib and for the managed side I have included #Using <commondll.dll>. The class is defined in the default namespace.
I appreciate any help.
Thanks in advance,
DWyvern.
-- modified at 15:32 Monday 17th April, 2006
|
|
|
|
|
Project Description
Write a client/server application implementing a shared directory at the server. The server keeps
a directory of files (a folder) where the users can upload or download files. When the user connects
to the server, he/she selects either to download a file or to upload one. If the user wants to
download a file, the server will show a list of the files found in the shared directory, and the user will
select one of them and download it. If the user selects to upload a file, the user will select the file
and send it to the server, the server will store the file in the shared directory and make it available to
the later download requests. using c#
J.U.S.T
-- modified at 5:15 Monday 17th April, 2006
|
|
|
|
|
First of all, this is the (Managed) C++/CLI forum. You should direct your question to the C# forum. Secondly, you need to ask for help with a more specific question rather than just stating your project goals. We are here to help you to program and not to be a free source of computer development.
Peace
-- modified at 8:58 Monday 17th April, 2006
|
|
|
|
|
I will bid for this project.
$1000 per month
ETA - 6 months.
-Prakash
|
|
|
|
|
I think you are being a bit conservative with your pricing!
|
|
|
|
|
I can finish this project in 5 months and 29 days
-----------------------------------------------------------------
Surely without war there would be no loss
Hence no mourning, no grief, no pain, no misery
No sleepless nights missing the dead... Oh, no more
No more war
[Sleepless - Cradle of Filth]
|
|
|
|