Author Topic: How do I get GCC to work with C::B?  (Read 8723 times)

Offline Panzercrisis

  • Single posting newcomer
  • *
  • Posts: 3
How do I get GCC to work with C::B?
« on: August 09, 2009, 11:31:50 pm »
That question sounds more newbish than it should.  No matter how simple of a program I try to make with Code::Blocks, no matter how closely I follow tutorials and how much I use all of the default settings, I get this error:

"firstTry - Debug" uses an invalid compiler [YOUR ANSWER IS ALREADY THERE. SEARCH THE FORUMS!]. Skipping...

firstTry is the project name, by the way.  I have noticed that compilers need to be pulled in for this program to work, but I've used the download that includes the GCC compiler.  But even that won't work, not even for the simplest C or C++ program that can be made.  What do I do about this?

Also, is there a way I can use GCC in this environment to take care of C++ code?

Offline Seronis

  • Almost regular
  • **
  • Posts: 197
Re: How do I get GCC to work with C::B?
« Reply #1 on: August 10, 2009, 01:11:42 am »
make sure you only have ONE copy of mingw installed.   And that the paths listed in

"Settings" ->  "Compiler and Debugger" -> "Global Compiler Settings" -> "Toolchain Executables"

matches what you have installed.  I personally keep all the executable paths for mingw in my system PATH variable too.  Since i always install mingw to  c:/dev/mingw  in my system path i have

C:\Dev\MinGW\bin;C:\Dev\MinGW\mingw32\bin;C:\Dev\MinGW\libexec\gcc\mingw32\4.4.0;

prefixed to the front of my PATH variable.  Though that just allows me to run gcc from the command line in addition to via C::B.  Setting toolchain correctly is all CB needs as long as there are no conflicts.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7789
    • My Best Post
Re: How do I get GCC to work with C::B?
« Reply #2 on: August 10, 2009, 04:37:26 am »
« Last Edit: August 10, 2009, 04:41:45 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Panzercrisis

  • Single posting newcomer
  • *
  • Posts: 3
Re: How do I get GCC to work with C::B?
« Reply #3 on: August 10, 2009, 11:35:30 pm »
There's a problem with that though.

I followed the advice given, and it worked the first time, so I closed C::B and left for a while.  When I came back, that same advice stopped working.  There was one other person I've noticed mentioning this in the forums and he got nothing but criticism for saying it.

But this is a real problem.  The compiler is there.  I used the auto-detect feature on the toolchain part of the IDE, and it worked one time, but now it won't work (even with the same project and code file and everything!).  What's the deal with that?

Offline Panzercrisis

  • Single posting newcomer
  • *
  • Posts: 3
Re: How do I get GCC to work with C::B?
« Reply #4 on: August 10, 2009, 11:44:17 pm »
I've been toying around with that while waiting on a reply, and I made a new project with a new name (whereas I had just been recycling the same name and path again and again).  The compiler worked again.  So to test with this project that which had gone wrong with the last, I closed C::B out, ran it again, and opened the new project.  The compiler worked again.

Strange. 

And I did look around on Google and forums before bringing this anomaly up, but again all I saw was one guy getting nothing but rebuke for mentioning roughly the same error, so this particular question is harder to locate than the original.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7789
    • My Best Post
Re: How do I get GCC to work with C::B?
« Reply #5 on: August 11, 2009, 01:21:24 am »
If you give no real info; no one can help you.
Learn to ask good questions.

What OS?
What Code::Blocks version?
What Compiler? What Version of Compiler?
Etc.
What other GCC compilers are installed on your computers? Include Cygwin and all others!
Learn to read FAQs.
Learn how to troubleshoot problems.

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

Tim S.
« Last Edit: August 11, 2009, 01:30:15 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline SlpCtrl

  • Single posting newcomer
  • *
  • Posts: 9
Re: How do I get GCC to work with C::B?
« Reply #6 on: September 05, 2009, 09:02:59 pm »
I get the same error when trying to compile a console project; when I just have a source file, it doesn't say or do anything. Gah this is fucking frustrating, as this is a fresh install of code::blocks. I've never had any trouble with code::blocks before, now I'm playing hell to get it to work out of the box.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7789
    • My Best Post
Re: How do I get GCC to work with C::B?
« Reply #7 on: September 06, 2009, 12:26:46 am »
I get the same error when trying to compile a console project; when I just have a source file, it doesn't say or do anything. Gah this is fucking frustrating, as this is a fresh install of code::blocks. I've never had any trouble with code::blocks before, now I'm playing hell to get it to work out of the box.

Yeah, it is almost as frustrating as reading posts like yours that give NO REAL INFORMATION NEEDED to help the poster.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline SlpCtrl

  • Single posting newcomer
  • *
  • Posts: 9
Re: How do I get GCC to work with C::B?
« Reply #8 on: September 06, 2009, 02:47:57 am »
I get the same error when trying to compile a console project; when I just have a source file, it doesn't say or do anything. Gah this is fucking frustrating, as this is a fresh install of code::blocks. I've never had any trouble with code::blocks before, now I'm playing hell to get it to work out of the box.

Yeah, it is almost as frustrating as reading posts like yours that give NO REAL INFORMATION NEEDED to help the poster.

Tim S.

If I could only be as helpful as you're being  :roll:.

Offline SlpCtrl

  • Single posting newcomer
  • *
  • Posts: 9
Re: How do I get GCC to work with C::B?
« Reply #9 on: September 06, 2009, 03:05:46 am »
Try this, this is what I did and it worked; I'm copying the fix directly from my thread:
 
I fixed it; what I did was I went to settings>compiler and debugger
 
selected the toolchain executables tab
 
By default (from a fresh install) the version available right now has the default folder for MinGW WRONG. It has C:/MinGW, but the actual folder where it's installed to is C:\Program Files\CodeBlocks\MinGW (for windows). I just did an auto-detect and it corrected the problem, and voila; I can now build and run.
 

Should correct your problem.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: How do I get GCC to work with C::B?
« Reply #10 on: September 06, 2009, 09:46:58 am »
If you would search the forum or google, you would surely have found the answer.

If not and you provide more or less no information, you don't need to wonder that you get answers llike Tim's.

If you don't know how to search or how to post, you are in the wrong forum here.

It's really annoying to answer all this stupid questions, that show that the poster does nothing or almost nothing to slove the problem himself, especially if the same problem was answered tons of time before.

Be aware, that we (the moderators) have to read every post in this forum and that we do this in our sparetime.
You can be glad if such silly posts don't get locked or silently deleted.

By the way:
please don't post the same question/problem in several threads.

EDIT:

I just tested C::B 8.02 release with MinGW bundled as fresh install (no C::B conf-files left):
at first start it autodetects the correct compiler-path (the one below C::B's executable folder), so no cause to blame C::B for not using the correct compiler-path.
Maybe an older install of MinGW was found at first start, that was removed later, or you first installed C::B without MinGW and you installed MinGW after C::B has written the wrong path in it's conf-file.
« Last Edit: September 06, 2009, 10:03:14 am by jens »