简体   繁体   中英

Why can't CodeBlocks (13.12) find C:\MinGW\include?

I'm trying to build my c++ project using codeblocks but I get this error:

ld.exe cannot find C:\\MinGW\\include permission denied

I originally installed manually mingw in order to run the c++ version of eclipse, than I decided to move to codeblocks. Since it wasn't running I eliminated the first version of mingw (since codeblocks already installs it I assumed it was in conflict) and then uninstalled and reinstalled codeblocks (I restarted the pc too just to be sure). It still gave me an error, so I searched the error online and found out that codeblocks compiler doesn't like spaces and brackets in the path (codeblocks with it's own mingw folder is installed in c:\\programmi (x86) so you can see why it wasn't working) and it was suggested to move mingw to c:\\ and set the compiler's path options associated in codeblocks to the new path (suggestion found here on stackoverflow). Now it's giving me the error I wrote on top. PS:
I tried opening codeblocks in admin mode but it's still giving the error. Here's what the build log windows shows me: mingw32-g++.exe -o bin\\Debug\\TMIDIcustom.exe obj\\Debug\\tmidi.o obj\\Debug\\TMspeech.o obj\\Debug\\TMIDI.res C:\\MinGW\\include c:/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../../mingw32/bin/ld.exe: cannot find C:\\MinGW\\include: Permission denied collect2.exe: error: ld returned 1 exit status Process terminated with status 1 (0 minute(s), 1 second(s)) 1 error(s), 0 warning(s) (0 minute(s), 1 second(s)). Can anybody tell me what is going on?

Why does C:\\MinGW\\include appear in your command, as if it's a free standing file to be linked? It's actually a directory, so naturally, attempting to read it as a file will result in an error ... "permission denied" seems a perfectly reasonable possibility for such an invalid access attempt.

Why does ld.exe (the linker) even want to look in C:\\MinGW\\include anyway? Possibly because, the way it's specified in your g++ command, the compiler is identifying it as a precompiled object file to be linked, (which it is not). It is the directory which provides the standard system headers, (and possibly some extra user installed headers), for use by the compiler itself; it should contain nothing of interest to the linker. Maybe you intended it to be specified as "-IC:\\MinGW\\include"; however, that's completely redundant, as g++, (and gcc), if correctly installed, already know to search there anyway.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM