Author Topic: Code::Blocks not recognizing compiler  (Read 24896 times)

jon14

  • Guest
Code::Blocks not recognizing compiler
« on: June 20, 2007, 10:41:44 pm »
I've just downloaded the newest Code::Blocks with the built in GCC compiler(from this site). The installation went smoothly and I can create projects and files just fine. But I can't run them.

After building/running a file, the error at the bottom reads:
mindw32-g++.exe: installation problem, cannot exec 'cc1plus': No such file or directory

I haven't downloaded anything else or switched around any options. I'm new to this compiler so I apologize if this is a common issue.

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: Code::Blocks not recognizing compiler
« Reply #1 on: June 20, 2007, 10:48:38 pm »
Are you running Windows Vista? If so, do a search in the forum for a couple of related threads.

On an unrelated topic, the version of C::B which includes the GCC compiler is not the newest version; the nightly builds are leaps and bounds ahead.
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

jon14

  • Guest
Re: Code::Blocks not recognizing compiler
« Reply #2 on: June 21, 2007, 12:04:59 am »
Are you running Windows Vista? If so, do a search in the forum for a couple of related threads.

On an unrelated topic, the version of C::B which includes the GCC compiler is not the newest version; the nightly builds are leaps and bounds ahead.

Thanks for the reply. I've checked out the forums and found a thread that was similar to mine. Unfortunately It didn't help my situation.
I've downloaded the nightly pack from here: http://forums.codeblocks.org/index.php/topic,6226.0.html
Along with the wxWidget dll and mingw10m.dll files.
I then downloaded some more files I got from a thread on this forum(it helped the guy with the same situation). I'm referring to this: http://savefile.com/files/753051

After installing all files and opening a console project, I still get the same error when running my code.

Code
"hello - Release" uses an invalid compiler [YOUR ANSWER IS ALREADY THERE. SEARCH THE FORUMS!]. Skipping...
Nothing to be done.

Any help is greatly appreciated.

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: Code::Blocks not recognizing compiler
« Reply #3 on: June 21, 2007, 01:03:39 am »
You still need to install the MinGW/GCC compiler itself. See this page in the Code::Blocks Wiki. If you have done so and it still doesn't work, make sure that the main compiler path in the "Other settings" tab of C::B's global compiler settings is correct.
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

jon14

  • Guest
Re: Code::Blocks not recognizing compiler
« Reply #4 on: June 21, 2007, 01:39:31 am »
Yes, I have the main compiler installed. When I launch CB it picks it up and sets it as default.
Here are the menu settings I have:






Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: Code::Blocks not recognizing compiler
« Reply #5 on: June 21, 2007, 05:07:02 am »
Simple thing that needs checked. What compiler is the project using?

From memory, "Project" -> "Build Options" and verify it is using the correct compiler.

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

jon14

  • Guest
Re: Code::Blocks not recognizing compiler
« Reply #6 on: June 21, 2007, 03:00:42 pm »
Simple thing that needs checked. What compiler is the project using?

From memory, "Project" -> "Build Options" and verify it is using the correct compiler.

Tim S


Yes, it seems to be using the right one. The default compiler is set to GNU GCC.
Here's the menu:


There also seem to be 2 other compilers that share the GNU name. GNU ARM and GNU AVR. I tried switching to both, but it still gives me the same error.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: Code::Blocks not recognizing compiler
« Reply #7 on: June 21, 2007, 04:05:59 pm »
What OS are you using? XP or Vista?

Have you verified that C:\MinGW contains an bin sub-folder?

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

jon14

  • Guest
Re: Code::Blocks not recognizing compiler
« Reply #8 on: June 21, 2007, 04:28:06 pm »
What OS are you using? XP or Vista?

Have you verified that C:\MinGW contains an bin sub-folder?

Tim S

I'm running Vista. And yes, My MinGW file does have a bin folder.

Offline darthdespotism

  • Almost regular
  • **
  • Posts: 163
    • Coder's Nemesis
Re: Code::Blocks not recognizing compiler
« Reply #9 on: June 21, 2007, 05:13:19 pm »
I worked it out a few weeks ago.

First search for your cc1plus.exe and add this Directory to your %PATH% - Environment - variable.

The try to compile the Hello World example with -v and try to reconstruct the Directorys told as "not found" at the beginning of the output. Add these via -I directly to the MinGW-Settings in Codeblocks.

jon14

  • Guest
Re: Code::Blocks not recognizing compiler
« Reply #10 on: June 21, 2007, 05:46:34 pm »
I worked it out a few weeks ago.

First search for your cc1plus.exe and add this Directory to your %PATH% - Environment - variable.

The try to compile the Hello World example with -v and try to reconstruct the Directorys told as "not found" at the beginning of the output. Add these via -I directly to the MinGW-Settings in Codeblocks.

Thanks for the reply. I'm a little confused though. I found my cc1plus directory, but can't figure out where to put it.
I added the cc1p to the (Search Directories) / (Compiler) tab and also added it to the (Toolchain Exec) / (Compiler Installation Directory) and C++ compiler.
As you can see here:



I'm not sure if I did it right since it gives me the same error.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: Code::Blocks not recognizing compiler
« Reply #11 on: June 21, 2007, 05:48:47 pm »
Change you compiler installation directory to where you installed minGW.
Based on above "C:\C++\MinGW" is your installation directory.

Add "C:\C++\MinGW\libexec\gcc\mingw32\4.2.0" to "Additional Paths"

Tim S

« Last Edit: June 21, 2007, 05:52:18 pm by stahta01 »
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

jon14

  • Guest
Re: Code::Blocks not recognizing compiler
« Reply #12 on: June 21, 2007, 06:04:26 pm »
Change you compiler installation directory to where you installed minGW.
Based on above "C:\C++\MinGW" is your installation directory.

Add "C:\C++\MinGW\libexec\gcc\mingw32\4.2.0" to "Additional Paths"

Tim S



Yep, got that in there too. Still not working.

I'm on 3 days now trying to figure this out, I really appreciate all the help and do apologize for being a little annoying.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: Code::Blocks not recognizing compiler
« Reply #13 on: June 21, 2007, 06:06:22 pm »
Yep, got that in there too. Still not working.

I'm on 3 days now trying to figure this out, I really appreciate all the help and do apologize for being a little annoying.

But, has the error changed from "uses an invalid compiler [YOUR ANSWER IS ALREADY THERE. SEARCH THE FORUMS!]"?

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

jon14

  • Guest
Re: Code::Blocks not recognizing compiler
« Reply #14 on: June 21, 2007, 06:11:05 pm »
Yep, got that in there too. Still not working.

I'm on 3 days now trying to figure this out, I really appreciate all the help and do apologize for being a little annoying.

But, has the error changed from "uses an invalid compiler [YOUR ANSWER IS ALREADY THERE. SEARCH THE FORUMS!]"?

Tim S

No, it still gives me the same error.
Here's my C++ compiler directory:

Offline darthdespotism

  • Almost regular
  • **
  • Posts: 163
    • Coder's Nemesis
Re: Code::Blocks not recognizing compiler
« Reply #15 on: June 21, 2007, 07:54:33 pm »
can you post the output when you enable -v

don't forget to set the C++-Compiler back to mingw32-g++.exe

jon14

  • Guest
Re: Code::Blocks not recognizing compiler
« Reply #16 on: June 21, 2007, 08:25:37 pm »
can you post the output when you enable -v

don't forget to set the C++-Compiler back to mingw32-g++.exe

I can't seem to find the -v. Is it in the compiler settings tab? All I see is -w, -s, and a ton of others, but no -v.
I also just set the compiler back to gcc, still a no go.
« Last Edit: June 22, 2007, 02:41:52 pm by jon14 »

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: Code::Blocks not recognizing compiler
« Reply #17 on: June 22, 2007, 03:20:59 pm »
All right, let's hunt this problem down.

