Author Topic: "filename - Debug" uses an invalid compiler [YOUR ANSWER IS ALREADY THERE. SEARCH THE FORUMS!]....."  (Read 21686 times)

Offline flubberknuckle

  • Single posting newcomer
  • *
  • Posts: 2
I'm having a problem with compiling any code with codeblocks. I think I may have caused it when I deleted a bunch of my programs, but every step I take to fix it has failed. Here's what happened.

After uninstalling many of my computer's programs (not including codeblocks), I suddenly found that I could no longer compile projects which I could compile just hours before. When I tried to build and run those projects, I would receive this message-

"attacktest - Debug" uses an invalid compiler [YOUR ANSWER IS ALREADY THERE. SEARCH THE FORUMS!]. Probably the toolchain path within the compiler options is not setup correctly?! Skipping...
Nothing to be done.

-in the build log, after which the code would not initiate. When I tried to compile other older projects or even brand new projects just created I would still receive the same message.

 After a while of this, I uninstalled codeblocks and reinstalled it, but even that did not solve the problem. I'm afraid I may have accidentally erased the compiler, but I don't know how I might have been foolish enough to do that.

Help, please! I'm currently with a team developing a game and this problem has happened at what is literally the worst possible time!

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
The biggest problem is that you did not search for an answer. The problem you are getting is perhaps the most common one people get, specially newbies. All moderators and some users are quite pissed already having to read over and over the same question. Instead of an answer, all of you receive is a very unkind welcome to the forums because you did not follow the rules (search before posting + provide relevant information).

Just try searching for "uses an invalid compiler [YOUR ANSWER IS ALREADY THERE. SEARCH THE FORUMS!]" and you will see what I am talking about. I get 8 pages of the same thing. People asking over and over and over again (I even think that many of those questions were deleted). 8 pages of that have become noise in the forums, and those few who search will have to go through many posts before they can reach the answer.

I have already said here that the error message that Code::Blocks shows to the user is vague, and, specially, confusing to new users. The message has been changed in an attempt to make it clearer, but I still believe it is not clear enough.

Guide to an answer:

The message says that there is a chance that something is not correctly configured in the compiler options: the toolchain path. If you go to the compiler options there is a tab somewhere with the paths and names of the tools that make up for the whole compiler suite. You must check that the path is correct, that it points to an existent location, and that the names of the compiler tools name executables in the bin folder of that path.

You said you uninstalled programs, so there is a chance that the path to the compiler is no longer valid. Maybe it was pointing to an old compiler you just deleted, or something.

Please, check that information, try again, and report back what was wrong (what was the path before, what it should be, was a tool name not found, ...).

Also, please, do search before posting (as a general rule here and everywhere else).

Offline flubberknuckle

  • Single posting newcomer
  • *
  • Posts: 2
Problem resolved. Thank you, Ceniza, for putting up with me, and sorry for being a newbie. The problem was as you said; codeblocks was using my old compiler.

When I went to Settings > Compiler and debugger > Toolchain executables, I saw that the compiler directory was set to Dev-Cpp, which was definitely not the right one. Somehow I changed the directory when I uninstalled Dev C++.

Anyway, I clicked auto detect and voila, fixed. Thanks again.


Offline eb

  • Multiple posting newcomer
  • *
  • Posts: 46
So I've come up with the same problem.
I go to the Toolchain executables tab and hit autodetect which sets the directory to a MinGW directory (C:\Program Files (x86)\CodeBlocks\MinGW) which contains a bin directry which contains all of the files listed beneath (mingw32-gcc.exe, ar.exe,...).
I've added bin to the "Compiler's installation directory" path.
I've downloaded the GCC compiler (http://sourceforge.net/projects/tdm-gcc/files/TDM-GCC%20Installer/tdm64-gcc-4.5.1.exe/download) and installed it in a different location and pointed "Compiler's installation directory" to the new location.
I've tried adding the bin directory to the new path.
I've entered the full path name for each program in the Program Files tab and removed the "Compiler's installation directory" entry.
I've hit "Reset defaults".
I've rebooted.

None of these worked, I still get the 'Debug" uses an invalid compiler [YOUR ANSWER IS ALREADY THERE. SEARCH THE FORUMS!].' error message.
OS-Windows XP Pro 64-bit 2003 sp2
C::B 10.05 downloaded today.


Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
@eb:

Please state the Compiler Name and version of the Compiler used for the following questions?
Please state the full path to the Compiler?
Please state the path you tried in Code::Blocks?
Note: Code::Blocks adds the bin folder to the path you set; so, do NOT have the bin folder in the tool chain path.

