Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

newbish question

yeah I'm going to sound like a real newb right now but here goes...

Up till now I had been using C++ in Visual Studio 2003
However, there were some errors and now I must use 2005's version

When I exchange the code it comes up with a great deal of compiler errors with unkown solutions, except that I should use a clear statement

I would really appreciate it if someone could tell me how and where to put a /clear statement thankyou
[472 byte] By [darkdaxter] at [2007-11-11 9:53:15]
# 1 Re: newbish question
post the errors please.
It may mean you should wipe the generated files, which means do a build->clean or build->clear if they renamed it from inside the IDE. Or just forcefully remove the /debug or /release or /whatever folder you build into?
jonnin at 2007-11-11 20:59:55 >
# 2 Re: newbish question
its fatal error C1190

whenever I try to see what's wrong it says this
#using <mscorlib.dll>
requires a /clr option

here's the code to the main function...since I know there must be something else wrong in this case *I used txt art
darkdaxter at 2007-11-11 21:00:49 >
# 3 Re: newbish question
#using <mscorlib.dll>
#using <System.dll>
#using <System.Data.dll>
using namespace System;
using namespace System::Data;
using namespace System::Data::OleDb;

#include <cstdlib>
#include <ctime>

//function parameters
String *Action(String *, String *__gc[], String *__gc[], String *, OleDbConnection *);

int main()
{
//declare array
String *combatants __gc[] = new String *__gc[20];
String *area __gc[] = new String *__gc[20];

//declare variables
String *battle = " ";
String *cont = " ";
String *play = " ";
int count = 3;
int z = 0;

//create connection object
OleDbConnection *ConnectStats = new OleDbConnection();
ConnectStats->ConnectionString = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = C:\Documents and Settings\Owner\My Documents\Souronis GAME\Databases.POPT1.mdb";

Console::WriteLine("You are the prince of Babylon!");
Console::WriteLine("PLEASE MAXIMIZE THE SCREEN!");
Console::WriteLine("Upon defeating the Dahaka, time began to warp");
Console::WriteLine();
Console::WriteLine(",,,,,,,,,, , ,, ,,,,,,,,,,,,,,,,,,,,,,,,,,.,.,,,,,,,,,,,,,,,");
Console::WriteLine(",,,,,,, ,,, , ,,,, ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,..,,,...");
Console::WriteLine(",,,, , ,,, ,,, ,, .@::.,,,,,,,,,,,,:.::,,,,,,,,.@:#:#@+:::");
Console::WriteLine(":......,,, , ,::##+:.,,,,,,,,,,:+*+*:,...,::::+++#@##:*");
Console::WriteLine("@+*@*#*:..,,,,,,..:##@#:.,,.....:.,,:**###@.::*#@#***#@:+:@");
Console::WriteLine("#**##*@@#:...:.**@@*@@@+:::::::::++:.:*#@@*,+.#:*#..,,:*#@@@");
Console::WriteLine("#**+*#**##@##@@@@#@@@@@@*##*****#**#*##@@:.*##@@@@.,,,,,:#@@");
Console::WriteLine("#:@@@@:***##@#@@:@#*@@@@@@@####@@##@@@@@# *@#@@@@@*,,,,,,.*@");
Console::WriteLine("#@@@@@*:#*#*@**#*@@@@@@@@@@@@@@@@*@@@@@@,@@@@@@@@@@.,,,,,,.#");
Console::WriteLine("@@@@@@##@@*##*:@@*@@@@@@@@@@#@@@+@@@@@# @@#@@@@@#@#+,, ,,,,:");
Console::WriteLine("@@@#@@@@#@**:**+#*#@@@@@@@@@@#@@@@@@@@.#@@@@@@@@@*@+,,,,,,,:");
Console::WriteLine("@@@@@@@#@@***+*+#*###@@@@@#@@#@@@@@@@*#@@#@@@@##@@@+,,,,,,,.");
Console::WriteLine("@@#**##@@@##**:*@*#@@@@@@#@@@#@###@@@@@@@@*@@@@@@@@#:,,, ,,.");
Console::WriteLine("##.,,.+#@@####*:**@@@@@@###*##@@#@@@@@@@@@@@@@@@*@@@+, ,.");
Console::WriteLine("*, ,, ,,**@@##@#@#@@@@@@@##*##@@##@@@@@@@@#@*@@@@@##*, ,,+");
Console::WriteLine(", ,, +#@@@*@###@@@@@@@####@@*@@@@@@@@:*@@@@@#**:, ,# ");
Console::WriteLine(",,,,, , :@*@@@#@@##*#@@@@@@##@#@@@@@::.@@@@@@**:++,,: ,,.@");
Console::WriteLine(",,,, *@@@@**@@@@@@@@@@@@@@@@@@@*#@*@@@@@#::**.,:*+.,*@ ");
Console::WriteLine(", ,,,, .*@@@@@@@@@#*@@@@@@@@@@*+#@#+##@@*::::,.:*@@@@@@");
Console::WriteLine(", ,, ,,.:#@@@#@@@@:@#@@@@@@##*#@#*@@#:::+:..*#@@@@@@@ ");
Console::WriteLine(" ...,..:*##@***+#@@@@@@+#####*:::.::.:+@@@@@@@@@@ ");
Console::WriteLine(",,,...:..:.*....:##**:*@#@@@@@@@##@@..:::::*@@@@@@@@@@@@@ ");
Console::WriteLine(", ...:##*+.,,..::* .::*@@:@@@@@#@@@#.:@@@@#@@@@@@@@@@@@@@@ ");
Console::WriteLine(",:.@.+**@@@@@*#*@@ @:*.:*@@@@@@@####.:,@@@@@@@@@@@@@@@@@@@@ ");
Console::WriteLine("W@.*:**#@@@@@@@@@#::@@*,,#@#:@@@@@@*.,:.@@@@@@@@@@@@@@@@#@@@");
Console::WriteLine("#,##@@#@@@@@@@@@@@*@@@@@, **@@@@@@@,:..@@@@@@@@@@@@@@@@@@@@@");
Console::WriteLine("#*#@@@@@@@@@@@@@*.*@@@@@.:::##@@#@:**:*@@@@@@@@@@@@@@@@##*@@");
Console::WriteLine("*#@@@@@@@@@@@@@@.*@@@@@+@#@@@@@@##@@@@@@@@@@@@@@@@@@@@@@@@@@");
Console::WriteLine("#*@@@@@@@@@@@@*.:#@@@@@@@@@#@@*@@#*@@@@@@@@@@@@@@@@@@@@@@@@@");
Console::WriteLine("***@@@@@@@@@#:..@@@@@@@+@@@@@@*@@@@@@@@@@@@@@@@@@@@@@@@@@@#*");
Console::WriteLine(":+++#@@@@@+...*@@@@@@@@+#:+@#*@#@@@@@@#@@@@@@@@@@@@@@@@@@#*");
Console::WriteLine("*::+::::.....@@@@@@@@@##@@#@##@#@@@@@@@@@@@@@@@@@@@@@@@@##*");
Console::WriteLine(".*::.::+:..::@@@@@@@@@@@#@#*@@#@*@@#@@@@@@@@@@@@@@@@@@@@@#**");
Console::WriteLine("##*....*.:#@@@@@#@@@@@@@@#*@#*@+@@#@@@@@@*@@@#@@@@###@@##**");
Console::WriteLine("##@##*+*:#*@@@@@@@@@@@@##*@@:*W@:@@@@@@@@@@@@@@###########**");
Console::WriteLine("#@@@@@@@@@@@@@@@@@#@@@*@@@@@#@@@,@@@@@@@@@@@@@##*#####******");
Console::WriteLine("@@@@@@@@@@@@@@@@@@@@@@@#@@@@@@@+:@@@@@@@@@@@@###########****");
Console::WriteLine("@@#@@@@@@@@@@#@@#@##@@@#@@@@@#@@.@@@@@@@@@@@#####@@@@#######");
Console::WriteLine("##@##@@@@@@@######@#@@@@@@@@@@@@@@@@@@#@@@@@###############@");
Console::WriteLine("*#################*##@@@@@##@@@@@@@@@#@@@@@###@@###@@@##@@#@");
Console::WriteLine();
Console::WriteLine("Now in order restore order back to time, the Prince must battle his former foes one-by-one until nothing is left to oppose him!!!!");
Console::WriteLine("Welcome to the greatest battle to be held in all of time!!");
Console::WriteLine("Prince of Persia::Tournament");

//assign data to subscripts
combatants[0] = "Trainer";
combatants[1] = "Bat";
combatants[2] = "Crow";
combatants[3] = "Male Sands";
combatants[4] = "Fat Sands";
combatants[5] = "Raider";
combatants[6] = "Female Sands";
combatants[7] = "Bladerunner";
combatants[8] = "Wolf";
combatants[9] = "Executioner";
combatants[10] = "Sillhouete";
combatants[11] = "Brute";
combatants[12] = "Vizier";
combatants[13] = "Crowmaster";
combatants[14] = "Hardened Soldier";
combatants[15] = "Shahdee";
combatants[16] = "Empress";
combatants[17] = "Dahaka";
combatants[18] = "Sandwraith";
combatants[19] = "Void";
//level prompts
area[0] = "level one vs. trainer!!";
area[1] = "level two vs. bat!!";
area[2] = "level three vs. crow!!";
area[3] = "level four vs. male sands zombie!!";
area[4] = "level five vs. fat sands zombie!!";
area[5] = "level six vs. raider!!";
area[6] = "level seven vs. female sands zombie!!";
area[7] = "level eight vs. bladerunner!!";
area[8] = "level nine vs. wolf!!";
area[9] = "level ten vs. executioner!!";
area[10] = "level eleven vs. sillhouete!!";
area[11] = "level twelve vs. brute!!";
area[12] = "level thirteen vs. the Vizier of Babylon!!!";
area[13] = "level fourteen vs. Crowmaster!!!";
area[14] = "level fifteen vs. the hardened soldier!!!";
area[15] = "level sixteen vs. Shahdee!!!";
area[16] = "level seventeen vs. the Empress of Time!!!!";
area[17] = "level eighteen vs. the Gaurdian of the Timeline, THE DAHAKA!!!!!";
area[18] = "the final battle vs. the almighty Sandwraith!!!!!!";
area[19] = "Bonus level vs. Mysterious man named Void...";

try
{
//open connection to database
ConnectStats->Open();
Console::Write("Do you wish to play<yes or no>: ");
play = Convert::ToString(Console::ReadLine()->ToUpper());
} //end try
catch (OleDbException *ex)
{
Console::WriteLine(ex->Message);
} //end catch
//end try/catch block

//gameplay check loop
while (play->CompareTo("YES") == 0)
{
//get location for first fight
if (z == 0)
{
play = "A";
z = z + 1;
} //end if

//get location, which may or may not affect your enemy's stats!
if (play->CompareTo("A") == 0)
{
while (battle->CompareTo("CLOCK TOWER") != 0 && battle->CompareTo("GARDEN TOWER") != 0 && battle->CompareTo("PALACE") != 0 && battle->CompareTo("SACRED CAVES") != 0)
{
Console::Write("Which area would you like to fight your next battle in <Clock Tower, Garden Tower, Palace, or Sacred Caves>: ");
battle = Convert::ToString(Console::ReadLine()->ToUpper());
} //end while
Console::WriteLine();
play = "YES";
} //end if

play = Action(play, combatants, area, battle, ConnectStats);
Console::WriteLine(battle);

} //end while

//game over and/or continue
if (play->CompareTo("NO") == 0)
{
Console::WriteLine("GAME OVER! THANK YOU FOR PLAYING!!");
Console::Write("Would you like to continue?<yes or no>: ");
cont = Convert::ToString(Console::ReadLine()->ToUpper());
if (cont->CompareTo("YES") == 0 && count > 0)
{
play = "YES";
count = count - 1;
Console::WriteLine("You have {0} continues left.", count.ToString("N0"));
} //end if
if (cont->CompareTo("NO") == 0)
{
Console::WriteLine("@@@@@@@@ @@@@@@ @@@@@@@@@@ @@@@@@@@ ");
Console::WriteLine("@@@@@@@@@ @@@@@@@@ @@@@@@@@@@@ @@@@@@@@ ");
Console::WriteLine("!@@ @@! @@@ @@! @@! @@! @@! ");
Console::WriteLine("!@! !@! @!@ !@! !@! !@! !@! ");
Console::WriteLine("!@! @!@!@ @!@!@!@! @!! !!@ @!@ @!!!:! ");
Console::WriteLine("!!! !!@!! !!!@!!!! !@! ! !@! !!!!!: ");
Console::WriteLine(":!! !!: !!: !!! !!: !!: !!: ");
Console::WriteLine(":!: !:: :!: !:! :!: :!: :!: ");
Console::WriteLine("::: :::: :: ::: ::: :: :: :::: ");
Console::WriteLine(":: :: : : : : : : : :: :: ");
Console::WriteLine(" ");
Console::WriteLine(" ");
Console::WriteLine("@@@@@@ @@@ @@@ @@@@@@@@ @@@@@@@ ");
Console::WriteLine("@@@@@@@@ @@@ @@@ @@@@@@@@ @@@@@@@@ ");
Console::WriteLine("@@! @@@ @@! @@@ @@! @@! @@@ ");
Console::WriteLine("!@! @!@ !@! @!@ !@! !@! @!@ ");
Console::WriteLine("@!@ !@! @!@ !@! @!!!:! @!@!!@! ");
Console::WriteLine("!@! !!! !@! !!! !!!!!: !!@!@! ");
Console::WriteLine("!!: !!! :!: !!: !!: !!: :!! ");
Console::WriteLine(":!: !:! ::!!:! :!: :!: !:! ");
Console::WriteLine("::::: :: :::: :: :::: :: ::: ");
Console::WriteLine(": : : : : :: :: : : : ");

} //end if
} //end if

//win
if (play->CompareTo("NOS") == 0)
Console::WriteLine("GAME OVER: CONGRATULATIONS!! YOU HAVE BEATEN EVERY ENEMY AND HAVE RESTORED ORDER TO THE TIMELINE!!");
//end if

//close connection to database
ConnectStats->Close();

return 0;
} //end of main function
darkdaxter at 2007-11-11 21:01:48 >
# 4 Re: newbish question
thanks
darkdaxter at 2007-11-11 21:02:54 >
# 5 Re: newbish question
I have never used using for a dll, instead I always add the .lib file to the project. You might try this -- I am not sure what else to suggest at this time.
jonnin at 2007-11-11 21:03:53 >
# 6 Re: newbish question
The #using Directive
Imports metadata into a program that will use the Managed Extensions for C++.

#using file
where:

file
A .dll, .exe, .netmodule, or .obj that was built with /clr. (Common Language Runtime Compilation)

Your error: you must specify a clr option :
Search for this :

"/clr compiler option [C++]"
Amahdy at 2007-11-11 21:04:52 >
# 7 Re: newbish question
I know that!
how and where do I do this?
darkdaxter at 2007-11-11 21:05:51 >
# 8 Re: newbish question
Have u searched ?

anyway here u have a sample :

#using <mscorlib.dll>

[assembly:System::CLSCompliant(true)]; // specify assembly compliance

[System::CLSCompliant(false)] // specify compliance for an element
Amahdy at 2007-11-11 21:06:59 >
# 9 Re: newbish question
yes I had but it gave me no working solution
so thank you
darkdaxter at 2007-11-11 21:07:57 >