Are you still on the "uses an invalid compiler [YOUR ANSWER IS ALREADY THERE. SEARCH THE FORUMS!]" error? If so, do the following:
 - Open up your Global compiler settings, make sure you've selected "GNU GCC Compiler" at the top.
 - Now switch to the "Toolchain executables" tab and take a look at the "C compiler" executable under "Program Files". C::B must verify that this program exists, or it will refuse to compile and give you that error message.
 - The "C Compiler" should be set as "mingw32-gcc.exe". If it isn't, change it back.
 - That program ("mingw32-gcc.exe") should exist along with the other 7 in the "bin" subdirectory of your main MinGW installation directory. If they don't, you need to reinstall the gcc-core, gcc-g++, binutils, and gdb packages. It would probably be a good idea, in this case, to just wipe your MinGW directory and do a complete reinstall.
 - Finally, make sure that "Compiler's installation directory" (still on the "Toolchain executables" tab) points to your main MinGW installation directory -- the one containing the "bin" subdirectory with mingw32-gcc.exe and friends.

Once you've gotten the "uses an invalid compiler [YOUR ANSWER IS ALREADY THERE. SEARCH THE FORUMS!]" error fixed, leave the "Compiler's installation directory" option unchanged. Fixing the Vista-specific "cannot exec cc1plus" error may or may not require messing around with the "Additional Paths" area. I suspect the easiest fix for that is to add "<your MinGW installation directory>\libexec\gcc\mingw32\3.4.5" to Windows' PATH environment variable.

Hope that helps,
John E. / TDM
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

jon14

  • Guest
Re: Code::Blocks not recognizing compiler
« Reply #18 on: June 22, 2007, 03:42:55 pm »
All right, let's hunt this problem down.

Are you still on the "uses an invalid compiler [YOUR ANSWER IS ALREADY THERE. SEARCH THE FORUMS!]" error? If so, do the following:
 - Open up your Global compiler settings, make sure you've selected "GNU GCC Compiler" at the top.
 - Now switch to the "Toolchain executables" tab and take a look at the "C compiler" executable under "Program Files". C::B must verify that this program exists, or it will refuse to compile and give you that error message.
 - The "C Compiler" should be set as "mingw32-gcc.exe". If it isn't, change it back.
 - That program ("mingw32-gcc.exe") should exist along with the other 7 in the "bin" subdirectory of your main MinGW installation directory. If they don't, you need to reinstall the gcc-core, gcc-g++, binutils, and gdb packages. It would probably be a good idea, in this case, to just wipe your MinGW directory and do a complete reinstall.
 - Finally, make sure that "Compiler's installation directory" (still on the "Toolchain executables" tab) points to your main MinGW installation directory -- the one containing the "bin" subdirectory with mingw32-gcc.exe and friends.

Once you've gotten the "uses an invalid compiler [YOUR ANSWER IS ALREADY THERE. SEARCH THE FORUMS!]" error fixed, leave the "Compiler's installation directory" option unchanged. Fixing the Vista-specific "cannot exec cc1plus" error may or may not require messing around with the "Additional Paths" area. I suspect the easiest fix for that is to add "<your MinGW installation directory>\libexec\gcc\mingw32\3.4.5" to Windows' PATH environment variable.

Hope that helps,
John E. / TDM

Thank you for the reply.

I've recently downloaded a different compiler(Digital Mars) and did the same thing with the option settings as I did with my GCC. After I tried compiling the code, I got a different error. Instead of "invalid compiler [YOUR ANSWER IS ALREADY THERE. SEARCH THE FORUMS!]" I now get "unable to open input file 'iostream'.

[Edit] Actually, now that I've looked at this some more, the GCC compiler is still a problem. I forgot that a when setting a new compiler, you have to create a new project in order to use it. But the Mars compiler works fine now...except for the 'iostream' error.
« Last Edit: June 22, 2007, 03:49:09 pm by jon14 »

Offline darthdespotism

  • Almost regular
  • **
  • Posts: 163
    • Coder's Nemesis
Re: Code::Blocks not recognizing compiler
« Reply #19 on: June 22, 2007, 05:23:06 pm »
For g++ - Compiler.
Go to Compiler Settings -> Other Options. There might be a -fexceptions. add here the -v

I can look for mine when someone can tell me where Codeblocks saves the Configuration.

Offline Haf

  • Multiple posting newcomer
  • *
  • Posts: 12
    • Zentrum des Wahnsinns
