GaijinEntertainment / DagorEngine

Dagor Engine and Tools source code from Gaijin Games KFT
Other
2.15k stars 268 forks source link

Errors while Compiling Source files #12

Closed Hadiiiiiiiiiiiiii closed 9 months ago

Hadiiiiiiiiiiiiii commented 9 months ago

When trying to compile prog\gameLibs\gamePhys\common\polares.cpp with LLVM i get this:

 polares-1dcf16.obj : error LNK2019: unresolved external symbol "void __cdecl sincos(float,float &,float &)" (?sincos@@YAXMAEAM0@Z) referenced in function "class Point2 __cdecl gamephys::calc_c(struct gamephys::Polares const &,float,float,float,float)" (?calc_c@gamephys@@YA?AVPoint2@@AEBUPolares@1@MMMM@Z)
polares-1dcf16.obj : error LNK2019: unresolved external symbol "float const * const math_float_zero" (?math_float_zero@@3QBMB) referenced in function "public: class Point2 __cdecl Interpolator<class eastl::fixed_vector<struct InterpolatePoint<class Point2>,8,0,class eastl::dummy_allocator> >::interpolate(float)const " (?interpolate@?$Interpolator@V?$fixed_vector@U?$InterpolatePoint@VPoint2@@@@$07$0A@Vdummy_allocator@eastl@@@eastl@@@@QEBA?AVPoint2@@M@Z)
polares-1dcf16.obj : error LNK2019: unresolved external symbol "bool __cdecl inverse44(class TMatrix4 const &,class TMatrix4 &,float &)" (?inverse44@@YA_NAEBVTMatrix4@@AEAV1@AEAM@Z) referenced in function "void __cdecl gamephys::recalc_mach_factor(struct gamephys::PolaresProps &)" (?recalc_mach_factor@gamephys@@YAXAEAUPolaresProps@1@@Z)
polares.exe : fatal error LNK1120: 3 unresolved externals
clang-cl: error: linker command failed with exit code 1120 (use -v to see invocation)

am i using the wrong compiler/version? has anyone else been able to actually edit any of the source code?

NicSavichev commented 9 months ago

am i using the wrong compiler/version? has anyone else been able to actually edit any of the source code?

What sample/tool do you build? All code is supposed to be built without problems using LLVM 15.0.7 and vc2019. Did you run make_devtools.py to construct (and download required) devtools folder? Did you have LLVM installed before running script and what version? I think script take the one LLVM is finds and doesn't check version of compiler.

praetorii commented 9 months ago

not trying to build any sample or tool, just trying to compile prog\gameLibs\gamePhys\common\polares.cpp to see the flight model polar calculations. make_devtools.py ran and installed all the devtools, had llvm 17.0.3 installed prior

Hadiiiiiiiiiiiiii commented 9 months ago

All code is supposed to be built without problems using LLVM 15.0.7 and vc2019.

with 15.0.7 installed and when trying to run the polares.cpp file this is the output im gettting now:

Hadi> & 'C:\Program Files\LLVM\bin\clang++.exe' .\polares.cpp
In file included from .\polares.cpp:1:
In file included from A:\develop\DagorEngine\prog\dagorInclude\math\dag_mathUtils.h:8:
In file included from A:\develop\DagorEngine\prog\dagorInclude\math\dag_Point2.h:8:
In file included from A:\develop\DagorEngine\prog\dagorInclude\math\dag_mathBase.h:8:
A:\develop\DagorEngine\prog\dagorInclude\supp\dag_math.h:12:10: fatal error: 'cstdlib' file not found
#include <cstdlib>
         ^~~~~~~~~
1 error generated.

What sample/tool do you build?

like what praetorii said, im not trying to bulid any tool, i just want to use the wave drag calculations in the polares.cpp file for one of my own projects, i had also already ran make_devtools.py

NicSavichev commented 9 months ago

not trying to build any sample or tool, just trying to compile prog\gameLibs\gamePhys\common\polares.cpp to see the flight model polar calculations. make_devtools.py ran and installed all the devtools, had llvm 17.0.3 installed prior

do you use jam to build this lib? just tried, both jam and jam -sPlatformSpec=clang compiles without error apparently you cannot compile with just clang++.exe' .\polares.cpp because file uses includes from DagorEngine

Hadiiiiiiiiiiiiii commented 9 months ago

just tried, both jam and jam -sPlatformSpec=clang compiles without error

sorry if this is a dumb question but how am i supposed to use any functionality of the polares.cpp now then? i understand that jam bulids a static library, but how am i supposed to use it?

