Author Topic: How do I set where it writes the EXE?  (Read 2671 times)

Offline yarly

  • Single posting newcomer
  • *
  • Posts: 8
How do I set where it writes the EXE?
« on: July 16, 2015, 02:22:21 am »
I have these settings for my compiler.  My system is Win7 64bit, i'm using Ming64
 


I did file..new   write a C file, saved it as c:\blah\a2.c
   
I got this error in the build window

ld.exe||cannot open output file C:\Program Files (x86)\mingw-w64\i686-5.1.0-posix-dwarf-rt_v4-rev0\mingw32\bin\a2.exe Permission denied|
||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|


The file a2.exe doesn't exist  I think it can't make it 'cos it can't write to program files. 

I'd like the file written in c:\blah  which is where the .c file is  Or perhaps in another directory, not program files. Not where the gcc is.

Where do I tell code::blocker the place to put the EXE?


Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: How do I set where it writes the EXE?
« Reply #1 on: July 16, 2015, 02:36:39 am »
Try using an Code::Blocks project and post the build log if you still have issues.

http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline yarly

  • Single posting newcomer
  • *
  • Posts: 8
Re: How do I set where it writes the EXE?
« Reply #2 on: July 16, 2015, 04:55:36 am »
When I run it as a Code::Blocks project I don't have the problem

It's possible that I ran the .c file from within "program files" without realizing it.  (I was using a hard link and an administrative command prompt, so it was less obvious). It then tried to write to the same directory and failed.  That's my guess. And I guess when it's not a project, it always saves in the same directory as the source.   I thought my src file was in c:\blah but I suppose it was within "program files".  Maybe I had a file with the same name elsewhere and confused the two.

It's fine now,  whether in a project, or not in a project.  Thanks.