Skip to content
This repository has been archived by the owner on Apr 17, 2022. It is now read-only.

broken compile #4492

Closed
wzdev-ci opened this issue Aug 29, 2016 · 8 comments
Closed

broken compile #4492

wzdev-ci opened this issue Aug 29, 2016 · 8 comments

Comments

@wzdev-ci
Copy link
Contributor

resolution_fixed type_bug | by alistar


recent updates do not fix all problems yet.

problem 1
1>ai.cpp(529): error C2065: 'constexpr' : undeclared identifier
1>ai.cpp(529): error C2144: syntax error : 'int' should be preceded by ';'

fix

@@ -524,11 +524,11 @@ static SDWORD targetAttackWeight(BASE_OBJECT *psTarget, BASE_OBJECT *psAttacker,
 // Find the best nearest target for a droid.
 // If extraRange is higher than zero, then this is the range it accepts for movement to target.
 // Returns integer representing target priority, -1 if failed
 int aiBestNearestTarget(DROID *psDroid, BASE_OBJECT **ppsObj, int weapon_slot, int extraRange)
 {
-	constexpr int failure = -1;
+	int failure = -1;
 	int bestMod = 0;
 	BASE_OBJECT                     *psTarget # NULL, *bestTarget NULL, *tempTarget;
 	bool				electronic = false;
 	STRUCTURE			*targetStructure;
 	WEAPON_EFFECT			weaponEffect;

problem 2
1>netplay.lib(netsocket.obj) : error LNK2001: unresolved external symbol _deflate
1>netplay.lib(netsocket.obj) : error LNK2001: unresolved external symbol _deflateEnd
1>netplay.lib(netsocket.obj) : error LNK2001: unresolved external symbol _inflate
1>netplay.lib(netsocket.obj) : error LNK2001: unresolved external symbol deflateInit
1>netplay.lib(netsocket.obj) : error LNK2001: unresolved external symbol inflateInit

fix

@@ -29,10 +29,13 @@
 
 #include <vector>
 #include <algorithm>
 #include <map>
 
+#if defined(WZ_CC_MSVC)
+# define ZLIB_WINAPI
+#endif
 #include <zlib.h>
 
 enum
 {
 	SOCK_CONNECTION,

problem 3
no understand why needs all new code?
this does not need for game to work.

fix

@@ -39,13 +39,10 @@
 #ifdef WZ_OS_MAC
 # include <CoreFoundation/CoreFoundation.h>
 # include <CoreFoundation/CFURL.h>
 # include <QuesoGLC/glc.h>
 #else
-#ifdef WZ_OS_WIN
-#define GLCAPI extern
-#endif
 # include <GL/glc.h>
 #endif
 
 static char font_family[128];
 static char font_face_regular[128];
@@ -57,167 +54,10 @@ static float font_colour[4] = {1.f, 1.f, 1.f, 1.f};
 
 static GLint _glcContext = 0;
 static GLint _glcFont_Regular = 0;
 static GLint _glcFont_Bold = 0;
 
-#ifdef WZ_OS_WIN
-namespace
-{
-	void(__stdcall *glcContextPtr)(GLint inContext);
-	void(__stdcall *glcDeleteContextPtr)(GLint inContext);
-	void(__stdcall *glcEnablePtr)(GLCenum inAttrib);
-	void(__stdcall *glcFontPtr)(GLint inFont);
-	GLint(__stdcall *glcGenFontIDPtr)();
-	void(__stdcall *glcRenderStringPtr)(const GLCchar *inString);
-	GLfloat* (__stdcall *glcGetMaxCharMetricPtr)(GLCenum inMetric,
-		GLfloat *outVec);
-	GLfloat* (__stdcall *glcGetStringMetricPtr)(GLCenum inMetric, GLfloat *outVec);
-	GLint(__stdcall *glcMeasureStringPtr)(GLboolean inMeasureChars,
-		const GLCchar *inString);
-	void(__stdcall *glcDeleteFontPtr)(GLint inFont);
-	GLfloat* (__stdcall *glcGetCharMetricPtr)(GLint inCode, GLCenum inMetric,
-		GLfloat *outVec);
-	GLfloat(__stdcall *glcGetfPtr)(GLCenum inAttrib);
-	GLint(__stdcall *glcMeasureCountedStringPtr)(GLboolean inMeasureChars,
-		GLint inCount,
-		const GLCchar *inString);
-	void(__stdcall *glcRenderStylePtr)(GLCenum inStyle);
-	void(__stdcall *glcStringTypePtr)(GLCenum inStringType);
-	GLboolean(__stdcall *glcFontFacePtr)(GLint inFont, const GLCchar *inFace);
-	GLint(__stdcall *glcNewFontFromFamilyPtr)(GLint inFont,
-		const GLCchar *inFamily);
-	GLint(__stdcall *glcGenContextPtr)();
-
-	HINSTANCE dllHandle;
-
-#define LOAD_CALLBACK(name, symbol) name = (decltype(name))GetProcAddress(dllHandle, #symbol)
-
-	void loadDLL()
-	{
-		dllHandle = LoadLibrary(L"glc32.dll");
-
-		LOAD_CALLBACK(glcContextPtr, _glcContext@4);
-		LOAD_CALLBACK(glcDeleteContextPtr, _glcDeleteContext@4);
-		LOAD_CALLBACK(glcDeleteFontPtr, _glcDeleteFont@4);
-		LOAD_CALLBACK(glcEnablePtr, _glcEnable@4);
-		LOAD_CALLBACK(glcFontPtr, _glcFont@4);
-		LOAD_CALLBACK(glcFontFacePtr, _glcFontFace@8);
-		LOAD_CALLBACK(glcGenFontIDPtr, _glcGenFontID@0);
-		LOAD_CALLBACK(glcGetMaxCharMetricPtr, _glcGetMaxCharMetric@8);
-		LOAD_CALLBACK(glcGetStringMetricPtr, _glcGetStringMetric@8);
-		LOAD_CALLBACK(glcMeasureCountedStringPtr, _glcMeasureCountedString@12);
-		LOAD_CALLBACK(glcMeasureStringPtr, _glcMeasureString@8);
-		LOAD_CALLBACK(glcNewFontFromFamilyPtr, _glcNewFontFromFamily@8);
-		LOAD_CALLBACK(glcRenderStringPtr, _glcRenderString@4);
-		LOAD_CALLBACK(glcRenderStylePtr, _glcRenderStyle@4);
-		LOAD_CALLBACK(glcStringTypePtr, _glcStringType@4);
-		LOAD_CALLBACK(glcGetCharMetricPtr, _glcGetCharMetric@12);
-		LOAD_CALLBACK(glcGetfPtr, _glcGetf@4);
-		LOAD_CALLBACK(glcGenContextPtr, _glcGenContext@0);
-	}
-}
-
-extern "C"
-{
-	void APIENTRY glcContext(GLint inContext)
-	{
-		glcContextPtr(inContext);
-	}
-
-	void APIENTRY glcDeleteContext(GLint inContext)
-	{
-		glcDeleteContextPtr(inContext);
-	}
-
-	void APIENTRY glcEnable(GLCenum inAttrib)
-	{
-		glcEnablePtr(inAttrib);
-	}
-
-	void APIENTRY glcFont(GLint inFont)
-	{
-		glcFontPtr(inFont);
-	}
-
-	GLint APIENTRY glcGenFontID(void)
-	{
-		return glcGenFontIDPtr();
-	}
-
-	void APIENTRY glcRenderString(const GLCchar *inString)
-	{
-		glcRenderStringPtr(inString);
-	}
-
-	GLfloat* APIENTRY glcGetMaxCharMetric(GLCenum inMetric,
-		GLfloat *outVec)
-	{
-		return glcGetMaxCharMetricPtr(inMetric, outVec);
-	}
-
-	GLfloat* APIENTRY glcGetStringMetric(GLCenum inMetric, GLfloat *outVec)
-	{
-		return glcGetStringMetricPtr(inMetric, outVec);
-	}
-
-	GLint APIENTRY glcMeasureString(GLboolean inMeasureChars,
-		const GLCchar *inString)
-	{
-		return glcMeasureStringPtr(inMeasureChars, inString);
-	}
-
-	void APIENTRY glcDeleteFont(GLint inFont)
-	{
-		glcDeleteFontPtr(inFont);
-	}
-
-	GLfloat* APIENTRY glcGetCharMetric(GLint inCode, GLCenum inMetric,
-		GLfloat *outVec)
-	{
-		return glcGetCharMetricPtr(inCode, inMetric, outVec);
-	}
-
-	GLfloat APIENTRY glcGetf(GLCenum inAttrib)
-	{
-		return glcGetfPtr(inAttrib);
-	}
-
-	GLint APIENTRY glcMeasureCountedString(GLboolean inMeasureChars,
-		GLint inCount,
-		const GLCchar *inString)
-	{
-		return glcMeasureCountedStringPtr(inMeasureChars, inCount, inString);
-	}
-
-	void APIENTRY glcRenderStyle(GLCenum inStyle)
-	{
-		glcRenderStylePtr(inStyle);
-	}
-
-	void APIENTRY glcStringType(GLCenum inStringType)
-	{
-		glcStringTypePtr(inStringType);
-	}
-
-	GLboolean APIENTRY glcFontFace(GLint inFont, const GLCchar *inFace)
-	{
-		return glcFontFacePtr(inFont, inFace);
-	}
-
-	GLint APIENTRY glcNewFontFromFamily(GLint inFont,
-		const GLCchar *inFamily)
-	{
-		return glcNewFontFromFamilyPtr(inFont, inFamily);
-	}
-
-	GLint APIENTRY glcGenContext()
-	{
-		return glcGenContextPtr();
-	}
-}
-#endif
-
 /***************************************************************************/
 /*
  *	Source
  */
 /***************************************************************************/
@@ -248,14 +88,10 @@ static void iV_initializeGLC(void)
 	if (_glcContext)
 	{
 		return;
 	}
 
-#ifdef WZ_OS_WIN
-	loadDLL();
-#endif
-
 	_glcContext = glcGenContext();
 	if (!_glcContext)
 	{
 		debug(LOG_ERROR, "Failed to initialize");
 	}

the above fix all issue to make game work with vs2013 and vs2015 (friend try my fixing).

thank you.


Issue migrated from trac:4492 at 2022-04-16 12:35:57 -0700

@wzdev-ci
Copy link
Contributor Author

Vincent commented


@@ -29,10 +29,13 @@

#include
#include
#include

+#if defined(WZ_CC_MSVC)
+# define ZLIB_WINAPI
+#endif
#include <zlib.h>

enum
{
SOCK_CONNECTION,

I think you're using zlib built with mingw ?
I got the same undefined references when I use a msvc built zlib.

@wzdev-ci
Copy link
Contributor Author

alistar changed _comment0 which not transferred by tractive

@wzdev-ci
Copy link
Contributor Author

alistar commented


no everything program and libraries compile self by VS2013.

need since zlib.h and we use WINAPI
Compiler, assembler, and debug options:
8: DEBUG
9: ASMV or ASMINF -- use ASM code
10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention
11: 0 (reserved)

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Sep 5, 2016

vexed changed status from new to closed

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Sep 5, 2016

vexed changed resolution from `` to fixed

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Sep 5, 2016

vexed changed blocking which not transferred by tractive

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Sep 5, 2016

vexed changed blockedby which not transferred by tractive

@wzdev-ci
Copy link
Contributor Author

wzdev-ci commented Sep 5, 2016

vexed commented


Fixed in 293ea015fcf6e29eae27f37a2471a7c6d1185a02.

Glad to see someone else uses VS :)

@wzdev-ci wzdev-ci closed this as completed Sep 5, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant