Author Topic: HelloWorld program failes to link  (Read 2860 times)

Offline Ancient Dragon

  • Single posting newcomer
  • *
  • Posts: 4
HelloWorld program failes to link
« on: August 28, 2009, 07:23:56 pm »
Quote
Compiling: main.cpp
Execution of 'g++.exe.lnk -Wall -fexceptions  -g     -c C:\dvlp\HelloWorld\main.cpp -o obj\Debug\main.o' in 'C:\dvlp\HelloWorld' failed.
Nothing to be done.

I just installed C::B with MiniGW compiler on 64-bit Vista Home Premium (I also have VC++ 2008 Express installed).  At first C::B produced error that it could not find the compiler.  I finally got that figured out, but now it produces the agove error.  I looked in the MiniGW bin folder and there is no program named "g++.exe.lnk".  Nor did it produce a *.o file from the *.cpp file.

Anyone know what is wrong?

« Last Edit: August 28, 2009, 07:28:01 pm by Ancient Dragon »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9496
Re: HelloWorld program failes to link
« Reply #1 on: August 28, 2009, 08:33:05 pm »
I looked in the MiniGW bin folder and there is no program named "g++.exe.lnk".
Install the GCC / G++ compiler. Just MinGW is not enough. Follow the instructions on the MinGW webpage.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6613
    • My Best Post
Re: HelloWorld program failes to link
« Reply #2 on: August 29, 2009, 12:55:45 am »
I just installed C::B with MiniGW compiler on 64-bit Vista Home Premium

NOTE: The MinGW GCC packaged with Code::Blocks 8.02 is not good enough for normal Vista; not idea about Home Edition.

What version of MinGW did you install?
Code: [Select]
gcc -v

Tim S.



C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: HelloWorld program failes to link
« Reply #3 on: August 29, 2009, 01:11:15 am »
What makes me wonder is g++.exe.lnk.
It seems your g++ in the toolchain points to a link of to g++.exe not to th executable itself.

That does not work from inside C::B !!!

Offline Ancient Dragon

  • Single posting newcomer
  • *
  • Posts: 4
Re: HelloWorld program failes to link
« Reply #4 on: August 29, 2009, 05:59:46 am »
Thanks for your comments.  I uninstalled C::B, installed MiniGW in c:\MiniGW (the default), then reinstalled C::B without MiniGW.  Tried to compiled Hello World c++ again, and it failed with the same problem as before.

Ok, I finally figured out the problem.  I had to go into the toolchain executables window and reset the compiler and linker to both use g++.exe instead of the default g++.exe.lnk. 

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: HelloWorld program failes to link
« Reply #5 on: August 29, 2009, 08:58:20 am »
Ok, I finally figured out the problem.  I had to go into the toolchain executables window and reset the compiler and linker to both use g++.exe instead of the default g++.exe.lnk. 

I never saw g++.exe.lnk as default value for the cpp-compiler the default value set by C::B is ming32-g++.exe .

So please don't blame C::B for a configuration error.

And I told you that most likely your toolchain is not set up correctly.
It would have been easier to check this before uninstalling and reinstalling C::B and MinGW.

Offline Ancient Dragon

  • Single posting newcomer
  • *
  • Posts: 4
Re: HelloWorld program failes to link
« Reply #6 on: August 30, 2009, 02:55:02 pm »

So please don't blame C::B for a configuration error.
Since I installed C::B with all defaults (location etc) there is no other reason for that to have happened other than faulty C::B installation program.  Oh well, its working now, so I'm not going to moan about that any more.  C::B developer team did an outstanding job writing that IDE :)

And I told you that most likely your toolchain is not set up correctly.
It would have been easier to check this before uninstalling and reinstalling C::B and MinGW.

Yes you are right about that one.  I had seen that several times but I thought (wrongly) that the linker would be a different program than the compiler.