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

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:. :)