Go Back   Tech Support Forum > The IT Pro > Programming

Fatal error

This is a discussion on Fatal error within the Programming forums, part of the Tech Support Forum category. Every time i compile this thing i got this fatal error LNK1169: one or more multiply defined symbols found is


Reply
 
Thread Tools Search this Thread
Old 10-08-2011, 08:14 PM   #1
Registered Member
 
Join Date: May 2010
Location: Hillsboro, Oregon
Posts: 142
OS: Xp


Question

Every time i compile this thing i got this
fatal error LNK1169: one or more multiply defined symbols found

is the problem is the header .h? or just me trying to re-code this code

Code:
// Test v1.cpp : Defines the exported functions for the DLL application.
//

#include "stdafx.h"
//includes all nessecary files to this source
#include <windows.h>
//End of includes
//This is what you call globals.
int TestOn = 0;
//Define HackOn as a number, and that numebr is zero.
int TestMax = 10;
//Define HackMax as a number, and that number is ten.
bool test = false;
//Define test as a true/false. "Boolean"
#define ADDR_SBULLLETS			0x374BBF16 
//The definition of ADDR_SBULLETS
//End of Globals
void Main (void)
{
	while(1)
		//Makes an infinite loop. One that doesn't end.
	{
		if(GetAsyncKeyState(VK_NUMPAD1)&1)
			//When Numpad1 Gets Pressed
		{
			test = (!test);
			//if test = false, turn to true and vice versa
		}
		if(GetAsyncKeyState(VK_NUMPAD2)&1)
			//When Numpad2 Gets Pressed.
		{
			TestOn ++;
			//Adds +1 to the variable, "HackOn"
			if(TestOn == TestMax) TestOn = 0;
			//When Hackon Reaches the number HackMax, it resets HackOn to 0
		}
		if(test)
			//if test is true
		{
			memcpy( (PBYTE)ADDR_SBULLLETS, (PBYTE)"\x33\xC0\x90", 3 );
			//look in globals for the definition of ADDR_SBULLETS
			//Basically, it edits the bytes of the memory to "\x33\xC0\x90".
			//The number at the end, tells you how many bytes you are editing.
			//The first part, ADDR_SBULLETS Shows the code which part of the memory we are editing.
		}else{
			//if test is not true
			memcpy(  (PBYTE)ADDR_SBULLLETS, (PBYTE)"\x0F\x94\xC0", 3 );
			//look in globals for the definition of ADDR_SBULLETS
			//Basically, it edits the bytes of the memory to "\x0F\x94\xC0".
			//The number at the end, tells you how many bytes you are editing.
			//The first part, ADDR_SBULLETS Shows the code which part of the memory we are editing.
		}
	}
}
DWORD WINAPI Lesson (LPVOID)
// This is just a dummy function that will be the code activate the main thread
{	
	Main();
	//Call the thread called Main
	return 1;
	//Finish of the thread.
}

BOOL WINAPI DllMain ( HMODULE hDll, DWORD dwReason, LPVOID lpReserved )
// DllMain is an optional function for you to declare.
// It serves as the entry point for any DLL
{
	DisableThreadLibraryCalls(hDll);
	// Make a call to DisableThreadLibraryCalls with the hModule variable
	// as its argument; Doing this is an optimization trick to prevent
	// needless thread attach/detach messages from triggering further calls
	// to our DllMain function.
	if ( dwReason == DLL_PROCESS_ATTACH )
	{
		//When this dll is injected into the process. this is what the dll is supposed to do.
		// Null, in C Plus Plus, nothing. It is defined as 0
		CreateThread(NULL, NULL, Lesson, NULL, NULL, NULL);
		//It creates the thread called "Lesson" which is defined a few lines up. DWORD WINAPI Lesson (LPVOID)
	}
return TRUE;
// Although the return value doesn't actually matter. You return the value TRUE or FALSE indicatinng success or failure.

}

__________________
mraccryu23614 is offline   Reply With Quote
Old 10-09-2011, 02:01 PM   #2
TSF-Emeritus
 
Ninjaboi's Avatar
 
Join Date: Dec 2010
Location: U.S.A., Texas
Posts: 2,047
OS: Windows XP SP3, Ubuntu 10

My System


You shouldn't have main set to not return ( void ). Instead, you should try to make it return 'int'. You also capitalized 'main' in both your declaration of the function, as well as in DWORD WINAPI Lesson(). Lower-casing the declaration in line 18 as well as line 58, and making main return an integer, should fix your problem.

Hope that works .

EDIT: If that doesn't work, you should try commenting out line 4 ( as I did that when I was working with your code as well ).

__________________
Ninjaboi is offline   Reply With Quote
Old 10-09-2011, 02:51 PM   #3
Registered Member
 
Join Date: May 2010
Location: Hillsboro, Oregon
Posts: 142
OS: Xp



Quote:
Originally Posted by Ninjaboi View Post
You shouldn't have main set to not return ( void ). Instead, you should try to make it return 'int'. You also capitalized 'main' in both your declaration of the function, as well as in DWORD WINAPI Lesson(). Lower-casing the declaration in line 18 as well as line 58, and making main return an integer, should fix your problem.

Hope that works .

EDIT: If that doesn't work, you should try commenting out line 4 ( as I did that when I was working with your code as well ).
Ok i'm using Microsoft c++ Express 2010
and theres no numbers in the lines. how can i find numer 18 and 58

is there a config or something so i can see the numbers
__________________
mraccryu23614 is offline   Reply With Quote
Old 10-09-2011, 04:59 PM   #4
TSF-Emeritus
 
Ninjaboi's Avatar
 
Join Date: Dec 2010
Location: U.S.A., Texas
Posts: 2,047
OS: Windows XP SP3, Ubuntu 10

My System


There is a way to see the line numbers. Start up Visual Studio Express.

Tools >> Options... >> Text Editor >> C/C++. Under 'Display', check mark "Line numbers". Click "OK" when finished.
__________________
Ninjaboi is offline   Reply With Quote
Old 10-09-2011, 05:11 PM   #5
Registered Member
 
Join Date: May 2010
Location: Hillsboro, Oregon
Posts: 142
OS: Xp



Quote:
Originally Posted by Ninjaboi View Post
There is a way to see the line numbers. Start up Visual Studio Express.

Tools >> Options... >> Text Editor >> C/C++. Under 'Display', check mark "Line numbers". Click "OK" when finished.
Ok let me try this base i made if its works then cool

i didnt just made this my self some people help me

people like you good at coding.

Ok 1st you want to me Lower-casing the letter you mean like this
HELLO = hello?

Code:
DWORD WINAPI Lesson (lpvoid)
__________________
mraccryu23614 is offline   Reply With Quote
Old 10-10-2011, 09:18 AM   #6
TSF-Emeritus
 
Ninjaboi's Avatar
 
Join Date: Dec 2010
Location: U.S.A., Texas
Posts: 2,047
OS: Windows XP SP3, Ubuntu 10

My System


Code:
// Test v1.cpp : Defines the exported functions for the DLL application.
//

//#include "stdafx.h"
//includes all nessecary files to this source
#include <windows.h>
//End of includes
//This is what you call globals.
int TestOn = 0;
//Define HackOn as a number, and that numebr is zero.
int TestMax = 10;
//Define HackMax as a number, and that number is ten.
bool test = false;
//Define test as a true/false. "Boolean"
#define ADDR_SBULLLETS            0x374BBF16 
//The definition of ADDR_SBULLETS
//End of Globals
int main()
{
    while(1)
        //Makes an infinite loop. One that doesn't end.
    {
        if(GetAsyncKeyState(VK_NUMPAD1)&1)
            //When Numpad1 Gets Pressed
        {
            test = (!test);
            //if test = false, turn to true and vice versa
        }
        if(GetAsyncKeyState(VK_NUMPAD2)&1)
            //When Numpad2 Gets Pressed.
        {
            TestOn ++;
            //Adds +1 to the variable, "HackOn"
            if(TestOn == TestMax) TestOn = 0;
            //When Hackon Reaches the number HackMax, it resets HackOn to 0
        }
        if(test)
            //if test is true
        {
            memcpy( (PBYTE)ADDR_SBULLLETS, (PBYTE)"\x33\xC0\x90", 3 );
            //look in globals for the definition of ADDR_SBULLETS
            //Basically, it edits the bytes of the memory to "\x33\xC0\x90".
            //The number at the end, tells you how many bytes you are editing.
            //The first part, ADDR_SBULLETS Shows the code which part of the memory we are editing.
        }else{
            //if test is not true
            memcpy(  (PBYTE)ADDR_SBULLLETS, (PBYTE)"\x0F\x94\xC0", 3 );
            //look in globals for the definition of ADDR_SBULLETS
            //Basically, it edits the bytes of the memory to "\x0F\x94\xC0".
            //The number at the end, tells you how many bytes you are editing.
            //The first part, ADDR_SBULLETS Shows the code which part of the memory we are editing.
        }
    }
}
DWORD WINAPI Lesson (LPVOID)
// This is just a dummy function that will be the code activate the main thread
{    
    main();
    //Call the thread called Main
    return 1;
    //Finish of the thread.
}

