问题
I am trying to compile my Project with CMake, on one of my Computers it works perfectly (a Linux box), but the other one (Windows 7 Ultimate 64) has really problems.
I have tried multpiple generators:
MinGW (standalone and from CodeBlocks): Error message:
(Just the part that should lead to a solution)
f:/tools/codeblocks/mingw/bin/../lib/gcc/mingw32/4.4.1/../../../../mingw32/bin/ld.exe:
cannot open output file cmTryCompileExec.exe: Permission denied
collect2: ld returned 1 exit status
Visual Studio 10 Professional Error Message:
(Again only the Part that may be interesting, i have translated it from german)
CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):
The C compiler "cl" is not able to compile a simple test program.
[...]
1>ClCompile:
1> testCCompiler.c
1>LINK : fatal error LNK1104: Datei
"H:\yps_2\VISUAL\CMakeFiles\CMakeTmp\Debug\cmTryCompileExec.exe" could not be opened.
I have Searched google and SO fpr days now and i think no one had some similar Problem like me...
I would be so glad if you could help me guys!
PS: There is another Issue on SO like mine, but it is unanswered: https://stackoverflow.com/questions/7294011/permission-denied-errors-when-using-cmake
回答1:
First make sure you're computer is not infected with viruses: If any viruses modifying EXE files exist, they can be the main cause you can't write to your own EXE files. Scan your computer with an up-to-date antivirus.
Another problem can be your anti-virus trying to block EXE hijacks. If you're sure your computer is clean, try fully disabling your antivirus.
Another solutions that come to my mind are:
Try right-clicking on Code Blocks or Visual Studio and choosing
Run as Administrator
.If you are executing from Command Prompt, make sure you do it in an administrative Command Prompt.
Try putting the CMake and other related tools and also the output folder in your C:\ drive. Maybe you don't have quota or rights to access other drives?
Try disabling all services you see are useless. Maybe some service has just locked the file without using it for no good reason.
Try to dismount your H: volume and mount it again. (Either use
diskmgmt.msc
or usefsutil volume dismount H:
and explore to mount it again)
回答2:
Create the directory
H:\yps_2\VISUAL\CMakeFiles\CMakeTmp\Debug\
and make sure that you have write access.
来源:https://stackoverflow.com/questions/8643069/cmake-configure-permission-denied