'Custom Modules in C++' walkthrough not for Windows?

OzzOzz Posts: 5Member
edited August 26 in Programming

Hi, I am trying to write my own terrain generator in C++ and was able to get halfway through the walkthrough called Custom Modules in C++. I was able to add a C++ module to my project and get it to run. But halfway down the walkthrough in the section 'Improving the build system for developement' I ran into an issue. I could be wrong, but appears to me the next section is written entirely for Linux. Is this the case?

And if follows by talking about environment variables and it looks like a linux prompt. I'm not sure. Not super familiar with linux.

I can't seem to get it to work on Windows 10. If I need other code in my SCsub file, what is it please?

Answers

  • MegalomaniakMegalomaniak Posts: 1,669Admin
    edited August 26

    .so is a shared object, in windows the equivalent would be a .dll. x11 is short for the x windowing system, rather than being linux specific these are unix in general and as you may already have realized windows has it's respectives too.

    Scons is a cross platform build environment, so the comments mentioning some unix examples shouldn't be an issue, I'd expect. Now the terminal commands bit is a different story and is indeed posix(portable operating system interface) in style. If you are using msys2/cygwin or rather mingw(minimal gnu for windows), it should already feature the missing pieces so as to turn your windows installation posix compliant. That should include a bash/terminal emulator.

    That is to say those unix formated commands should work perfectly well in there, though I wouldn't be surprised if they worked in power-shell as well. Just make sure your paths are correct. In fact you should start by checking if it didn't already work and generate your dynamic linked library(.dll).

  • OzzOzz Posts: 5Member
    edited August 26

    Thanks for the answer, but it doesn't seem to solve my problem. After I changed my SCsub file to the one above, it would not recompile. Here are photos of the error. I highlighted the points of interest. Does this mean that no .dll is getting created? I cannot find one.


    Here is what my SCsub file looks like:

    Can you tell me what's wrong with it please? Am I supposed to change the two places where it says '#bin' to something else?

  • MegalomaniakMegalomaniak Posts: 1,669Admin

    I suspect it might be that you have some dependencies for your terrain that are perhaps still missing from there, but as it's been a long time since I last did anything with C/C++, I feel like it's best to ping someone better fit to offer further thoughts and analysis perhaps. @Calinou hope you don't mind, perhaps you can be of more help.

  • MegalomaniakMegalomaniak Posts: 1,669Admin

    In case you figured out the issue could you post the solution here too and then mark the post as an answer? This way someone else running into this could find the solution too. ;)

  • OzzOzz Posts: 5Member

    Sure. I am still working by recompiling Godot every time I do a code change, which is super slow, but if I figure out how to link a library I will for sure. I still have not solved this problem.

  • YoricYoric Posts: 2Member

    String 'module_env.Append(CCFLAGS=['-fPIC']) # Needed to compile shared library' is 100% gcc specific and you are using msvc. You either never compiled module as DLL , or not provided path to linker.
    /LIBPATH flag is your analog to LD_LIBRARY_PATH variable.
    https://docs.microsoft.com/en-us/cpp/build/reference/libpath-additional-libpath?view=vs-2019
    Have no idea about flags to compile shared library with msvc.
    You can use MinGW, then only correct way to set environment variable LD_LIBRARY_PATH for your shell needed.

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file