Closed blurymind closed 8 years ago
You need a C++11 compiler to build the module. Your C++ compiler looks outdated and doesn't support the C++11 standard.
this http://codeforces.com/blog/entry/15667
says I need gcc-4.7 g++-4.7 and I need to run it with -std=c++11 How do I pass that argument to the scons script?
Hello,
This is more of a scons/compiler specific question. You might want to take a look here: http://stackoverflow.com/questions/13179316/how-to-tell-scons-to-use-the-c11-standard
so do I have to add this line somewhere in the sconstruct file?
env=Environment(CPPPATH='/usr/include/boost/', CPPDEFINES=[], LIBS=[], CXXFLAGS="-std=c++0x" )
I have no idea where to add it
No that is the incorrect line. Look at this one instead: http://stackoverflow.com/questions/31232955/using-scons-to-compile-c-file-with-std-c11-flag
Also please read this doc too: https://bitbucket.org/scons/scons/wiki/SConsCrashCourse
the scons script doesnt even have an env= line. It is more complicated because it builds to different targets
Sorry but I am in the middle of fixing some other bugs right now. I can definitely look at the issue for you when I get the cycles. However, this really is more of a general Godot Engine or even scons question. You might want to ask in the general Godot Engine forums how to setup your compiler for C++11 support. Depending on your platform and default compiler configuration, the C++11 environment setup might be different. Cheers
@kestrelm forwarded the question to godot's issue tracker.
Thank you kindly for the help so far! I will try to get it compiled and test the example files that you have provided.
While you are at it, if you really want to use Godot it will help you a lot if you learn a bit about the scons build system since that's how they build their engine. In the future if you want to use some other feature you will also know what to do. Cheers
So far I am mostly interested in learning gdscript. :) But I might give it a try later on.
I might be able to get it to compile with scons p=x11 CCFLAGS="-std=c++11"
will give it a try a bit later :)
it still fails to build it with that! One godot user actually had a suggestion for your code:
You don't need to enable it for the whole build, just for your module on the SCsub, something like this:
module_sources=['file1.cpp', 'file2.cpp']
env_mymodule = env.Clone() env_mymodule.Append(CXXFLAGS=['--enable-c++11', '-D_SOME_MODULE_DEFINE'])
env_mymodule.add_source_files(env.modules_sources, module_sources)
That will add the compiler flags only to your sources and not to the rest of the build. Keep in mind that not all compilers use the same flags obviously (maybe there's a scons option to enable c++11 that is more portable), the point is whatever you do to that environment won't affect the rest of the build (which means if you enable or disable the module it won't trigger a recompile of all the sources, only the ones specifically affected by your module) https://github.com/godotengine/godot/issues/4490#issuecomment-215941526
We found a solution. In order to get it to compile on godot editor - non windows version, you need to change your SCsub file of the module(https://github.com/kestrelm/Creature_Godot/blob/master/creaturegodot/SCsub) to this:
# SCsub
Import('env')
env_module = env.Clone()
env_module.Append(CPPDEFINES=['_USE_MATH_DEFINES'])
env_module.Append(CPPPATH='#modules/creaturegodot') # Added to find headers
env_module.Append(CPPPATH='#modules/creaturegodot/glm')
env_module.Append(CPPPATH='#modules/creaturegodot/gason')
env_module.Append(CXXFLAGS=['-std=c++11'])
env_module.add_source_files(env.modules_sources,"*.cpp") # just add all cpp files to the build
it should also improve the module build for windows and mac users - as the c++ flag is restricted only to the module.
If you keep the c++11 flag only to your module, you shouldn't have a problem with the rest of the headers of the engine..
one of godot devs:
It looks like issues with the module itself, you should probably take it to the upstream developer directly.
You could commit that change to master and test it if you like :) Hope this helps improve the module and helps other users!
I just updated the build scons file. Actually this probably only applies to linux, both mac and windows compilers are already C++11 compliant so that flag is not required.
Cheers
seems to work like a charm. I will test it with the other example files
I get this error: