• Welcome to Valhalla Legends Archive.
 

C++ help plz

Started by WiLD, March 30, 2003, 09:27 PM

Previous topic - Next topic

WiLD

hi all,
im kinda new to c++ im only really good in vb. but i was looking at some source codes of bots (c++) and i did find some errors so i fixed them up but 1 i just cant get it to work here it is: at the top of wild.cpp i have #include <Connection.h>  it was "Connection.h" but that caused errors so i just changed it to <Connection.h>. But when i click compile  it says Connection.h cant be found. I no its a existing file because its in the same folder so what should i do?
and remember im new 2 c++ so kinda make it simple 2 read ;)

I justed edited this to show u wats in wild.cpp

#include <Connection.h>
#include <conio.h>

void main()
{
   BinaryBot *Bot = new WiLD BinaryBot;
   strcpy(Bot->username, "Usernmae");
   strcpy(Bot->password, "Pssword");
   strcpy(Bot->cdkey, "CD-key");
   strcpy(Bot->statstring, "WiLD ChaT");
   strcpy(Bot->homechannel, "Clan VioLaToRz");
   if(Bot->Connect("211.233.0.73"))
   {
      Bot->Output->WriteEx(ConsoleOutput::YELLOW, "Connected To B.net!\n");
      Bot->Startup();
   }
   else
      Bot->Output->WriteEx(ConsoleOutput::RED, "Connection Failed!");
   delete Bot;
   getch();
}
=_=  &&  g0dFraY  &&  -=Templar=-  @USWest

Eibro

Quote from: WiLD on March 30, 2003, 09:27 PM
hi all,
im kinda new to c++ im only really good in vb. but i was looking at some source codes of bots (c++) and i did find some errors so i fixed them up but 1 i just cant get it to work here it is: at the top of wild.cpp i have #include <Connection.h>  it was "Connection.h" but that caused errors so i just changed it to <Connection.h>. But when i click compile  it says Connection.h cant be found. I no its a existing file because its in the same folder so what should i do?
and remember im new 2 c++ so kinda make it simple 2 read ;)

I justed edited this to show u wats in wild.cpp

#include <Connection.h>
#include <conio.h>

void main()
{
  BinaryBot *Bot = new WiLD BinaryBot;
  strcpy(Bot->username, "Usernmae");
  strcpy(Bot->password, "Pssword");
  strcpy(Bot->cdkey, "CD-key");
  strcpy(Bot->statstring, "WiLD ChaT");
  strcpy(Bot->homechannel, "Clan VioLaToRz");
  if(Bot->Connect("211.233.0.73"))
  {
     Bot->Output->WriteEx(ConsoleOutput::YELLOW, "Connected To B.net!\n");
     Bot->Startup();
  }
  else
     Bot->Output->WriteEx(ConsoleOutput::RED, "Connection Failed!");
  delete Bot;
  getch();
}

First off, it's int main() not void main(). Second, You need to #include "Connection.h" not <Connection.h> Third you need to lose "WiLD" in BinaryBot *Bot = new WiLD BinaryBot;
Eibro of Yeti Lovers.

WiLD

ok thank you, but now im getting a extra error.
i still got the same error as before but i also have this one on line 4.

Line  |  Unit
4        c:\wildbot\packetbuffer.h

| Message
from c:\wildbot\Connection.h:4,

so wats wrong now......
=_=  &&  g0dFraY  &&  -=Templar=-  @USWest

SiMi

hm maybe i should learn C++

Zakath

Perhaps you shouldn't rip off DarkMinion's work, also.

The source you're copying from isn't functional...and hasn't been for a long time. Moreover, it's very bad form to just insert your name in places like that.
Quote from: iago on February 02, 2005, 03:07 PM
Yes, you can't have everybody...contributing to the main source repository.  That would be stupid and create chaos.

Opensource projects...would be dumb.

WiLD

if u had havd read my first post i said it wasnt my source im learning. i wasnt going to relese it. i just want to learn c++. and i cant find ne GOOF decent tutorials on the net
=_=  &&  g0dFraY  &&  -=Templar=-  @USWest

Zakath

I'm afraid that looking at DM's source isn't gonna be very helpful for just starting out. He used a number of fairly advanced concepts in creating even that rather primitive vLBBot - classes, dynamic memory allocation, a custom string library...try to find a more conventional source of inspiration if you can - it'll be much easier to understand.
Quote from: iago on February 02, 2005, 03:07 PM
Yes, you can't have everybody...contributing to the main source repository.  That would be stupid and create chaos.

Opensource projects...would be dumb.

n00blar

I recommend this to you... and if you say its lame I will strangle you and cut off your nads and feed them raw to the dogs.. kthx

www.google.com -> search query = "Teach Yourself C++ in 21 Days"

Camel

Quote from: Eibro on March 30, 2003, 10:25 PMFirst off, it's int main() not void main().
what's wrong with void main() ?

Skywing

Quote from: Camel on March 31, 2003, 09:22 PM
Quote from: Eibro on March 30, 2003, 10:25 PMFirst off, it's int main() not void main().
what's wrong with void main() ?
void main() doesn't exist in C or C++.  It's a nonstandard compiler extension.

WiLD

well thx about all, and i will have a look at that c++ in 21 days. i also learnt several new things today =)
just 1 quick quetion that no 1 in me chanel would help me with is:
szName = the %s before hand right....
and wat does \n\r mean i no its a varible but of like wat does it do..

Thx alot.
=_=  &&  g0dFraY  &&  -=Templar=-  @USWest

MrRaza

you really need to buy a book and read it.

\n == New Line
\r == Return

there's alot mmore.

Banana fanna fo fanna

This is why people shouldn't start with VB.

WiLD

dont you mean SHOULD start with vb storm?

well thx raza.

because all the sources iv looked at i always see \n\r so that helps me alot. mmm FINAL LAST THING: do you have to put \n on every line? and \r means return but return to wat is it like return aka enter?
=_=  &&  g0dFraY  &&  -=Templar=-  @USWest

Starnaught

\n = new line
\r = carriage return

\n puts the cursor on the next line
\r returns the cursor to the leftmost position