|
I think ppl who voted you down did not get ur sarcasm
-Prakash
|
|
|
|
|
Finally, somebody got it! Indeed... it was only sarcasm in my posts...
So, you got my 5!
Cheers!
|
|
|
|
|
Hello , I copied a sample from msdn, but the compailer doesn't understend most of the language wordes ,The sample itself not importent for now,Only the compailer problem.
the semple is:
using namespace System;
int main()
{
array^args = Environment::GetCommandLineArgs();
const double tipRate = 0.18;
double billTotal;
if ( args->Length != 2 )
{
Console::WriteLine( "usage: TIPCALC total" );
return 1;
}
else
{
try
{
billTotal = Double::Parse( args[ 1 ] );
}
catch ( FormatException^ )
{
Console::WriteLine( "usage: TIPCALC total" );
return 1;
}
double tip = billTotal * tipRate;
Console::WriteLine();
Console::WriteLine( "Bill total:\t{0,8:c}", billTotal );
Console::WriteLine( "Tip total/rate:\t{0,8:c} ({1:p1})", tip, tipRate );
Console::WriteLine( ((String^)"")->PadRight( 24, '-' ) );
Console::WriteLine( "Grand total:\t{0,8:c}", billTotal + tip );
return 0;
}
}
/////////////////////////////////////////////////////
and I get this answer from compiler:
/////////////////////////////////////////////
------ Build started: Project: testing_from_books, Configuration: Debug Win32 ------
Compiling...
general_uri.cpp
.\general_uri.cpp(2) : error C2871: 'System' : a namespace with this name does not exist
.\general_uri.cpp(5) : error C2065: 'array' : undeclared identifier
.\general_uri.cpp(5) : error C2065: 'String' : undeclared identifier
.\general_uri.cpp(5) : error C2059: syntax error : '>'
.\general_uri.cpp(5) : error C2653: 'Environment' : is not a class or namespace name
.\general_uri.cpp(8) : error C2065: 'args' : undeclared identifier
.\general_uri.cpp(8) : error C2227: left of '->Length' must point to class/struct/union/generic type
type is ''unknown-type''
.\general_uri.cpp(10) : error C2653: 'Console' : is not a class or namespace name
.\general_uri.cpp(10) : error C3861: 'WriteLine': identifier not found
.\general_uri.cpp(17) : error C2653: 'Double' : is not a class or namespace name
.\general_uri.cpp(17) : error C3861: 'Parse': identifier not found
.\general_uri.cpp(19) : error C2061: syntax error : identifier 'FormatException'
.\general_uri.cpp(19) : error C2310: catch handlers must specify one type
.\general_uri.cpp(21) : error C2653: 'Console' : is not a class or namespace name
.\general_uri.cpp(21) : error C3861: 'WriteLine': identifier not found
.\general_uri.cpp(25) : error C2317: 'try' block starting on line '16' has no catch handlers
.\general_uri.cpp(26) : error C2653: 'Console' : is not a class or namespace name
.\general_uri.cpp(26) : error C3861: 'WriteLine': identifier not found
.\general_uri.cpp(27) : error C2653: 'Console' : is not a class or namespace name
.\general_uri.cpp(27) : error C3861: 'WriteLine': identifier not found
.\general_uri.cpp(28) : error C2653: 'Console' : is not a class or namespace name
.\general_uri.cpp(28) : error C3861: 'WriteLine': identifier not found
.\general_uri.cpp(29) : error C2653: 'Console' : is not a class or namespace name
.\general_uri.cpp(29) : error C2059: syntax error : ')'
.\general_uri.cpp(30) : error C2653: 'Console' : is not a class or namespace name
.\general_uri.cpp(29) : error C3861: 'WriteLine': identifier not found
.\general_uri.cpp(30) : error C3861: 'WriteLine': identifier not found
Build log was saved at "file://f:\Documents and Settings\uri\My Documents\אורי\חומר ופרויקטים ב-C++\Visual Studio 2005\Projects\testing_from_books\testing_from_books\Debug\BuildLog.htm"
testing_from_books - 27 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
//////////////////////////////////////////////////////////////
Why
|
|
|
|
|
1. what compiler do you use ? (VC6, 2005 or 2005)
if VC6, then you cannot compile managed code with it.
2. if not VC6, then did you correctly create a managed project ? (not Win32 for example)
|
|
|
|
|
|
Michael Dunn wrote: Are you using VC 2005?
I assume he does. Because his path is pointing to "...\Visual Studio 2005\Projects\...". Although you don't need VS 2005 to create a path like this . From my point of view it looks like he is trying to compile C++/CLI code within a WIN32 project.
regards Tobias
|
|
|
|
|
hello Michael
Yes I am using VC 2005, I think the problem is in the project diffintion becouse when I am using Sample of msdn with there's project files It's work fine.
|
|
|
|
|
I've been trying to work with the wininet API to get the IE user agent string for use as part of a larger program I am working on. First I tried this in VB.NET but got no working results. Now I'm trying to code it in C++ as per the example on the MSDN article I found. The code I have so far is:
<code>
#include <stdlib.h>
#include <stdio.h>
#include <stddef.h>
#include <string.h>
#include <windows.h>
#include <winioctl.h>
#include <wininet.h>
int main (int argc, char * argv [])
{
DWORD dwSize;
DWORD errorCode;
bool res;
// This call determines the required buffer size.
res = InternetQueryOption(NULL,INTERNET_OPTION_USER_AGENT,NULL,&dwSize);
if (res) {
// Allocate the necessary memory.
char* lpszData = new char[dwSize];
// Call InternetQueryOption again with the provided buffer.
InternetQueryOption( NULL, INTERNET_OPTION_USER_AGENT,lpszData,&dwSize );
// Insert code here to use the user agent string data.
printf(lpszData);
// Free the allocated memory.
delete [] lpszData;
} else {
errorCode = GetLastError();
printf((char*)errorCode);
}
printf("\nDONE!");
return 0;
}
</code>
Each time it runs I get error code as a very large number (3131961397). Not sure what is going on but am hopeing somebody has the answer out there. The MSDN artitcle can be found here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wininet/wininet/setting_and_retrieving_internet_options.asp
|
|
|
|
|
|
Okay I did and I'm still getting an error. Error number comes back as -1163005939.
|
|
|
|
|
I really need help on this....
This may sound odd, but I need teh code to shutdown the windows workstation. I'm programming in C++. Heres What I have so far:
#include <iostream>
using namespace std;
int main (int argc, char *argv[])
{
cout << "H3ll0 4p0c4lyps3" << endl;
cout << "VIRUS.:.J3$U$I$C0MING" << endl;
cout << "ATTN: I know have complete control of your computer. Destruction is imminent." << endl;
cout << "R3sist4nce is Futil3." << endl;
cout << "WINDOWS ERROR!!" << endl;
cout << "CPU Usage @ 95%" << endl;
cout << "CPU Usage @ 96%" << endl;
cout << "CPU Usage @ 97%" << endl;
cout << "CPU Usage @ 98%" << endl;
cout << "CPU Usage @ 99%" << endl;
cout << "CPU Usage @ 100%. System Overheat. Windows shutdown initiating." << endl;
cout << "Please press ENTER to Continue" << endl
;cin.get();
return 1;
}
:Please help me. It's not a real virus, It's a special thing I'm doing at school on programming to get an A. email me the entire completed script to djdomino101@gmail.com. I need this ASAP.
Thanx guyz
-DJ Domino-
|
|
|
|
|
Hello,
Are you planning to play a prank on somebody? Well, you might be successful with this batch file i wrote. But i won't give you a solution in c++
@echo off
echo H3ll0 4p0c4lyps3
echo VIRUS.:.J3$U$I$C0MING
echo ATTN: I know have complete control of your computer. Destruction is imminent.
echo R3sist4nce is Futil3.
echo WINDOWS ERROR!!
echo CPU Usage @ 95%
echo CPU Usage @ 96%
echo CPU Usage @ 97%
echo CPU Usage @ 98%
echo CPU Usage @ 99%
echo CPU Usage @ 100%. System Overheat. Windows shutdown initiating.
PAUSE
shutdown -r -t 0
However, as a programmer you should make everyones life more pleasant, not harder!
regards Tobias
|
|
|
|
|
not sure if u have found the solution but here is the code i use with C.
#include <windows.h>
#include <shellapi.h>
main(){
ShellExecute(NULL, "open", "-s -f -t 23", "", SW_SHOW);
}
- Droz -
___ ___
/\/\ /\ | |
|
|
|
|
|
I've got an ATL project I need to get into managed land. Flip on the /clr switch, remove the /MT switch, and it compiles fine. However, the post-compile step is to register the dll using regsvr32. If I run regsvr32 on my project output, I get the following error:
Screenshot of error message[^]
How do I get around this?
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: How 'bout a little guitar now?
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
I don't think you can create an ATL COM application with Manage Code.
|
|
|
|
|
Hello all,
I've created a Windows Service project.
But I'm not able to debug the code written in the Start() method.
As mentioned in the Microsoft web site,
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbtskdebuggingserviceapplications.asp
I created a dummy Windows Service, even then I'm not able to proceed furthur.
Please help me in resolving this issue.
Thanks in Advance.
Regards
Sunil
|
|
|
|
|
Hi,
I'm new to Visual C++.Net and I'm trying to write a client-server application in which I want to transfer an image file [JPEG/BMP/GIF] from server to client. Right now, I've written a code which just transfers "String" type of data from client to server and vice versa.
How should I move ahead with images?
Thanks,
Kranti
|
|
|
|
|
Hi,
I would like to ask for soome general advice:
I am developiing a simple application that writes a string directly to the form in a .NET 2003 form application.
I HAVE to use std::string within the paint event so that I can make use of the standard template library.
I would like to step through each character in the string and copy them to a vector if possible.
I would like them within something like a vector so that I can easily access each element, which I cannot efficiently do with the string.
Here is a small bit of example code:
<br />
std::string text_string = "The text to use";<br />
<br />
for_each(text_string.begin(), text_string.end(), someFunction);<br />
I have tried writing a function
<br />
void someFunction(string &atempstring)<br />
{<br />
}<br />
But I get the compiler error
error C2064: term does not evaluate to a function taking 1 arguments
I do not know what this error means, can anybody help?
|
|
|
|
|
richiebaby wrote: void someFunction(string &atempstring)
The only problem I see is that someFunction should not take a string reference, but rather a reference to a single character.
void someFunction(string::value_type ¶meter)
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
richiebaby wrote: I would like them within something like a vector so that I can easily access each element, which I cannot efficiently do with the string.
A basic_string is an STL collection, you can step through it with iterators.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
std::string text_string = "The text to use";
//Is it possible to do this in C++ .NET 2003?
for_each(text_string.begin(), text_string.end(), someFunction);
Yes.
#include <iostream>
#include <algorithm>
#include <string>
using namespace System;
using std::cout;
using std::endl;
using std::string;
using std::for_each;
void PrintChar(const char & ch)
{
cout << ch << std::endl;
}
void Foo()
{
string greeting = "Hello!";
for_each(greeting.begin(), greeting.end(), PrintChar);
}
|
|
|
|
|
This post belongs in the Visual C++ forum.
// The user enters the string
char romanNumerals[32];
cin >> romanNumerals;
// Get the length of the string
size_t length = strlen(romanNumerals);
// Now translate the string
int value = 0;
for (size_t i = 0; i < length; i++)
{
// romanNumerals[i] will have a Roman Numeral
// Remember Roman Numeral Syntax!
}
-- modified at 17:35 Friday 7th April, 2006
|
|
|
|
|
What happens when you type in: MCMXLIV
|
|
|
|
|
wut is tat ?
nvm...whatever i also solved my problem,thk u guy all !!
|
|
|
|
|
Hello,
I have a special question on the Invoke Method of the MethodInfo class and maybe it will show to be a general question on assembly techniques. I am using Managed C++ bytheway.
My goal is to load a library dynamically (as a plugin) and just get a specific function. This is all working well as long as I keep it simple.
- I defined an interface class and all plugin classes derive from that one.
- Now, the function that I want to invoke needs 4 parameters of which 3 are standard .NET objects. The fourth however is my own type.
- If I invoke that function with the parameter array, I get an exception as soon as my type object is not NULL saying the typical "Object cannot be converted to target type".
At first, I had my data class definitions in the main applications and additionally made a library with the same classes, which was linked by the plugin, as the plugin needs the same data classes, of course. I figured, he might have trouble realizing that these are really the same types. So I put the classes into a separate library. Now, the main application AND the plugin link the SAME library. But seperately at different times, I guess.
Could this already be the problem? Or where else is the problem?
I also found something about "copylocal" related to similar problems, which should be set to "false". But I have no idea in which area this setting is to be made and if it will really solve the problem.
Further thought: in the common plugin-samples the thisObject for
mi->Invoke (thisObject,...) is created by
thisObject = Activator::CreateInstance (type);
This doesn't work for me either, as the class information I have is only the Interface which cannot be instanziated. The specific class definition is in the plugin. Is that related to my problem? If the invoke works anyway, I'm fine as it is.
Again: Invoking methods of the same plugin, that do not use my own classes cause no problems.
I would appreciate any help and hint. Maybe I am close or I am far off. I just don't know. My samples were all C# and too simple, so finally, I am lost.
Thank you very much in advance! If you need some code, I can provide that on Monday, when I'm back on my PC.
Thank you and have a nice weekend,
dawei
|
|
|
|