fegennari / 3DWorld

3D Procedural Game Engine Using OpenGL
GNU General Public License v3.0
1.15k stars 89 forks source link

defs.h(55,10): fatal error C1083: Cannot open include file: 'assimp/config.h': No such file or directory #15

Closed scott-hf closed 1 year ago

scott-hf commented 1 year ago

J:\tools\3DWorld-2222\3DWorld-master\dependencies\assimp\include\assimp\defs.h(55,10): fatal error C1083: Cannot open include file: 'assimp/config.h': No such file or directory (compiling source file src\assimp_wrap.cpp)

scott-hf commented 1 year ago

i compiled assimp via a tweaked version of the included "BUILDBINARIES_EXAMPLE.bat" in the dependencies/assimp folder moved the file to the appropriate spot and now getting: 1>LINK : fatal error LNK1181: cannot open input file 'assimp-vc140-mt.lib'

scott-hf commented 1 year ago

i tried moving and using the vc142 lib but ran into linker issues on build

fegennari commented 1 year ago

Okay, I haven't tested assimp on another Windows PC. It does look like that one header and the library are missing from git, though I'm picking them up from somewhere when I build. My guess is that they got excluded because they match some line in .gitignore. I'll have to debug this after work today. For reference, is this Win32 or x64? And what version of Visual Studio do you have?

You may be able to work around it by commenting out the "#define ENABLE_ASSIMP" on line 9 of src/assimp_wrap.cpp.

scott-hf commented 1 year ago

Release Win32

Microsoft Visual Studio Community 2022 (64-bit) - Current Version 17.3.3

scott-hf commented 1 year ago

Commenting out that line causes the error ("#define ENABLE_ASSIMP"): 1>LINK : fatal error LNK1181: cannot open input file 'assimp-vc140-mt.lib' linkage explicitly requires 'assimp-vc140-mt.lib' but not seeing that in the repo either?

fegennari commented 1 year ago

You have to remove that library from the additional libraries list in the project settings, then it should work. I definitely have that lib in my working copy, but it's not in the repo for some reason.

scott-hf commented 1 year ago

Gotchya. ok. so I removed that lib then i received the following error: 1>LINK : fatal error C1047: The object or library file 'dependencies\jpeg-9a\Release\jpeg.lib' was created by a different version of the compiler than other objects like '.\Release\simplifier.obj'; rebuild all objects and libraries with the same compiler

So i opened the jpeg9a project and compiled with vs2022. that worked. awesome

now getting this error:

1>model3d.obj : error LNK2001: unresolved external symbol "public: void __thiscall model_anim_t::get_bone_transforms(unsigned int,float)" (?get_bone_transforms@model_anim_t@@QAEXIM@Z) 1>.\Release\3DWorld.exe : fatal error LNK1120: 1 unresolved externals

fegennari commented 1 year ago

Oh, I think the model_anim_t member functions are inside the "#ifdef ENABLE_ASSIMP" block and shouldn't be. I'll have to fix that later and get back to you. I haven't tried building without assimp after adding that code.

scott-hf commented 1 year ago

ok. thank you. this repo is epic btw!

fegennari commented 1 year ago

Thanks! I've certainly spent a lot of time on the 3DWorld project.

Okay, the link error for disabling assimp should be fixed now. I moved those model_anim_t member functions outside the #ifdef ENABLE_ASSIMP block.

The missing header and library files are apparently due to a .gitignore file in the assimp project. I didn't even know that .gitignore worked recursively like that when including another git repo. I think the idea is that assimp is supposed to be compiled, rather than adding it pre-compiled to a project. I did it this way because it was quite some effort to get assimp to work in the x64 build as it didn't come with that build target, so I had to edit the project files myself. I also didn't expect the user to have to configure it themselves.

I added the missing header and library, and updated .gitignore to not ignore these. Please check to see if it works now. If so, I can close this issue. Thanks.

scott-hf commented 1 year ago

ok. thanks! after pulling the most recent changes, I was able to get it to build on release win32 with the following workaround steps:

  1. commenting out the "#define ENABLE_ASSIMP" on line 9 of src/assimp_wrap.cpp.
  2. removing 'assimp-vc140-mt.lib' as a referenced lib in project settings
  3. rebuilding jpeg-9a via the jpeg.sln
fegennari commented 1 year ago

What's the current problem with assimp? Does it work after I added those two files, or do you still get a link error? Or didn't you try that step again?

It seems like I also have to rebuild libjpeg-9a with every new version of Visual Studio. I'm not sure why. I'm working on replacing that with stb_image and hopefully can remove that dependency soon.

Thanks.

scott-hf commented 1 year ago

project still could not find 'assimp-vc140-mt.lib'

it might be worth setting up a virtualbox VM with windows and VS2022 so you can easily boot it up and test it? or i'm sure there's some awesome devops automation tools that could help for that too, assuming that it worth your time. i understand that this is not your paying job. just a couple possibilities to explore :)

thanks again!!!

fegennari commented 1 year ago

I see that only the 64-bit library was added, but I don't understand why. I commented out both lib and lib64 in .gitignore and it's still not including the 32-bit library. I can't figure out what line in the 123 lines of .gitignore is filtering that out. I can forcibly add that library with the "-f" option though. This is committed and pushed, and I see it here: https://github.com/fegennari/3DWorld/tree/master/dependencies/assimp/lib/RelWithDebInfo/assimp-vc140-mt.lib

My normal dev environment is using VS2022. The problem is that I have some of these dependencies (in particular the DLLs) installed system wide or in some other location, and it will pick up some things even if they're missing from the paths they should be in. (That makes things easier when these dependencies are used in multiple projects.) I probably need to check out a different working copy, not make any changes to the project, and test that. The problem is that this takes time and I wasn't able to fit that in last night. (Supposedly I also need to test WIN32 vs. x64 and Debug vs. Release.) The last time I went through this process was before I added assimp.

I also used to test some of this on my work laptop, but they've since tightened the security so that I can no longer do it.

fegennari commented 1 year ago

I'm tired of having to recompile the jpeg library for every version of Visual Studio. I've replaced the JPEG reading and writing (for screenshots) with stb_image and configured the MSVS project and linux makefile to no longer link against or include libjpeg. I tested both JPEG reading and writing with the Debug and Release builds, Win32 and x64, and on linux. Hopefully everything is working now!

Do you still have any problems? If everything is working now, I'll close the issue. Thanks for your help working though these issues.

scott-hf commented 1 year ago

i have yet to check but will try to over the next week or two. been busy with holidays. closing and will re-open if i have issue again.

thank you!