Re: Code::Blocks not recognizing compiler
« Reply #20 on: June 24, 2007, 09:43:11 am »
Hello, I have also problems with the MinGW compiler under Vista.
Under XP my standard installation procedure works:
Download & unzip mingw-runtime (3.12), w32api, gdb, gcc-core + g++ (3.4.2) and binutils to C:\mingw\, set Gnu GCC Compiler in Codeblocks and auto-detect.

Under Vista, I received the same "cannot exec 'cc1plus': No such file or directory" error, when trying to build a project (created afterwards, default console hello world app). I just tried to set the path variable to the cc1plus directory as suggested, now I receive this error:
:: === musikRateTest, Debug ===
d:\Projekte\CPP\musikRateTest\main.cpp:1: iostream: No such file or directory
d:\Projekte\CPP\musikRateTest\main.cpp:: In function `int main()':
d:\Projekte\CPP\musikRateTest\main.cpp:7: error: `cout' undeclared (first use this function)
d:\Projekte\CPP\musikRateTest\main.cpp:7: error: (Each undeclared identifier is reported only once for each function it appears in.)
d:\Projekte\CPP\musikRateTest\main.cpp:7: error: `endl' undeclared (first use this function)
:: === Build finished: 4 errors, 0 warnings ===

I have no idea what is wrong, but I'm guessing that something in the Vista way of finding files doesn't like MingW or Code::Blocks.

Is there some (easy :)) way to fix this?

edit: Sorry, I didn't read the text above closely enough. :)

I now also added the -v option, here is the complete build log:
Quote
-------------- Build: Debug in musikRateTest ---------------
Compiling: main.cpp
Using built-in specs.
Configured with: ../gcc/configure --with-gcc --with-gnu-ld --with-gnu-as --host=mingw32 --target=mingw32 --prefix=/mingw --enable-threads --disable-nls --enable-languages=c,c++,f77,ada,objc,java --disable-win32-registry --disable-shared --enable-sjlj-exceptions --enable-libgcj --disable-java-awt --without-x --enable-java-gc=boehm --disable-libgcj-debug --enable-interpreter --enable-hash-synchronization --enable-libstdcxx-debug
Thread model: win32
gcc version 3.4.2 (mingw-special)
 cc1plus -quiet -v -IC:\MinGW\include -iprefix ../lib/gcc/mingw32/3.4.2/ d:\Projekte\CPP\musikRateTest\main.cpp -quiet -dumpbase main.cpp -auxbase-strip obj\Debug\main.o -g -Wall -version -fexceptions -o ./ccqiaaaa.s
ignoring nonexistent directory "../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2"
ignoring nonexistent directory "../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/mingw32"
ignoring nonexistent directory "../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/backward"
ignoring nonexistent directory "../lib/gcc/mingw32/3.4.2/../../../../include"
ignoring nonexistent directory "../lib/gcc/mingw32/3.4.2/include"
ignoring nonexistent directory "../lib/gcc/mingw32/3.4.2/../../../../mingw32/include"
ignoring nonexistent directory "/mingw/include/c++/3.4.2"
ignoring nonexistent directory "/mingw/include/c++/3.4.2/mingw32"
ignoring nonexistent directory "/mingw/include/c++/3.4.2/backward"
ignoring nonexistent directory "/mingw/include"
ignoring nonexistent directory "/mingw/include"
ignoring nonexistent directory "/mingw/lib/gcc/mingw32/3.4.2/include"
ignoring nonexistent directory "/mingw/mingw32/include"
ignoring nonexistent directory "/mingw/include"
#include "..." search starts here:
#include <...> search starts here:
 C:/MinGW/include
End of search list.
GNU C++ version 3.4.2 (mingw-special) (mingw32)
   compiled by GNU C version 3.4.2 (mingw-special).
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
d:\Projekte\CPP\musikRateTest\main.cpp:1:20: iostream: No such file or directory
d:\Projekte\CPP\musikRateTest\main.cpp: In function `int main()':
d:\Projekte\CPP\musikRateTest\main.cpp:7: error: `cout' undeclared (first use this function)
d:\Projekte\CPP\musikRateTest\main.cpp:7: error: (Each undeclared identifier is reported only once for each function it appears in.)
d:\Projekte\CPP\musikRateTest\main.cpp:7: error: `endl' undeclared (first use this function)
Process terminated with status 1 (0 minutes, 0 seconds)
4 errors, 0 warnings

