SA-MP Forums Archive
need help with C++ - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Other (https://sampforum.blast.hk/forumdisplay.php?fid=7)
+--- Forum: Everything and Nothing (https://sampforum.blast.hk/forumdisplay.php?fid=23)
+--- Thread: need help with C++ (/showthread.php?tid=108608)



need help with C++ - hamptonin - 14.11.2009

Hey all

I'm new at C++ but i need a plugin
so i will ask you guys

I made a start with Microsoft visual C++
and i made something easy like this:

http://hamptonin.pastebin.com/m74a96006

But i got errors with compiling:
Код:
1>------ Build started: Project: test, Configuration: Release Win32 ------
1>Compiling...
1>test.cpp
1>Linking...
1>test.obj : error LNK2001: unresolved external symbol _amx_Register
1>test.obj : error LNK2001: unresolved external symbol "void * pAMXFunctions" (?pAMXFunctions@@3PAXA)
1>H:\Plugin\test\Release\test.dll : fatal error LNK1120: 2 unresolved externals
1>Build log was saved at "file://H:\Plugin\test\Release\BuildLog.htm"
1>tsg - 3 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Hamptonin


Re: need help with C++ - roleplayman - 15.11.2009

include export.def witch comes with sa-mp SDK


Re: need help with C++ - hamptonin - 15.11.2009

Quote:
Originally Posted by GNeoncore
include export.def witch comes with sa-mp SDK
i don't have any export.dev

Код:
fatal error C1083: Cannot open include file: 'export.def': No such file or directory



Re: need help with C++ - JakeB - 15.11.2009

Add the file "amxplugin.cpp" (Located in the SDK folder) to your project solution.


Re: need help with C++ - hamptonin - 15.11.2009

Quote:
Originally Posted by JakeB
Add the file "amxplugin.cpp" (Located in the SDK folder) to your project solution.
it compiles now but i got 1 warning:

Код:
1>H:\Plugin\test\test.cpp(49) : warning C4700: uninitialized local variable 'arg' used



Re: need help with C++ - yom - 15.11.2009

This mean you didn't give any value to that variable and try to use it.

Add this line under the declaration anyway:

amx_StrParam(amx, params[1], arg);


Re: need help with C++ - Creed - 15.11.2009

The best thing too do is that you must buy a book about C++.
It helps you a lot!

- Creed


Re: need help with C++ - hamptonin - 15.11.2009

Quote:
Originally Posted by 0rb
This mean you didn't give any value to that variable and try to use it.

Add this line under the declaration anyway:

amx_StrParam(amx, params[1], arg);
Thanks it compiles good

but now the next problem

in SA-MP Console:

Код:
[19:28:02] Loading plugin: test
[19:28:02]  Plugin does not conform to architecture.
[19:28:02]  Failed.
[19:28:02] Loaded 0 plugins.



Re: need help with C++ - hamptonin - 16.11.2009

Sorry for double post but can anybody help me?