Results 1 to 2 of 2
  1. #1
    ndwl's Avatar
    Join Date
    Sep 2015
    Gender
    female
    Posts
    32
    Reputation
    10
    Thanks
    11

    really stupid error that i can't seem to fix

    i create my threads in my main cpp file, then i n my directx cpp, i store my render functions, i basically just draw from there, where i draw i include a menu and i used getasynckeystate to detect if the key was pressed, but it has to be held down, and i thought you had to follow that with 0x8000 to detect if its being held down. well, i tried creating a boolean inside a header file, i made my bool, and procceeded to make a function in my main that acts as a toggle, in my render function i said if (menutoggle = !menutoggle), but i get a linking error telling me that its defined twice, i've tried doing many different things.

    heres the question, is it me saying if? or should i just make a function inside.

    Code:
    int Render()
    {
    	p_Device->Clear(0, 0, D3DCLEAR_TARGET, 0, 1.0f, 0);
    	p_Device->BeginScene();
    
    	if (tWnd == GetForegroundWindow())
    	{
    		DrawShadowString("notfire", 6, 6, 250, 250, 250, pFontSmall);
    		void menutogglefunction();
    		{
    			while (true)
    			{
    				if (menutoggle = !menutoggle)
    				{
    					// render our menu
    					FillRGB(40, 66, 400, 240, 32, 32, 32, 246);
    					DrawBox(40, 66, 400, 240, 100, 32, 32, 32, 255);
    					DrawBox(41, 67, 400, 240, 100, 32, 32, 32, 255);
    					DrawBox(42, 68, 400, 240, 100, 32, 32, 32, 255);
    					DrawBox(43, 69, 400, 240, 100, 32, 32, 32, 255);
    					DrawBox(44, 70, 400, 240, 100, 32, 32, 32, 255);
    					DrawBox(45, 71, 400, 240, 100, 32, 32, 32, 255);
    					GradientFunc(45, 71, 395, 20, 102, 178, 255, 240);
    					DrawShadowString("notfire [private legit cheat]", 47, 73, 255, 255, 255, pFontSmall);
    				}
    			}
    		}
    	}
    
    	p_Device->EndScene();
    	p_Device->PresentEx(0, 0, 0, 0, 0);
    	return 0;
    }
    i create my bool inside my header, and i include the header inside directx.cpp

    this is the error

    Code:
    Severity	Code	Description	Project	File	Line
    Error	LNK2005	"bool menutoggle" (?menutoggle@@3_NA) already defined in cDirectX.obj	notfire	F:\notfire private\************* - Overlay\cMain.obj	1
    really i've tried "everything" with my knowledge i've searched up on the error i've tried many different things. i don't understand what is happening, any help at what im doing wrong is appreciated!
    DirectX menu + glow esp + triggerbot

  2. #2
    RarwMuffinz's Avatar
    Join Date
    Dec 2014
    Gender
    male
    Posts
    77
    Reputation
    10
    Thanks
    9
    My Mood
    Relaxed
    Ok think of this logicaly. You have a Boolean value (True or False). Lets plug in the possible values in this if statement.

    Code:
    if(menutoggle = !menutoggle)
    Example if menutoggle is true or false.
    Code:
    if(True equals the inverse of True)
    if(False equals the inverse of False)
    Will always evaluate to false, because nothing can ever be the inverse of itself.

    Oh also you are using an assignment operator (=) in place of a comparison operator (==) You can use assignment in an if statement, but it is bad practice.

    If this code is not asynchronous to the other code of this project, putting while(true) in your draw method will halt the entire program. Instead add a while loop to your main method.

    Code:
    void main(){
      while(true)
      {
        // Other code, including the assignment of menutoggle
        if(menutoggle) //Shorthand for if menutoggle==true
        {
           //render our menu
        }
      }
    }
    Another thing, you're declaring method menutogglefunction inside of render's deceleration. That's a no-no, how does this even compile?
    Last edited by RarwMuffinz; 10-14-2015 at 11:40 AM.

  3. The Following User Says Thank You to RarwMuffinz For This Useful Post:

    ndwl (10-14-2015)

Similar Threads

  1. [Discussion] I need to understand an error so that i can try making the AWP pentronas on shop
    By queenmickey in forum Blackshot Hacks & Cheats
    Replies: 5
    Last Post: 11-15-2012, 03:19 AM
  2. That Girl Is Really Stupid(in my class)
    By iDoge in forum Flaming & Rage
    Replies: 41
    Last Post: 05-22-2011, 02:05 PM
  3. how to say words that you can not say on ca
    By jjneshi in forum General
    Replies: 2
    Last Post: 04-12-2009, 11:17 AM
  4. how to post a link that you can only download with 100+ post
    By 95king in forum Combat Arms Hacks & Cheats
    Replies: 4
    Last Post: 09-21-2008, 12:24 PM
  5. some people r really stupid -.-"
    By lee9160 in forum WarRock - International Hacks
    Replies: 22
    Last Post: 11-15-2007, 06:10 PM