Cannot build using gcc
on windows.
#4350
-
Hey all, I'm trying to run a simple example inspired from the docs. I have a simple source file called
And a simple SConstruct file as follows:
When I try to build it using
If I run the same from an administrator powershell terminal I get the following error:
So my question is two fold:
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
To use gcc on windows you should pass toolset=["gcc"] to Environment. By default it tries to use msvc and thus using msvc style switches. wrt admin rights I never had such problem with gcc though I'm using msys2. |
Beta Was this translation helpful? Give feedback.
-
The two questions: (1) you don't need admin, (2) while it's trying to use the command gcc, SCons hasn't been initialized for building with gcc. Turns out on Windows, which defaults to using msvc, it's not enough to just set CC to gcc. You actually have to run the correct "tool" to get the steup right - as @loonycyborg just said while I was typing. Try this line (tools, not toolset, btw):
Not really sure how you've ended up in a place where it's trying to write in |
Beta Was this translation helpful? Give feedback.
-
Depends on what you installed. If you install msys2 with choco, that install is governed by the setting of SCons doesn't normally look at the existing PATH setting, which is why many people do what your example does, import the one from the system. But then what it finds is governed by the order of the system's PATH. This isn't really helping get you sorted out, just an explanation. |
Beta Was this translation helpful? Give feedback.
The two questions: (1) you don't need admin, (2) while it's trying to use the command gcc, SCons hasn't been initialized for building with gcc.
Turns out on Windows, which defaults to using msvc, it's not enough to just set CC to gcc. You actually have to run the correct "tool" to get the steup right - as @loonycyborg just said while I was typing. Try this line (tools, not toolset, btw):
Not really sure how you've ended up in a place where it's trying to write in
C:\windows\:
, which should fail. Maybe check your setting ofTEMP
?