Click here to Skip to main content
15,892,643 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
when I leave QuarkInit (char * connect) it compiles but generates an error in the main
main.o : error LNK2001: símbolos externos indefinidos "void __cdecl QuarkInit(wchar_t *)" (?QuarkInit@@YAXPA_W@Z) I let in QuarkInit ( TCHAR * connect) the main error does not appear but aparace of that part of code
is to correct these mistakes without exchange TCHAR to char if someone is enteressa one can up the required code


excuse my English

copilado by visual studio 2013
with makefile.vc


.cmd compiled


@echo off

CLS
SET VSTools="c:\Program Files\Microsoft Visual Studio 12.0\VC"
CALL "c:\Program Files\Microsoft SDKs\Windows\v8.1A\bin\SetEnv.cmd"
CALL "c:\Program Files\Microsoft DirectX SDK (June 2010)\Utilities\bin\dx_setenv.cmd"
CALL "c:\Program Files\Microsoft Visual Studio 12.0\VC\vcvarsall.bat"

set PATH=c:\perl\bin;c:\mingw64\bin; %PATH%
mingw32-make vc COMPRESS=1




C++
void
QuarkInit(TCHAR *connect)
{
   GGPOSessionCallbacks cb = { 0 };

   bNetGame = TRUE;

   cb.begin_game = ggpo_begin_game_callback;
   cb.load_game_state = ggpo_load_game_state_callback;
   cb.save_game_state = ggpo_save_game_state_callback;
   cb.log_game_state = ggpo_log_game_state_callback;
   cb.free_buffer = ggpo_free_buffer_callback;
   cb.advance_frame = ggpo_advance_frame_callback;
   cb.on_event = ggpo_on_event_callback;

   //cb.Alert = QuarkAlert;

   if (strncmp(connect, "quark:served", strlen("quark:served")) == 0) {
      int port;
    char game[256], match[256];

      sscanf(connect, "quark:served,%[^,],%[^,],%d", game, match, &port);
      ggpo = ggpo_client_connect(&cb, game, match, port);
   } else if (strncmp(connect, "quark:direct", strlen("quark:direct")) == 0) {
      int localPort, remotePort, p1 = 0;
      char ip[128], game[128];

      sscanf(connect, "quark:direct,%[^,],%d,%[^,],%d,%d", game, &localPort, ip, &remotePort, &p1);
      ggpo = ggpo_start_session(&cb, game, localPort, ip, remotePort, p1);
   } else if (strncmp(connect, "quark:synctest", strlen("quark:synctest")) == 0) {
      int frames;
      char game[128];
      sscanf(connect, "quark:synctest,%[^,],%d", game, &frames);
      ggpo = ggpo_start_synctest(&cb, game, frames);
   } else if (strncmp(connect, "quark:stream", strlen("quark:stream")) == 0) {
      char game[256], matchid[256];
      int port;

      sscanf(connect, "quark:stream,%[^,],%[^,],%d", game, matchid, &port);
      ggpo = ggpo_start_streaming(&cb, game, matchid, port);
   } else if (strncmp(connect, "quark:replay", strlen("quark:replay")) == 0) {
      ggpo = ggpo_start_replay(&cb, connect + strlen("quark:replay,"));
   }

   VidSSetQuarkShowLogo(true);
}



error C2664: 'int strncmp(const char *,const char *,size_t)': can not convert an argument 1 of ' TCHAR *' to ' const


error C2664 : 'int sscanf (const char * , const char * , ... ) ': can not convert an argument 1 of ' TCHAR *' to ' const



email:robsons.2007@gmail.com

I started the program now

Posted
Updated 25-Sep-15 22:24pm
v2
Comments
Patrice T 25-Sep-15 22:27pm    
- avoid mixing languages: use Google Translate to help you to write English only.
- Tell us where are the errors.
- avoid Email address in message.

your problem is that you are compiling for UNICODE. It means that a character has two bytes. It is a weired theme but if you want to code you got to learn it someday. Here is some tutorial.

For Unicode you must use similar named C-functions with the UNICODE signature. For instance wcscmp for strcmp. On the Microsoft site are they fine documented.

The quick and dirty solution is to change the implementation signature to:
C++
QuarkInit (char * connect) 

Be aware of type cast warning - they are your friend.
 
Share this answer
 
Comments
CPallini 26-Sep-15 8:16am    
5.
robsons2007 26-Sep-15 14:20pm    
thank you
Please stop reposting this same query. A number of people have explained what the issue is and how to fix it. And I have also given you a link to an article that gives the technical details of how to use either ASCII or Unicode in your programs.
 
Share this answer
 
Comments
CPallini 26-Sep-15 8:15am    
5.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900