AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Module Coding (https://forums.alliedmods.net/forumdisplay.php?f=9)
-   -   Unresolved external (https://forums.alliedmods.net/showthread.php?t=293944)

killerZM 02-15-2017 12:58

Unresolved external
 
i tried to compile a module before but i get that error
LNK200 : Unresolved external .........

klippy 02-15-2017 13:43

Re: Unresolved external
 
That's no info at all. Post the code and full compiler/linker log.

killerZM 02-15-2017 14:54

Re: Unresolved external
 
linker ? i dont know about linker

i use msv 2013 express

code is 2300 line

addons_zz 02-15-2017 15:29

Re: Unresolved external
 
Quote:

Originally Posted by KliPPy (Post 2495643)
That's no info at all. Post the code and full compiler/linker log.


WildCard65 02-15-2017 15:41

Re: Unresolved external
 
Quote:

Originally Posted by killerZM (Post 2495678)
linker ? i dont know about linker

i use msv 2013 express

code is 2300 line

The error was generated by msvc's linker because it couldn't find the definition to a function to link your code to (as your code references it), we can't help you without knowing what that function it's trying to find.

killerZM 02-16-2017 08:59

Re: Unresolved external
 
PHP Code:

#include "stdafx.h"
#include "amxxmodule.h"

extern AMX_NATIVE_INFO my_natives[];

static 
cell AMX_NATIVE_CALL addti(AMX *amxcell *params)
{
    
int num_to_add params[1];
    
int num_to_add2 params[2];
    
int sum num_to_add num_to_add2;
    return 
sum;
}

AMX_NATIVE_INFO my_natives[]
{
    {
"addti" ,addti} ,
    {
NULL NULL}
};

void OnAmxxAttach()
{
    
MF_AddNatives(my_natives);


code up

error :
PHP Code:

Error    1    error LNK2001unresolved external symbol "int (__cdecl* g_fn_AddNatives)(struct AMX_NATIVE_INFO const *)" (?g_fn_AddNatives@@3P6AHPBUAMX_NATIVE_INFO@@@ZA)    C:\Users\Mhmdbedo\Documents\Visual Studio 2013\Projects\Win32Project1\Win32Project1\Win32Project1.obj    Win32Project1

Error    2    error LNK1120
1 unresolved externals    C:\Users\Mhmdbedo\Documents\Visual Studio 2013\Projects\Win32Project1\Debug\Win32Project1.dll    Win32Project1 


klippy 02-16-2017 09:40

Re: Unresolved external
 
It seems like you didn't include amxxmodule.cpp in project's list of source files to be compiled.

killerZM 02-16-2017 10:51

Re: Unresolved external
 
i need it ? lol
@edit : it worked :)
but how i can remove the pre-compiled headers in my project ?
i press FILE > new project win32 app > create then setting appear and choose DLL file
and i need amxx.dll prefix or dll only

klippy 02-16-2017 12:10

Re: Unresolved external
 
Name your project <name>_amxx and you'll be good. The output binary will be named <name>_amxx.dll.
Also, when creating a project you can disable precompiled headers. You should also be able to disable them somewhere in project propertied for existing projects, probably in the general tab (on phone currently, can't check where exactly the option is).

killerZM 02-16-2017 13:35

Re: Unresolved external
 
thx for help


All times are GMT -4. The time now is 07:24.

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