Giter Club home page Giter Club logo

Comments (10)

Auburn avatar Auburn commented on September 22, 2024 1

That should work, you will have to use Clang++ outside of MinGW in order to be ABI compatible with the FastNoise2 libs. Alternatively you could compile FastNoise2 libs yourself for Clang on MinGW if you do want to go that route.

GCC MinGW is not supported: #69

from fastnoise2.

Auburn avatar Auburn commented on September 22, 2024 1

When using CMake with a single config generator like MinGW you need to specify -D CMAKE_BUILD_TYPE=Release at the CMake generate stage (before you build). Make sure you clear out the CMake generated build folder before switching compilers/configs

from fastnoise2.

andrewM202 avatar andrewM202 commented on September 22, 2024 1

Aaahhhh! There we go! For some reason the terrain is see-through (will have to figure that one out lol some other weird windows bug Im sure) but it does look to be generating now with the FastNoise2 noise on windows hah. Thanks so much for all the help Auburn!
image

Just for reference, I was able to build FastNoise fully like you suggested in the release mode with this command:
cmake -G "Ninja" -S . -B build -D FASTNOISE2_NOISETOOL=OFF -D FASTNOISE2_TESTS=OFF -D BUILD_SHARED_LIBS=ON -D CMAKE_CXX_COMPILER="C:/Program Files/LLVM/bin/clang++.exe" -D CMAKE_C_COMPILER="C:/Program Files/LLVM/bin/clang.exe" -D CMAKE_BUILD_TYPE=Release

I realized that libFastNoise.dll error was because I was building my project with -o app which built an app.exe with g++, but which only build an app file with clang++. So I was effectively running an old app.exe. After fixing that and rebuilding with the new DLLs it looks like it is working!

Before I close this, I wanted to ask if you would like me to create a pull request with this information on how to build for clang in the wiki. Thanks for all the help again!

from fastnoise2.

Auburn avatar Auburn commented on September 22, 2024 1

Thanks, I don't think you can PR stuff for the wiki, it's not part of the repo

from fastnoise2.

Auburn avatar Auburn commented on September 22, 2024

You should use either -lFastNoise or -lFastNoiseD (debug) not both. Your library link folder also looks wrong it should be -LC:\Users\hilfu\Desktop\Code\minecraft-opengl\dependencies\library_windows

from fastnoise2.

andrewM202 avatar andrewM202 commented on September 22, 2024

Thank-you for the input! I have gotten rid of the debug file and fixed the link library folder so it only uses backslashes now, however I seem to still be getting the same undefined reference errors. I also tried forward slashes with no luck. Here is how the command looks now:

g++ -std=c++17 -fdiagnostics-color=always -g -IC:\Users\hilfu\Desktop\Code\minecraft-opengl\dependencies\include -LC:\Users\hilfu\Desktop\Code\minecraft-opengl\dependencies\library_windows C:\Users\hilfu\Desktop\Code\minecraft-opengl\dependencies\library_windows\FastNoise.lib C:\Users\hilfu\Desktop\Code\minecraft-opengl\*.cpp C:\Users\hilfu\Desktop\Code\minecraft-opengl\glad.c -lglfw3dll -lFastNoise -o C:\Users\hilfu\Desktop\Code\minecraft-opengl\app

In case it may help I've also dropped here the full error stack as a txt file when running the command. Thank-you for your help.
full_undefined_error.txt

from fastnoise2.

Auburn avatar Auburn commented on September 22, 2024

I assume you are using minGW? I don't think MSVC compiled libs are compatible with MinGW

from fastnoise2.

andrewM202 avatar andrewM202 commented on September 22, 2024

It looks like g++ is mingw, I see that would not work then. I was mostly hoping it would because g++ worked with the MacOS clang binaries, but it seems Clang is different from ClangCL. If I switch my project to use ClangCL (with the clang++ command) that should work with the binaries highlighted below then, right? If not I was thinking maybe I should try to port my code over to visual studio since the wiki example uses that and MSVC is used by Visual Studio from what I can tell
image

from fastnoise2.

andrewM202 avatar andrewM202 commented on September 22, 2024

Thanks for the suggestion to compile on MinGW! It looks like it worked, I have some other errors in my code but I don't seem to be getting any undefined reference errors anymore, once I get my program fully working shortly and fix these seemingly unrelated errors I'll confirm it definitely worked.

I actually tried to compile the source before using the wiki, but I only noticed now by default it was compiling for Visual Studio (and thus likely for MSVC)! I used this command so it uses the GCC and G++ compilers/MinGW, and was able to get it to work for the project setup portion:

cmake -G "MinGW Makefiles" -S . -B build -D FASTNOISE2_NOISETOOL=OFF -D FASTNOISE2_TESTS=OFF -D BUILD_SHARED_LIBS=ON -D CMAKE_CXX_COMPILER="C:/Users/hilfu/Documents/mingw64/bin/g++.exe" -D CMAKE_C_COMPILER="C:/Users/hilfu/Documents/mingw64/bin/gcc.exe"

image

It may be useful to add a note to this wiki page (linked here) that you'll need to add -G "MinGW MakeFiles and the extra options for the CMAKE_CXX_COMPILER and CMAKE_C_COMPILER to compile it for mingw.

Thanks for your help again!

from fastnoise2.

andrewM202 avatar andrewM202 commented on September 22, 2024

Ah, unfortunately I misread and you are right - I got no linker errors compiling with g++ but the program crashes when ran with any FastNoise2 command that actually generates noise.

I have since tried using clang++ instead with the LLVM toolchain, and get no linker errors, but for some reason instead get this error when running program:
image

However, when compiling with clang I don't even get a libFastNoise.dll (image of resulting build files below) so not sure where that is coming from.

image

Here is also the updated command I am running to make my executable:

clang++ -std=c++17 -fdiagnostics-color=always -g -IC:\Users\hilfu\Desktop\Code\minecraft-opengl\dependencies\include -LC:\Users\hilfu\Desktop\Code\minecraft-opengl\dependencies\library_windows C:\Users\hilfu\Desktop\Code\minecraft-opengl\dependencies\library_windows\glfw3dll.lib C:\Users\hilfu\Desktop\Code\minecraft-opengl\dependencies\library_windows\FastNoiseD.lib C:\Users\hilfu\Desktop\Code\minecraft-opengl\*.cpp C:\Users\hilfu\Desktop\Code\minecraft-opengl\glad.c -lglfw3dll -lFastNoiseD -o C:\Users\hilfu\Desktop\Code\minecraft-opengl\app

On another note, for some reason when I compile the FastNoise2 source with clang I cannot get the release version only the debug version but I don't think that should matter. I might need to mess around with this a bit more to see if I can get this to work.
image

from fastnoise2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.