ThakeeNathees / PixelEngine

python scripting 2d game engine written in c++
Apache License 2.0
25 stars 3 forks source link

Error running the program #5

Open AzadKshitij opened 4 years ago

AzadKshitij commented 4 years ago

When I was trying to run the program I'm getting this error 👇👇👇

1 2

My Project Structure is like this..👇👇👇

3 4 5
ThakeeNathees commented 4 years ago

The master branch is currently unstable and going through a heavy refactoring, and everything will be ported to https://github.com/ThakeeNathees/PixelEngine/tree/dev branch (a more stable and well organized)

I'll have a look at this issue, and Thanks for reporting :)

AzadKshitij commented 4 years ago

Sorry for this silly question but How can I use This branch for development of this engine and to understand the code?? 😅😅😅 https://github.com/ThakeeNathees/PixelEngine/tree/dev

ThakeeNathees commented 4 years ago

@AzadKshitij I used to write the engine in SFML before and now I've moved to OpenGL 3.3 core profile (the low level graphics api) and have write a build system with Scons

How to compile?

All you need is Scons a python based build system. To install Scons you have to run the following command

python -m pip install scons

Now run the following command to compile the engine.

C:\PixelEngine> scons platform=windows vsproj=true

From the argument vsproj=true it'll generate Visual Studio project files, argument platform is optional and will be used for cross compilation since it'll support cross platform.

Now It'll build bin/PixelEngine.exe an Opengl implementation of ImGui window. If anything goes wrong let me know.

Next?

I'll move everything from the master branch to the dev branch with cross platform/language support, well organized and clean code base.

AzadKshitij commented 4 years ago

@ThakeeNathees I have done all what you said but I ran into some error ..

C:\PixelEngine\Error\PixelEngine-dev>scons platform=windows vsproj=true scons: Reading SConscript files ... scons: done reading SConscript files. scons: Building targets ... Compiling ==> main\main.cpp main.cpp

Compiling ==> main\pe_im.cpp pe_im.cpp

Compiling ==> os\windows\crash_handler_windows.cpp crash_handler_windows.cpp Linking Static Library ==> os\bin\os.lib

Compiling ==> thirdparty\ImGui\imgui.cpp imgui.cpp

Compiling ==> thirdparty\ImGui\imgui_draw.cpp imgui_draw.cpp

Compiling ==> thirdparty\ImGui\imgui_demo.cpp imgui_demo.cpp

Compiling ==> thirdparty\ImGui\imgui_widgets.cpp imgui_widgets.cpp

Compiling ==> thirdparty\ImGui\imgui_impl_gl3_glfw\imgui_impl_glfw.cpp imgui_impl_glfw.cpp

Compiling ==> thirdparty\ImGui\imgui_impl_gl3_glfw\imgui_impl_opengl3.cpp imgui_impl_opengl3.cpp Linking Static Library ==> thirdparty\bin\thirdparty.lib

Compiling ==> thirdparty\opengl\glfw\src\context.c context.c

Compiling ==> thirdparty\opengl\glfw\src\init.c init.c

Compiling ==> thirdparty\opengl\glfw\src\input.c input.c

Compiling ==> thirdparty\opengl\glfw\src\monitor.c monitor.c

Compiling ==> thirdparty\opengl\glfw\src\vulkan.c vulkan.c

Compiling ==> thirdparty\opengl\glfw\src\window.c window.c

Compiling ==> thirdparty\opengl\glfw\src\win32_init.c win32_init.c

Compiling ==> thirdparty\opengl\glfw\src\win32_joystick.c win32_joystick.c

Compiling ==> thirdparty\opengl\glfw\src\win32_monitor.c win32_monitor.c

Compiling ==> thirdparty\opengl\glfw\src\win32_time.c win32_time.c

Compiling ==> thirdparty\opengl\glfw\src\win32_thread.c win32_thread.c

Compiling ==> thirdparty\opengl\glfw\src\win32_window.c win32_window.c

Compiling ==> thirdparty\opengl\glfw\src\wgl_context.c wgl_context.c

Compiling ==> thirdparty\opengl\glfw\src\osmesa_context.c osmesa_context.c

Compiling ==> thirdparty\opengl\glfw\src\egl_context.c egl_context.c

Linking Static Library ==> thirdparty\opengl\glfw\bin\glfw.lib

Compiling ==> thirdparty\opengl\glad\src\glad.c glad.c

**Linking Static Library ==> thirdparty\opengl\glad\bin\glad.lib Linking Program ==> bin\PixelEngine.exe link: unknown option -- S Try 'link --help' for more information. scons: * [bin\PixelEngine.exe] Error 1 scons: building terminated because of errors. `

ThakeeNathees commented 4 years ago

What compiler you're using, scons version? If you have MSVC try running MSVC from command line check cl command works. If not add C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\Hostx64\x64 (might change in your pc) to PATH variable and re-compile. I haven't configured scons to search for MSVC yet. and let me know it worked.

AzadKshitij commented 4 years ago

I'm using scons version 47.1.0 before adding cl in path I was getting 'cl' not found error after the path was set I'm getting this error. Linking Static Library ==> thirdparty\opengl\glad\bin\glad.lib Linking Program ==> bin\PixelEngine.exe link: unknown option -- S Try 'link --help' for more information. scons: *** [bin\PixelEngine.exe] Error 1 scons: building terminated because of errors.

ThakeeNathees commented 4 years ago

if you have Cygwin in your path try removing it. (related issue : https://community.intel.com/t5/Intel-Fortran-Compiler/link-problem-with-cygwin/td-p/784096) if it's not working try this and re-compile

diff --git a/SConstruct b/SConstruct
index 10497bd..b4bdfd3 100644
--- a/SConstruct
+++ b/SConstruct
@@ -98,16 +98,16 @@ elif env['platform'] == "windows":

        env.Append(CPPDEFINES=['WIN32', '_WIN32', '_WINDOWS', '_CRT_SECURE_NO_WARNINGS'])
        env.Append(CCFLAGS=['-W3', '-GR'])
-       env.Append(LINKFLAGS='-SUBSYSTEM:CONSOLE')
+       env.Append(LINKFLAGS='/SUBSYSTEM:CONSOLE')
        env.Append(LIBS=[])

        if env['target'] == 'debug':
                env.Append(CPPDEFINES=['_DEBUG'])
-               env.Append(CCFLAGS=['-EHsc', '-MDd', '-ZI'])
-               env.Append(LINKFLAGS=['-DEBUG'])
+               env.Append(CCFLAGS=['/EHsc', '/MDd', '/ZI'])
+               env.Append(LINKFLAGS=['/DEBUG'])
        else:
                env.Append(CPPDEFINES=['NDEBUG'])
-               env.Append(CCFLAGS=['-O2', '-EHsc', '-MD'])
+               env.Append(CCFLAGS=['/O2', '/EHsc', '/MD'])

 ## debug macro for all platforms
 if env['target'] == 'debug':
AzadKshitij commented 4 years ago

yeah!! it worked 😀😀😀😀