AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Symbol already defined: ... (https://forums.alliedmods.net/showthread.php?t=188643)

Hyper Nova 06-28-2012 19:20

Symbol already defined: ...
 
Hello Allied Modders!


I have problem again..

I do scripting now in pawn just like in c++ and java usually do
There are main file
something.sma
inside of it

PHP Code:

#include "smn/smn.smn"
#include "smn/smn.smn"
#include "smn/smn.smn"
...
#include "smn/smn.smn"
#include "smn/register_smn.smn"
#include "smn/something_smn.smn"
#include "smn/something2_smn.smn" 

and there are folder smn " smn means like something what i just dont want to write here :):) "
inside the folders are files *.smn
the are like parts of big script
example in c++/c there are .cpp and h.
and the big script will be .dll
in pawn big script is .amxx then
( Edit: thats how the game engines work )

Now inside register_smd.smn i will show the problem part code
PHP Code:


public something()
{
    
do_something()



in something_smn.smn
PHP Code:

do_something()
{




in something_smn2.smn
PHP Code:

do_something()
{


and if i compile script it will say
Symbol already defined: do_something()
so my question is how to fix this.
how to do it that compiler will compile and things will work in game well.
its really to big work to rename this do_something() to every scripts.
I mean there must be a easy way to do this without doing things manually.
I already use this here:
PHP Code:

#if defined _myinc_included 
  #endinput 
#endif 
#define _myinc_included 

this solved that ( variable already defined ) problems.
Thank you in advance!

fysiks 06-28-2012 22:18

Re: Symbol already defined: ...
 
Quote:

Originally Posted by Hyper Nova (Post 1738526)
and there are folder smn " smn means like something what i just dont want to write here :):) "

lol. Some people are just way too over protective of code that doesn't really matter if it's shown publicly.

I'm glad you solved your problem though. Good Job!

ConnorMcLeod 06-29-2012 01:25

Re: Symbol already defined: ...
 
In pawn, include file is just like putting all 1 single file before compilation.
So if you have more than 1 time the same function name it can't compile.
That is as simple, don't put 2 functions with the same name.


All times are GMT -4. The time now is 06:08.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.