Author Topic: ld.exe invalid argument  (Read 18641 times)

Offline hadirj

  • Single posting newcomer
  • *
  • Posts: 8
ld.exe invalid argument
« on: July 31, 2009, 07:48:09 am »
Hi all

I have the latest C::B and using it in both PC and laptop(both Vista) i have no problem in my PC but in laptop when i try to compile even a "hello world" i got this error.

 
Quote
collect2: installation problem, cannot exec 'c:\Program Files\codeblocks\MinGW\bin\ld.exe' : invalid argument

[attachment deleted by admin]

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: ld.exe invalid argument
« Reply #1 on: July 31, 2009, 11:30:50 am »
Hi all

I have the latest C::B and using it in both PC and laptop(both Vista) i have no problem in my PC but in laptop when i try to compile even a "hello world" i got this error.

 
Quote
collect2: installation problem, cannot exec 'c:\Program Files\codeblocks\MinGW\bin\ld.exe' : invalid argument
Change "Settings -> Compiler and debugger... -> Global compiler settings -> [the compiler you use] -> Other settings(rightmost tab)" "Compiler logging" to "Full commandline" and post the content of the build log, that leads to this error.

Also you should provide some more information: which version of C::B do you use, which version of MinGW,

You can try to compare both C::B generated commandlines, the one that works and the one tha does not, maybe it gives you a hint.

Offline hadirj

  • Single posting newcomer
  • *
  • Posts: 8
Re: ld.exe invalid argument
« Reply #2 on: July 31, 2009, 02:22:51 pm »
Hi all

I have the latest C::B and using it in both PC and laptop(both Vista) i have no problem in my PC but in laptop when i try to compile even a "hello world" i got this error.

 
Quote
collect2: installation problem, cannot exec 'c:\Program Files\codeblocks\MinGW\bin\ld.exe' : invalid argument
Change "Settings -> Compiler and debugger... -> Global compiler settings -> [the compiler you use] -> Other settings(rightmost tab)" "Compiler logging" to "Full commandline" and post the content of the build log, that leads to this error.

Also you should provide some more information: which version of C::B do you use, which version of MinGW,

You can try to compare both C::B generated commandlines, the one that works and the one tha does not, maybe it gives you a hint.

thank for the reply here is the log

Quote
mingw32-g++.exe  -o bin\Debug\test.exe obj\Debug\main.o   