BOOL WINAPI DllMain ( HMODULE hDll, DWORD dwReason, LPVOID lpReserved )
// DllMain is an optional function for you to declare.
// It serves as the entry point for any DLL
{
    DisableThreadLibraryCalls(hDll);
    // Make a call to DisableThreadLibraryCalls with the hModule variable
    // as its argument; Doing this is an optimization trick to prevent
    // needless thread attach/detach messages from triggering further calls
    // to our DllMain function.
    if ( dwReason == DLL_PROCESS_ATTACH )
    {
        //When this dll is injected into the process. this is what the dll is supposed to do.
        // Null, in C Plus Plus, nothing. It is defined as 0
        CreateThread(NULL, NULL, Lesson, NULL, NULL, NULL);
        //It creates the thread called "Lesson" which is defined a few lines up. DWORD WINAPI Lesson (LPVOID)
    }
return TRUE;
// Although the return value doesn't actually matter. You return the value TRUE or FALSE indicatinng success or failure.

}
That's actually what I meant .
__________________
Ninjaboi is offline   Reply With Quote
Old 10-10-2011, 11:52 AM   #7
Registered Member
 
Join Date: May 2010
Location: Hillsboro, Oregon
Posts: 142
OS: Xp



Quote:
Originally Posted by Ninjaboi View Post
Code:
// Test v1.cpp : Defines the exported functions for the DLL application.
//

//#include "stdafx.h"
//includes all nessecary files to this source
#include <windows.h>
//End of includes
//This is what you call globals.
int TestOn = 0;
//Define HackOn as a number, and that numebr is zero.
int TestMax = 10;
//Define HackMax as a number, and that number is ten.
bool test = false;
//Define test as a true/false. "Boolean"
#define ADDR_SBULLLETS            0x374BBF16 
//The definition of ADDR_SBULLETS
//End of Globals
int main()
{
    while(1)
        //Makes an infinite loop. One that doesn't end.
    {
        if(GetAsyncKeyState(VK_NUMPAD1)&1)
            //When Numpad1 Gets Pressed
        {
            test = (!test);
            //if test = false, turn to true and vice versa
        }
        if(GetAsyncKeyState(VK_NUMPAD2)&1)
            //When Numpad2 Gets Pressed.
        {
            TestOn ++;
            //Adds +1 to the variable, "HackOn"
            if(TestOn == TestMax) TestOn = 0;
            //When Hackon Reaches the number HackMax, it resets HackOn to 0
        }
        if(test)
            //if test is true
        {
            memcpy( (PBYTE)ADDR_SBULLLETS, (PBYTE)"\x33\xC0\x90", 3 );
            //look in globals for the definition of ADDR_SBULLETS
            //Basically, it edits the bytes of the memory to "\x33\xC0\x90".
            //The number at the end, tells you how many bytes you are editing.
            //The first part, ADDR_SBULLETS Shows the code which part of the memory we are editing.
        }else{
            //if test is not true
            memcpy(  (PBYTE)ADDR_SBULLLETS, (PBYTE)"\x0F\x94\xC0", 3 );
            //look in globals for the definition of ADDR_SBULLETS
            //Basically, it edits the bytes of the memory to "\x0F\x94\xC0".
            //The number at the end, tells you how many bytes you are editing.
            //The first part, ADDR_SBULLETS Shows the code which part of the memory we are editing.
        }
    }
}
DWORD WINAPI Lesson (LPVOID)
// This is just a dummy function that will be the code activate the main thread
{    
    main();
    //Call the thread called Main
    return 1;
    //Finish of the thread.
}