NicSavichev commented 9 months ago

sorry if this is a dumb question but how am i supposed to use any functionality of the polares.cpp now then? i understand that jam bulids a static library, but how am i supposed to use it?

You are not forced to use any code of DagorEngine separately in your build environment. But if you want to use it you should understand on your own how compilation works, what headers this polares.cpp depends on and how to change copy of this file (imported to your project) so it compile. DagorEngine is framework, not a list of independent code snippets.

Hadiiiiiiiiiiiiii commented 9 months ago

thats not really an answer...? how is anyone supposed to use/change/improve any of the source code if we cant import it into an IDE?

OshidaBCF commented 9 months ago

in a small nutshell

Gaijin cannot teach you how to code in c++

They said they'll make more documentations to build and use the engine soon:tm:

Hadiiiiiiiiiiiiii commented 9 months ago

Gaijin cannot teach you how to code in c++

just trying to include the polares.h file gives so many errors

Severity    Code    Description Project File    Line    Suppression State
Error (active)  E0020   identifier "__vec4f" is undefined       A:\develop\DagorEngine\prog\dagorInclude\util\dag_safeArg.h 241 
Error (active)  E0169   expected a declaration      A:\develop\DagorEngine\prog\dagorInclude\debug\dag_fatal.h  37  
Error (active)  E0077   this declaration has no storage class or type specifier     A:\develop\DagorEngine\prog\dagorInclude\debug\dag_fatal.h  41  
Error (active)  E0065   expected a ';'      A:\develop\DagorEngine\prog\dagorInclude\debug\dag_fatal.h  41  
Error (active)  E0077   this declaration has no storage class or type specifier     A:\develop\DagorEngine\prog\dagorInclude\debug\dag_fatal.h  42  
Error (active)  E0065   expected a ';'      A:\develop\DagorEngine\prog\dagorInclude\debug\dag_fatal.h  42  
Error (active)  E0077   this declaration has no storage class or type specifier     A:\develop\DagorEngine\prog\dagorInclude\debug\dag_fatal.h  43  
Error (active)  E0065   expected a ';'      A:\develop\DagorEngine\prog\dagorInclude\debug\dag_fatal.h  43  
Error (active)  E0169   expected a declaration      A:\develop\DagorEngine\prog\dagorInclude\util\dag_globDef.h 37  
Error (active)  E0020   identifier "__vec4i" is undefined       A:\develop\DagorEngine\prog\dagorInclude\util\dag_safeArg.h 246 
Error   C2011   'DebugPrinter': 'class' type redefinition       A:\develop\DagorEngine\prog\dagorInclude\util\dag_safeArg.h 48  
Error   C2953   'DebugConverter': class template has already been defined       A:\develop\DagorEngine\prog\dagorInclude\util\dag_safeArg.h 57  
Error   C2011   'DagorSafeArg': 'struct' type redefinition      A:\develop\DagorEngine\prog\dagorInclude\util\dag_safeArg.h 82  
Error   C2588   '::!error': illegal global finalizer        A:\develop\DagorEngine\prog\dagorInclude\debug\dag_fatal.h  37  
Error   C4430   missing type specifier - int assumed. Note: C++ does not support default-int        A:\develop\DagorEngine\prog\dagorInclude\debug\dag_fatal.h  37  
Error   C2059   syntax error: ':'       A:\develop\DagorEngine\prog\dagorInclude\debug\dag_fatal.h  37  
Error   C4430   missing type specifier - int assumed. Note: C++ does not support default-int        A:\develop\DagorEngine\prog\dagorInclude\debug\dag_fatal.h  40  
Error   C2146   syntax error: missing ';' before identifier 'target'        A:\develop\DagorEngine\prog\dagorInclude\debug\dag_fatal.h  37  
Error   C2144   syntax error: 'void' should be preceded by ';'      A:\develop\DagorEngine\prog\dagorInclude\debug\dag_fatal.h  41  
Error   C4430   missing type specifier - int assumed. Note: C++ does not support default-int        A:\develop\DagorEngine\prog\dagorInclude\debug\dag_fatal.h  41  
Error   C3646   'FATAL_SUFFIX': unknown override specifier      A:\develop\DagorEngine\prog\dagorInclude\debug\dag_fatal.h  41  
Error   C2144   syntax error: 'void' should be preceded by ';'      A:\develop\DagorEngine\prog\dagorInclude\debug\dag_fatal.h  42  
Error   C4430   missing type specifier - int assumed. Note: C++ does not support default-int        A:\develop\DagorEngine\prog\dagorInclude\debug\dag_fatal.h  42  
Error   C2086   'int FATAL_PREFIX': redefinition        A:\develop\DagorEngine\prog\dagorInclude\debug\dag_fatal.h  42  
Error   C3646   'FATAL_SUFFIX': unknown override specifier      A:\develop\DagorEngine\prog\dagorInclude\debug\dag_fatal.h  42  
Error   C2144   syntax error: 'void' should be preceded by ';'      A:\develop\DagorEngine\prog\dagorInclude\debug\dag_fatal.h  43  
Error   C4430   missing type specifier - int assumed. Note: C++ does not support default-int        A:\develop\DagorEngine\prog\dagorInclude\debug\dag_fatal.h  43  
Error   C2086   'int FATAL_PREFIX': redefinition        A:\develop\DagorEngine\prog\dagorInclude\debug\dag_fatal.h  43  
Error   C3646   'FATAL_SUFFIX': unknown override specifier      A:\develop\DagorEngine\prog\dagorInclude\debug\dag_fatal.h  43  
Error   C2588   '::!error': illegal global finalizer        A:\develop\DagorEngine\prog\dagorInclude\util\dag_globDef.h 37  
Error   C4430   missing type specifier - int assumed. Note: C++ does not support default-int        A:\develop\DagorEngine\prog\dagorInclude\util\dag_globDef.h 37  
Error   C2086   'int error': redefinition       A:\develop\DagorEngine\prog\dagorInclude\util\dag_globDef.h 37  
Error   C2059   syntax error: ':'       A:\develop\DagorEngine\prog\dagorInclude\util\dag_globDef.h 37  
Error   C4430   missing type specifier - int assumed. Note: C++ does not support default-int        A:\develop\DagorEngine\prog\dagorInclude\util\dag_globDef.h 41  
Error   C2086   'int undefined': redefinition       A:\develop\DagorEngine\prog\dagorInclude\util\dag_globDef.h 37  
Error   C2146   syntax error: missing ';' before identifier 'target'        A:\develop\DagorEngine\prog\dagorInclude\util\dag_globDef.h 37  
Error   C2143   syntax error: missing ';' before '{'        A:\develop\DagorEngine\prog\dagorInclude\util\dag_globDef.h 90  
Error   C2447   '{': missing function header (old-style formal list?)       A:\develop\DagorEngine\prog\dagorInclude\util\dag_globDef.h 90  
Error   C3861   'min': identifier not found     A:\develop\DagorEngine\prog\dagorInclude\util\dag_globDef.h 99  
Error   C2664   'Point2 min(const Point2 &,const Point2 &)': cannot convert argument 1 from 'const real' to 'const Point2 &'        A:\develop\DagorEngine\prog\dagorInclude\math\dag_Point2.h  154 
Error   C2664   'Point2 min(const Point2 &,const Point2 &)': cannot convert argument 1 from 'const real' to 'const Point2 &'        A:\develop\DagorEngine\prog\dagorInclude\math\dag_Point2.h  154 

