project-navigation
Personal tools

Author Topic: error when compiling on win32 windows  (Read 5663 times)

Offline xray

  • Rookie
  • ***
  • Posts: 72
    • View Profile
error when compiling on win32 windows
« on: June 12, 2014, 08:30:47 pm »
Hi,

Since today I'm experiencing trouble with compiling the source. I first encounted a compile flag error (C++11 unsupported). I then checked the 'compile for windows' page. I followed the instructions to upgrade to TDM. However, since I'm working on a win32 platform I downloaded the 32-bit TDM version instead of the 64-bit mentioned.

Then compiled again to see the following errors

Code: [Select]
-------------- Build: windows in game (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe -shared   -Wl,--dll -LZ:\_Development\Tools\TDM-MinGW\lib .objs\game\src\game\chr_shared.o .objs\game\src\game\g_actor.o .objs\game\src\game\g_ai.o .objs\game\src\game\g_ai_lua.o .objs\game\src\game\g_camera.o .objs\game\src\game\g_client.o .objs\game\src\game\g_cmds.o .objs\game\src\game\g_combat.o .objs\game\src\game\g_edicts.o .objs\game\src\game\g_events.o .objs\game\src\game\g_func.o .objs\game\src\game\g_health.o .objs\game\src\game\g_inventory.o .objs\game\src\game\g_main.o .objs\game\src\game\g_match.o .objs\game\src\game\g_mission.o .objs\game\src\game\g_morale.o .objs\game\src\game\g_move.o .objs\game\src\game\g_reaction.o .objs\game\src\game\g_round.o .objs\game\src\game\g_spawn.o .objs\game\src\game\g_stats.o .objs\game\src\game\g_svcmds.o .objs\game\src\game\g_trigger.o .objs\game\src\game\g_utils.o .objs\game\src\game\g_vis.o .objs\game\src\game\inv_shared.o .objs\game\src\game\inventory.o .objs\game\src\game\q_shared.o .objs\game\src\libs\lua\lapi.o .objs\game\src\libs\lua\lauxlib.o .objs\game\src\libs\lua\lbaselib.o .objs\game\src\libs\lua\lcode.o .objs\game\src\libs\lua\ldblib.o .objs\game\src\libs\lua\ldebug.o .objs\game\src\libs\lua\ldo.o .objs\game\src\libs\lua\ldump.o .objs\game\src\libs\lua\lfunc.o .objs\game\src\libs\lua\lgc.o .objs\game\src\libs\lua\linit.o .objs\game\src\libs\lua\liolib.o .objs\game\src\libs\lua\llex.o .objs\game\src\libs\lua\lmathlib.o .objs\game\src\libs\lua\lmem.o .objs\game\src\libs\lua\loadlib.o .objs\game\src\libs\lua\lobject.o .objs\game\src\libs\lua\lopcodes.o .objs\game\src\libs\lua\loslib.o .objs\game\src\libs\lua\lparser.o .objs\game\src\libs\lua\lstate.o .objs\game\src\libs\lua\lstring.o .objs\game\src\libs\lua\lstrlib.o .objs\game\src\libs\lua\ltable.o .objs\game\src\libs\lua\ltablib.o .objs\game\src\libs\lua\ltm.o .objs\game\src\libs\lua\lua.o .objs\game\src\libs\lua\lundump.o .objs\game\src\libs\lua\lvm.o .objs\game\src\libs\lua\lzio.o .objs\game\src\libs\lua\print.o .objs\game\src\shared\aabb.o .objs\game\src\shared\infostring.o .objs\game\src\shared\mathlib.o .objs\game\src\shared\parse.o .objs\game\src\shared\shared.o .objs\game\src\shared\utf8.o  -o ..\..\base\game.dll 
.objs\game\src\game\g_cmds.o: In function `Z15G_ClientCommandR6Player':
Z:/_Development/Projects/Ufo/ufoai/src/game/g_cmds.cpp:442: undefined reference to `_stricmp(char const*, char const*)'
Z:/_Development/Projects/Ufo/ufoai/src/game/g_cmds.cpp:444: undefined reference to `_stricmp(char const*, char const*)'
Z:/_Development/Projects/Ufo/ufoai/src/game/g_cmds.cpp:446: undefined reference to `_stricmp(char const*, char const*)'
.objs\game\src\game\g_main.o: In function `CheckNeedPass':
Z:/_Development/Projects/Ufo/ufoai/src/game/g_main.cpp:305: undefined reference to `_stricmp(char const*, char const*)'
.objs\game\src\game\g_svcmds.o: In function `Z15G_ServerCommandv':
Z:/_Development/Projects/Ufo/ufoai/src/game/g_svcmds.cpp:354: undefined reference to `_stricmp(char const*, char const*)'
.objs\game\src\game\g_svcmds.o:Z:/_Development/Projects/Ufo/ufoai/src/game/g_svcmds.cpp:356: more undefined references to `_stricmp(char const*, char const*)' follow
.objs\game\src\shared\shared.o: In function `Z9Q_stristrPKcS0_':
Z:/_Development/Projects/Ufo/ufoai/src/shared/shared.cpp:571: undefined reference to `_strnicmp(char const*, char const*, unsigned int)'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 0 second(s))
7 error(s), 0 warning(s) (0 minute(s), 0 second(s))

I traced it to the file src\shared\shared.h:

Code: [Select]
/* portable case sensitive compare */
#if defined(_WIN32)
# define Q_strcasecmp(a, b) _stricmp((a), (b))
# define Q_strncasecmp(s1, s2, n) _strnicmp((s1), (s2), (n))
#else
# define Q_strcasecmp(a, b) strcasecmp((a), (b))
# define Q_strncasecmp(s1, s2, n) strncasecmp((s1), (s2), (n))
#endif

I then checked the flags for a _WIN32 flag. It wasn't there. Added it but this didn't solved the issue. Now I'm a bit lost.
It is a linker error. I'm compiling with the correct library paths. And I cannot see the error in the define.
Code: [Select]
_stricmp is perfectly legal C.

Plz. help!

xray

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: error when compiling on win32 windows
« Reply #1 on: June 12, 2014, 08:56:43 pm »
we are currently working on upgrading to c++11 - the easiest workaround for you by now would most likely be to remove that particular flag (-std=c++11) from the codeblocks project files until we are done. then you can still use your old codeblocks setup.

Offline xray

  • Rookie
  • ***
  • Posts: 72
    • View Profile
Re: error when compiling on win32 windows
« Reply #2 on: June 12, 2014, 10:26:22 pm »
I see.

Removing the compiler flag C++11 did help. I can now compile the game.dll. Other projects however suffer from a missing ddraw.h file. I checked the old mingw compiler (version 4.5.0). That version still included the ddraw.h. The new TDM compiler (version 4.8.1) doesn't include this file anymore. I guess it has to do with dropping the support of old directx versions (7/8). I can understand that.

I guess the best thing is to wait until these issues are solved. If you need some help testing just send me a message.

xray

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: error when compiling on win32 windows
« Reply #3 on: June 13, 2014, 12:18:55 pm »
another option would be to:
git checkout 6c21df7
git branch lua-ui

and start from there.

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
Re: error when compiling on win32 windows
« Reply #4 on: June 14, 2014, 01:20:29 pm »
it should work again - if you encounter any problems, please let me know

Offline AntJam

  • Rookie
  • ***
  • Posts: 91
    • View Profile
Re: error when compiling on win32 windows
« Reply #5 on: June 14, 2014, 06:17:34 pm »
I can confirm this now works but only using the old MinGW not the TDM-GCC-64 or 32. The 64 generates compile errors and the 32 compiles fine but cannot link the exe to the libraries (at least on my system (Vista64))

EDIT..forgot to mention this tested for ufo.cbp only
« Last Edit: June 14, 2014, 06:21:18 pm by AntJam »

Offline xray

  • Rookie
  • ***
  • Posts: 72
    • View Profile
Re: error when compiling on win32 windows
« Reply #6 on: June 14, 2014, 07:16:48 pm »
Can confirm also it does not yet compile using the TDM-GCC-32. Problem here is also the libraries that are not part of the TDM-set. It generates link errors. If we want to use TDM as toolchain base, then we must have a separate package building libraries. As an alternative, the codeblocks.zip (containing C::B and the MinGW toolchain) could be updated. Actually, this one I think is the best solution