BOOL WINAPI DllMain ( HMODULE hDll, DWORD dwReason, LPVOID lpReserved )
// DllMain is an optional function for you to declare.
// It serves as the entry point for any DLL
{
    DisableThreadLibraryCalls(hDll);
    // Make a call to DisableThreadLibraryCalls with the hModule variable
    // as its argument; Doing this is an optimization trick to prevent
    // needless thread attach/detach messages from triggering further calls
    // to our DllMain function.
    if ( dwReason == DLL_PROCESS_ATTACH )
    {
        //When this dll is injected into the process. this is what the dll is supposed to do.
        // Null, in C Plus Plus, nothing. It is defined as 0
        CreateThread(NULL, NULL, Lesson, NULL, NULL, NULL);
        //It creates the thread called "Lesson" which is defined a few lines up. DWORD WINAPI Lesson (LPVOID)
    }
return TRUE;
// Although the return value doesn't actually matter. You return the value TRUE or FALSE indicatinng success or failure.

}
That's actually what I meant .
Hahaha i did that. like you said let me try and re-compile it

Edit: I got the same error

Code:
1>Test v1.obj : error LNK2005: _DllMain@12 already defined in dllmain.obj
1>C:\Documents and Settings\Intel\My Documents\Visual Studio 2010\Projects\Test v1\Debug\Test v1.dll : fatal error LNK1169: one or more multiply defined symbols found
__________________
mraccryu23614 is offline   Reply With Quote
Old 10-11-2011, 01:22 AM   #8
TSF-Emeritus
 
Ninjaboi's Avatar
 
Join Date: Dec 2010
Location: U.S.A., Texas
Posts: 2,047
OS: Windows XP SP3, Ubuntu 10

My System


It seems your defining DLLMain() in your Test v1 file, when it's already defined in dllmain. This means that MFC already defines this for you, and that you should either remove DLLMain() from your source entirely, or that you should remove MFC from your project.

Don't worry if you choose the latter though, as since it's already defined in MFC you can still call and use it just like normal. If your wanting to edit the function itself though, possibly just renaming the custom function would prevent conflicting with the original.

__________________
Ninjaboi is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Similar Threads
Thread Thread Starter Forum Replies Last Post
Computer Virus/Trojan Problems
Amateur. First may I thank you for responding to my request for help. I have compiled the following List of Problems that I am aware of on my computer. Windows is being stopped from updating. Trend Micro is being stopped from updating.
Jack Willday Inactive Malware Help Topics 65 07-13-2011 12:57 AM
Google/Browser Redirect Virus
Ok...I am a newbie but here it goes: I recently experienced browser redirecting and, after extensive research, my computer appears to be infected with the "Google Redirect Virus." Each time a select a link when searching within a browser (using Google, Yahoo, etc...), the browser redirects me to...
utblair Virus/Trojan/Spyware Help 42 07-08-2011 01:52 PM
Antivirus Antimaleware 2011!
Hello everyone, A few days ago my computer was being slow, requiring frequent restarts, freezing a lot, etc etc. Today I got Antivirus Antimaleware 2011 madness popping up on my computer telling me that I had tons of viruses, I am going to die, world is going to hell in a handbasket and...
lolerary Inactive Malware Help Topics 11 04-03-2011 06:35 PM
System Tool Infection - please help
I seem to have acquired a virus (?) called System Tool on my new laptop and would very much appreciate your help. I'm afraid I do not have much technical knowledge, so please bear with me! I have visited the Virus/Trojan/Spyware Removal Help forum and am working my way through the "New...
Rosie Rabbit Resolved HJT Threads 31 02-20-2011 06:35 AM
redirect to mywebface, mywebsearch, and wizard101
For the past few days, I have been getting redirected to mywebface or wizard101.com when I visit some websites, not all, but they are normal and safe websites that I visit and have always visited, but now I'm getting this redirection. I will refresh the website and it will redirect again. This only...
woodman123 Resolved HJT Threads 19 02-16-2011 09:13 PM

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is on
Smilies are on
[IMG] code is on
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Post a Question


» Site Navigation
 > FAQ
  > 10.0.0.2


All times are GMT -7. The time now is 07:31 AM.


Copyright 2001 - 2014, Tech Support Forum

Windows 7 - Windows XP - Windows Vista - Trojan Removal - Spyware Removal - Virus Removal - Networking - Security - Top Web Hosts