Tim S.
« Last Edit: December 28, 2010, 05:01:10 am 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

Offline eb

  • Multiple posting newcomer
  • *
  • Posts: 46
compiler: 
Not sure of the name and version but the name of the installer is "tdm-mingw-1.908.0-4.4.1-2.exe".

Path of the compiler:
Not sure about this either but mingw32-g++.exe (the GNU GCC Compiler I assume) and all the other files listed under the Program Files tab under the Toolchain Executables tab are located in "C:\Program Files (x86)\CodeBlocks\MinGW\bin\" according to Windows Explorer (as opposed to where C::B is theoretically looking).

Path I tried in Code::Blocks:
The Compiler's installation directory is set to "C:\Program Files (x86)\CodeBlocks\MinGW"

Offline eb

  • Multiple posting newcomer
  • *
  • Posts: 46

I don't know if this helps but when I place the cursor at the end of main.cpp (the program that was created upon installation) and hit the "Run to cursor" icon I get this error message:

Build succeeded
Selecting target:
Debug
ERROR: You need to specify a debugger program in the compiler's settings.
(For MinGW compilers, it's 'gdb.exe' (without the quotes))
(For MSVC compilers, it's 'cdb.exe' (without the quotes))

[Settings][Compiler and debugger...][GNU GCC Compiler][Toolchain executables][Debuggeer:] = gdb.exe
"C:\Program Files (x86)\CodeBlocks\MinGW\bin\gdb.exe" is there.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
@eb:

So, it is NOW compiling; but, debugger is not working.
I can not help with debugger; I never use it.

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 eb

  • Multiple posting newcomer
  • *
  • Posts: 46
It's not doing anything.  It simply says "Nothing to be done".  No window opens saying "Hello World!"

Offline eb

  • Multiple posting newcomer
  • *
  • Posts: 46
"Build Succeeded"
Does this mean that it works?
Does it create a .exe file somewhere that I can run?  Because when I hit the run button it opens a window entitled "Information" which says "It seems that this project has not been built yet. Do you want to build it now? [Yes][No][Cancel].
This is AFTER I receive the above "Build Succeeded" message.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Turn ON Full Compiler Logging and post full Rebuild Log; Note: This means do a Rebuild and Post "Build Log" NOT "build Messages".

http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F

Tim S.
« Last Edit: December 28, 2010, 11:47:45 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

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Things to try:
1. Open a cmd.exe
2. cd to the folder with the compiler
3. execute g++ --version
4. execute gdb --version

If that works check if the path is the same in the C::B's settings.

It is obvious that C::B can't find you compiler, nor your debugger (gdb.exe)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline eb

  • Multiple posting newcomer
  • *
  • Posts: 46
Ein minuten bitte!!!

I have been opening this project via [File][Recent projects] and I just noticed that even though I did a [Save project as...] to a new location it was still looking at/for main.cpp in it's original location.  So instead I double-clicked (opened) main.cpp in it's new (current) location and BADDA-BING it works: no errors and I get the window.

If you got an explanation about what you think I did wrong I'd love to hear it.
If not then thanks for baby sitting me through this.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Can you reproduce it again?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline eb

  • Multiple posting newcomer
  • *
  • Posts: 46
Yes. 
I closed C::B,
I started C::B,
I go [File][Recent Project]
I select what is now the only project in the list.
I click on Sources under Projects in the Management window.
I double click main.cpp and get the main.cpp with the code to the right.
Then I click on the 'Build and run' icon and it throws the error message - "second - Debug" uses an invalid compiler [YOUR ANSWER IS ALREADY THERE. SEARCH THE FORUMS!]. Probably the toolchain path within the compiler options is not setup correctly?! Skipping...
Nothing to be done.
I right click on main.cpp in the Management window to check Properties and main.cpp is in the proper (new) location.  The same for the project under [File][Recent Project].  And it's still the same if I start C::B by double clicking project's icon in Windows Explorer.

HOWEVER if I start C::B by double clicking the main.cpp icon in Windows Explorer and click on the "Build and run" icon it works.

Of course now there is a main.exe file that opens a DOS window and says "Hello World" (among other things) but closes before I hit a keyboard button.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
If you can build and run your cpp-file as single file, your default compiler is okay.
If it does not work from inside the project, your projects compiler settings are wrong.
Check wherther you have chosen the correct compiler (for the project and the build targets) in "Project -> Build options".