collect2: installation problem, cannot exec `C:\Program Files\CodeBlocks\MinGW\bin\ld.exe': Invalid argument

Process terminated with status 1 (0 minutes, 0 seconds)

0 errors, 0 warnings

I'm using C::B 8.02 with the default MinGW which included in the installation pack.

Offline Seronis

  • Almost regular
  • **
  • Posts: 197
Re: ld.exe invalid argument
« Reply #3 on: July 31, 2009, 05:15:29 pm »
Change "Settings -> Compiler and debugger... -> Global compiler settings -> [the compiler you use] -> Other settings(rightmost tab)" "Compiler logging" to "Full commandline" and post the content of the build log, that leads to this error.

You forgot to do this part first it appears.

Offline hadirj

  • Single posting newcomer
  • *
  • Posts: 8
Re: ld.exe invalid argument
« Reply #4 on: July 31, 2009, 08:16:53 pm »
Change "Settings -> Compiler and debugger... -> Global compiler settings -> [the compiler you use] -> Other settings(rightmost tab)" "Compiler logging" to "Full commandline" and post the content of the build log, that leads to this error.

You forgot to do this part first it appears.

seems that I don't know what is the build log! coz I did that steps and just the following line added to the error!

Quote
mingw32-g++.exe  -o bin\Debug\test.exe obj\Debug\main.o

would you pleas tell me what and where can I find the build log.

Thanks again :)

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: ld.exe invalid argument
« Reply #5 on: July 31, 2009, 08:26:27 pm »
I'm using C::B 8.02 with the default MinGW which included in the installation pack.

The default MinGW with C::B 8.02; is not Vista Compatible! Without a lot of work.

Tim S
« Last Edit: August 01, 2009, 06:53:11 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 hadirj

  • Single posting newcomer
  • *
  • Posts: 8
Re: ld.exe invalid argument
« Reply #6 on: July 31, 2009, 08:31:24 pm »
I'm using C::B 8.02 with the default MinGW which included in the installation pack.

The default MinGW with C::B 8.02; is not Vista Compatible! Without a lot of work.

Tim S

sounds like  :shock: ! then why it works fine in my PC but has problem in laptop and both have Vista (maybe different version and installed service packs!). If vista is the issue then what should I do to get MinGW works fine? Thank you!

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: ld.exe invalid argument
« Reply #7 on: July 31, 2009, 09:08:13 pm »
http://www.mingw.org/ is a place to start looking for MinGW or http://sourceforge.net/projects/mingw/.

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 hadirj

  • Single posting newcomer
  • *
  • Posts: 8
Re: ld.exe invalid argument
« Reply #8 on: August 01, 2009, 06:21:12 am »
http://www.mingw.org/ is a place to start looking for MinGW or http://sourceforge.net/projects/mingw/.

Tim S

as long it is working fine in my PC I think its not MinGw issue!

P.S: I asked my friend to test C::B in his Vista and it works fine in his PC also!

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: ld.exe invalid argument
« Reply #9 on: August 01, 2009, 06:35:27 am »
OK, then live with it not working.
Bye,
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 hadirj

  • Single posting newcomer
  • *
  • Posts: 8
Re: ld.exe invalid argument
« Reply #10 on: August 01, 2009, 06:45:44 am »
OK, then live with it not working.
Bye,
Tim S.


And if you don't know any solution let others find or suggest any!

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: ld.exe invalid argument
« Reply #11 on: August 01, 2009, 06:48:55 am »
OK, then live with it not working.
Bye,
Tim S.


And if you don't know any solution let others find or suggest any!

I told you a solution, but you do not want to try it.

Here's the hard way to fix the problem.
Edit: I am still guessing it is an MinGW Vista issue; since the version of MinGW Shipped with Code::Blocks is known to NOT work with Vista, I consider replacing it the first step.

http://wiki.codeblocks.org/index.php?title=Installing_MinGW_with_Vista

Tim S.

Note: The "mingw-vista special r3" was the first no bug version of 3.4.5 that worked with Vista

The command
Code
gcc.exe -v
Returns below for me.
Code
gcc version 3.4.5 (mingw-vista special r3)
« Last Edit: August 01, 2009, 09:28:34 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 hadirj

  • Single posting newcomer
  • *
  • Posts: 8
Re: ld.exe invalid argument
« Reply #12 on: August 01, 2009, 08:04:06 am »
You can try to compare both C::B generated commandlines, the one that works and the one tha does not, maybe it gives you a hint.

Good!

I have this in PC which works fine

Quote
mingw32-g++.exe    -c C:\Users\hadi\Documents\test.cpp -o C:\Users\hadi\Documents\test.o
mingw32-g++.exe  -o C:\Users\hadi\Documents\test.exe C:\Users\hadi\Documents\test.o   
Process terminated with status 0 (0 minutes, 0 seconds)

but in the laptop

Quote
mingw32-g++.exe  -o bin\Debug\test.exe obj\Debug\main.o   

collect2: installation problem, cannot exec `C:\Program Files\CodeBlocks\MinGW\bin\ld.exe': Invalid argument

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: ld.exe invalid argument
« Reply #13 on: August 01, 2009, 11:35:04 am »
Let me guess:
the first one (on your PC) is a standalone-file, without a project,
the second one (on the laptop) is a project you compile.

Nevertheless that should not make a different except for the file paths.

Try to make sure, you do not have any spaces in the projects and in the programs path.
If I remember right there are MinGW versions that have problems with spaces in the path.

If all that does not work, I strictly recommend to use a newer (really vista-compatible) of MinGW ad Tim stated before.

Offline hadirj

  • Single posting newcomer
  • *
  • Posts: 8
Re: ld.exe invalid argument
« Reply #14 on: August 01, 2009, 03:36:07 pm »
Let me guess:
the first one (on your PC) is a standalone-file, without a project,
the second one (on the laptop) is a project you compile.

Nevertheless that should not make a different except for the file paths.

Try to make sure, you do not have any spaces in the projects and in the programs path.
If I remember right there are MinGW versions that have problems with spaces in the path.

If all that does not work, I strictly recommend to use a newer (really vista-compatible) of MinGW ad Tim stated before.

Ok!

these is the log for the project in PC and the command still different plus there is no space in path the project path on the laptop
Quote
mingw32-g++.exe -Wall -fexceptions  -g     -c C:\Users\hadi\Documents\test\main.cpp -o obj\Debug\main.o

and this is the MinGW version which i use

Quote
gcc version 3.4.5 (mingw-vista special)

BTY I'll test it with newer MinGW(I should download the new ver, Install it and just change the path of compiler and linkers in settings--> compiler and debugger and no need to install GDB or anything else! right?)