02.06.2014, 01:14
C++ ia mnio del reslo papra?
Hi,
recently I downloaded sampgdk and have this warnings and 1 error: Code:
C:\Users\Malganys\Desktop\C++\include\plugin.h In file included from C:\Users\Malganys\Desktop\C++\include/plugin.h 22 C:\Users\Malganys\Desktop\C++\include\a_samp.h from C:\Users\Malganys\Desktop\C++\include/a_samp.h 2 C:\Users\Malganys\Desktop\C++\Programa.cpp from C:\Users\Malganys\Desktop\C++\Programa.cpp 185 47 C:\Users\Malganys\Desktop\C++\include\sdk\amx\amx.h [Warning] 'packed' attribute ignored for field of type 'char [20]' [-Wattributes] 215 25 C:\Users\Malganys\Desktop\C++\include\sdk\amx\amx.h [Note] in expansion of macro 'PACKED' 185 47 C:\Users\Malganys\Desktop\C++\include\sdk\amx\amx.h [Warning] 'packed' attribute ignored for field of type 'char' [-Wattributes] 265 25 C:\Users\Malganys\Desktop\C++\include\sdk\amx\amx.h [Note] in expansion of macro 'PACKED' 185 47 C:\Users\Malganys\Desktop\C++\include\sdk\amx\amx.h [Warning] 'packed' attribute ignored for field of type 'char' [-Wattributes] 266 25 C:\Users\Malganys\Desktop\C++\include\sdk\amx\amx.h [Note] in expansion of macro 'PACKED' C:\Program Files (x86)\Dev-Cpp\MinGW64\x86_64-w64-mingw32\lib32\libmingw32.a(lib32_libmingw32_a-crt0_c.o) In function `main': 18 h:\crossdev\src\mingw-w64-v3-svn\mingw-w64-crt\crt\crt0_c.c undefined reference to `WinMain@16' C:\Users\Malganys\Desktop\C++\collect2.exe [Error] ld returned 1 exit status Code:
#if defined __GNUC__ #define PACKED __attribute__((packed)) #else #define PACKED #endif |
Error 1 error C2371: 'int32_t' : nueva definiciуn; tipos bбsicos distintos c:\...\visual studio 2013\projects\server\server\sdk\amx\amx.h 60 1
Error 2 error C2371: 'uint32_t' : nueva definiciуn; tipos bбsicos distintos c:\...\visual studio 2013\projects\server\server\sdk\amx\amx.h 61 1
#if defined HAVE_STDINT_H #include <stdint.h> #else #if defined __LCC__ || defined __DMC__ || defined LINUX #if defined HAVE_INTTYPES_H #include <inttypes.h> #else #include <stdint.h> #endif #elif !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L /* The ISO C99 defines the int16_t and int_32t types. If the compiler got * here, these types are probably undefined. */ #if defined __MACH__ #include <ppc/types.h> typedef unsigned short int uint16_t; typedef unsigned long int uint32_t; #elif defined __FreeBSD__ #include <inttypes.h> #else typedef short int int16_t; typedef unsigned short int uint16_t; #if defined SN_TARGET_PS2 typedef int int32_t; typedef unsigned int uint32_t; #else typedef long int int32_t; typedef unsigned long int uint32_t; #endif #if defined __WIN32__ || defined _WIN32 || defined WIN32 typedef __int64 int64_t; typedef unsigned __int64 uint64_t; #define HAVE_I64 #elif defined __GNUC__ typedef long long int64_t; typedef unsigned long long uint64_t; #define HAVE_I64 #endif #endif #endif #define HAVE_STDINT_H #endif
plugins crashdetect streamer Whirlpool sscanf mysql GM
Im having an issue with the GDK, i've been trying to use the mysql_connect function from the BlueG plugin but everytime i call the function the samp-server crashes: this is my code
When i declare the function: pawn Код:
pawn Код:
|
cell Hooks::MySQLHooks::mysql_connect(char *host, char *user, char* db, char *pass, int port)
{
sampgdk::logprintf("hi");
AMX_NATIVE native = sampgdk_FindNative("mysql_connect");
if (native != NULL)
{
sampgdk::logprintf("it exists");
}
else sampgdk::logprintf(" it doesnt");
return (cell)sampgdk_InvokeNative(sampgdk_FindNative("mysql_connect"), "ssssi", host, user, db, pass, port);
}
mysql_connect(host[], user[], database[], password[], port = 3306, bool:autoreconnect = true, pool_size = 2)
Here's the syntax of mysql_connect in PAWN
pawn Код:
|
(const host[], const user[], const database[], const password[], port = 3306)
I provide them but it keeps crashing, after some debugging i figure out that it crashes when i call the function (not the one from the gdk)
pawn Код:
|
connectiondata *ConnectionData;
option(SAMPGDK_STATIC "Build static library instead" ON)
option(SAMPGDK_BUILD_PLUGINS "Build example plugins" ON)
option(SAMPGDK_BUILD_AMALGAMATION "Build amalgamation" ON)
[ 0%] Built target sampgdk_init
[ 2%] Generating lib/sampgdk/a_vehicles.c
[ 4%] Generating include/sampgdk/a_http.h
[ 6%] Generating include/sampgdk/a_objects.h
[ 8%] Generating include/sampgdk/a_players.h
[ 10%] Generating include/sampgdk/a_samp.h
[ 12%] Generating include/sampgdk/a_vehicles.h
[ 14%] Generating lib/sampgdk/a_http.api
[ 16%] Generating lib/sampgdk/a_objects.api
[ 18%] Generating lib/sampgdk/a_players.api
[ 20%] Generating lib/sampgdk/a_samp.api
[ 22%] Generating lib/sampgdk/a_vehicles.api
[ 24%] Generating lib/sampgdk/sampgdk.sym
[ 26%] Generating lib/sampgdk/a_http.c
[ 28%] Generating lib/sampgdk/a_objects.c
[ 30%] Generating lib/sampgdk/a_players.c
[ 32%] Generating lib/sampgdk/a_samp.c
Scanning dependencies of target sampgdk
[ 34%] Building C object CMakeFiles/sampgdk.dir/lib/sampgdk/internal/amx.c.o
[ 36%] Building C object CMakeFiles/sampgdk.dir/lib/sampgdk/internal/amxhooks.c.o
[ 38%] Building C object CMakeFiles/sampgdk.dir/lib/sampgdk/internal/array.c.o
[ 40%] Building C object CMakeFiles/sampgdk.dir/lib/sampgdk/internal/callback.c.o
[ 42%] Building C object CMakeFiles/sampgdk.dir/lib/sampgdk/internal/fakeamx.c.o
[ 44%] Building C object CMakeFiles/sampgdk.dir/lib/sampgdk/internal/hook.c.o
[ 46%] Building C object CMakeFiles/sampgdk.dir/lib/sampgdk/internal/log.c.o
[ 48%] Building C object CMakeFiles/sampgdk.dir/lib/sampgdk/internal/logprintf.c.o
[ 51%] Building C object CMakeFiles/sampgdk.dir/lib/sampgdk/internal/native.c.o
[ 53%] Building C object CMakeFiles/sampgdk.dir/lib/sampgdk/internal/param.c.o
[ 55%] Building C object CMakeFiles/sampgdk.dir/lib/sampgdk/internal/plugin.c.o
[ 57%] Building C object CMakeFiles/sampgdk.dir/lib/sampgdk/internal/timer.c.o
[ 59%] Building C object CMakeFiles/sampgdk.dir/lib/sampgdk/internal/init.c.o
[ 61%] Building C object CMakeFiles/sampgdk.dir/lib/sampgdk/a_samp.idl.c.o
[ 63%] Building C object CMakeFiles/sampgdk.dir/lib/sampgdk/core.c.o
[ 65%] Building C object CMakeFiles/sampgdk.dir/lib/sampgdk/interop.c.o
[ 67%] Building C object CMakeFiles/sampgdk.dir/lib/sampgdk/version.c.o
[ 69%] Building C object CMakeFiles/sampgdk.dir/lib/sampgdk/a_http.c.o
[ 71%] Building C object CMakeFiles/sampgdk.dir/lib/sampgdk/a_objects.c.o
[ 73%] Building C object CMakeFiles/sampgdk.dir/lib/sampgdk/a_players.c.o
[ 75%] Building C object CMakeFiles/sampgdk.dir/lib/sampgdk/a_samp.c.o
[ 77%] Building C object CMakeFiles/sampgdk.dir/lib/sampgdk/a_vehicles.c.o
Linking C static library libsampgdk.a
[ 77%] Built target sampgdk
[ 79%] Generating amalgamation
[ 79%] Built target sampgdk_amalgam
[ 81%] Packaging amalgamation files
Archiving file: /home/batman/sampx/build/lib/sampgdk/sampgdk.c
Archiving file: /home/batman/sampx/build/lib/sampgdk/sampgdk.h
Archiving file: /home/batman/sampx/sampgdk/doc/how-to-use-amalgamation.txt
Done
[ 81%] Built target sampgdk_amalgam_package
Scanning dependencies of target helloworld
[ 83%] Building CXX object plugins/helloworld/CMakeFiles/helloworld.dir/helloworld.cpp.o
[ 85%] Building CXX object plugins/helloworld/CMakeFiles/helloworld.dir/home/batman/sampx/samp-plugin-sdk/amxplugin.cpp.o
Linking CXX shared module helloworld.so
/usr/bin/ld: skipping incompatible /opt/centos/devtoolset-1.1/root/usr/lib/gcc/x86_64-redhat-linux/4.7.2/libstdc++_nonshared.a when searching for -lstdc++_nonshared
/usr/bin/ld: cannot find -lstdc++_nonshared
collect2: error: ld returned 1 exit status
make[2]: *** [plugins/helloworld/helloworld.so] Error 1
make[1]: *** [plugins/helloworld/CMakeFiles/helloworld.dir/all] Error 2
make: *** [all] Error 2
[debug] Run time error 20: "Invalid index parameter (bad entry point)"
I have a problem when linking to the static library, getting the following runtime error when i connect.
Код:
[debug] Run time error 20: "Invalid index parameter (bad entry point)" I don't get this error when i link to the dynamic lib. I've double checked all the project settings, i'm linking to the correct lib, and SAMPGDK_STATIC is defined. Also using the amalgamation. Note: The function main() exists in the blank mode i have loaded. So that's not what is causing it. |
#define SAMPGDK_AMALGAMATION
#include <sampgdk.h>
PLUGIN_EXPORT bool PLUGIN_CALL Load(void **ppData) { return sampgdk::Load(ppData); }
PLUGIN_EXPORT unsigned int PLUGIN_CALL Supports() { return sampgdk::Supports() | SUPPORTS_PROCESS_TICK;}
PLUGIN_EXPORT void PLUGIN_CALL Unload() { sampgdk::Unload(); }
PLUGIN_EXPORT void PLUGIN_CALL ProcessTick() { sampgdk::ProcessTick(); }