and yes it is using LLVM 15.04 and i have vc 2019

OshidaBCF commented 9 months ago

Part of the course when doing anything in c++

You can't include "just" polares.h, you also need to included EVERYTHING that is included in polares, this include files but also definitions that might happen somewhere that isn't included in polared but is in the file that is including polares.

i too wish it was that simple

for now it's probably better to wait for the devs to put a big documentation that'll explain everythin.

NicSavichev commented 9 months ago

Gaijin cannot teach you how to code in c++

just trying to include the polares.h file gives so many errors

Severity Code Description Project File Line Suppression State Error (active) E0020 identifier "__vec4f" is undefined A:\develop\DagorEngine\prog\dagorInclude\util\dag_safeArg.h 241 and yes it is using LLVM 15.04 and i have vc 2019

It seems you didn't define _TARGET_SIMD_SSE Refer to prog/_jBuild/win32/vc15-sets.jam (e.g.) to see macros it defines (and they are needed to compile engine)

local _DEF_C_CMDLINE =
  -X /D_TARGET_PC=1 -D_TARGET_PC_WIN=1 -D_TARGET_CPU_IA32=1 /D__IA32__=1 /DWIN32 /Dasm=__asm /DWIN32_LEAN_AND_MEAN= /D_USE_MATH_DEFINES
  -D_TARGET_SIMD_SSE=$(SSEVersion) -D_ALLOW_KEYWORD_MACROS=