I guess, the nonexisting directory messages point to the problem. :)
« Last Edit: June 24, 2007, 09:49:43 am by Haf »

Offline darthdespotism

  • Almost regular
  • **
  • Posts: 163
    • Coder's Nemesis
Re: Code::Blocks not recognizing compiler
« Reply #21 on: June 24, 2007, 01:15:37 pm »
Go to your Compiler-Settings.

There I added

Code
-I"C:/mingw/include/c++/3.4.2"
-I"C:/mingw/include/c++/3.4.2/mingw32"
-I"C:/mingw/include/c++/3.4.2/backward"
-I"C:/mingw/include"
-I"C:/mingw/lib/gcc/mingw32/3.4.2/include"
-I"C:/mingw/mingw32/include"

EDIT://
It seems to be imposible to build a File that is not on the same Partition as MinGW ist. try out this too
« Last Edit: June 24, 2007, 01:17:15 pm by darthdespotism »

Offline Haf

  • Multiple posting newcomer
  • *
  • Posts: 12
    • Zentrum des Wahnsinns
Re: Code::Blocks not recognizing compiler
« Reply #22 on: June 24, 2007, 01:39:57 pm »
Adding these parameters to the Compiler options brings

Quote
-------------- Build: Debug in musikRateTest ---------------
Linking console executable: bin\Debug\musikRateTest.exe
ld: crt2.o: No such file: No such file or directory
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings

So compiling runs through, linking does not.

Having the project on the same partition as MinGW works, even without those parameters!

Thanks, it's not perfect, but at least I can build now. :) That's good enough for the near future. ;)

Offline darthdespotism

  • Almost regular
  • **
  • Posts: 163
    • Coder's Nemesis
Re: Code::Blocks not recognizing compiler
« Reply #23 on: June 24, 2007, 01:48:03 pm »
please try to add a -L"C:/mingw/lib" to your Linker - Flags

Offline Haf

  • Multiple posting newcomer
  • *
  • Posts: 12
    • Zentrum des Wahnsinns
Re: Code::Blocks not recognizing compiler
« Reply #24 on: June 24, 2007, 03:30:21 pm »
Would that be in Settings -> Compiler -> Linker -> Other linker settings?

I tried to add it there, but it didn't have any effect.

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: Code::Blocks not recognizing compiler
« Reply #25 on: June 24, 2007, 04:51:33 pm »
I think you should file this as a bug, as in "having the project in a different partition as mingw doesn't work".

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Code::Blocks not recognizing compiler
« Reply #26 on: June 24, 2007, 05:09:52 pm »
I think you should file this as a bug, as in "having the project in a different partition as mingw doesn't work".

Rick, this is a known problem of mingw in vista. File a bug to us? What for?
Be patient!
This bug will be fixed soon...

Offline darthdespotism

  • Almost regular
  • **
  • Posts: 163
    • Coder's Nemesis
Re: Code::Blocks not recognizing compiler
« Reply #27 on: June 24, 2007, 05:52:17 pm »
Would that be in Settings -> Compiler -> Linker -> Other linker settings?

That's what I thought of.

Would have been nice if it worked, but as  although sayed it's a known problem

Offline Haf

  • Multiple posting newcomer
  • *
  • Posts: 12
    • Zentrum des Wahnsinns
Re: Code::Blocks not recognizing compiler
« Reply #28 on: June 24, 2007, 09:42:03 pm »
Would that be in Settings -> Compiler -> Linker -> Other linker settings?

That's what I thought of.

Would have been nice if it worked, but as  although sayed it's a known problem

Yeah, would have been nice if it worked. :)

Well, I can still have all the stuff on the same partition, it's no big problem, I guess I just have to wait for a bugfix of MingW and in the meantime make some room on C:. :)