User forums > Using Code::Blocks

Cygwin GCC-4 linker options -> Progect buld options?

<< < (2/2)

xunxun:

--- Quote from: DBS on November 20, 2010, 09:47:07 am ---xunxun,

Parameters are passed to the compiler, so unix-style path should be used. 
Nevertheless, I have tried windows path: does not help.

The linker works through Project->Options->makefile, but Buid->clean does not

Should there be a way to pass the same parameters via build options.

--- End quote ---

Yea, I know your meaning, but C::B can't know the unix-style path, and the cygwin compiler can recognize the unix-path only when you are in the cygwin bash.
So if you are out of the cygwin bash, you can only use windows path.

xunxun:

--- Quote from: DBS on November 20, 2010, 09:47:07 am ---xunxun,

Parameters are passed to the compiler, so unix-style path should be used.  
Nevertheless, I have tried windows path: does not help.

The linker works through Project->Options->makefile, but Buid->clean does not

Should there be a way to pass the same parameters via build options.

--- End quote ---

Did you replace the windows style path "\" with "/"? The cygwin compiler only recognize "/".
For example, "e:\test" should be "e:/test".

DBS:
Finally, I have found a solution.  Tim's suggestion to try full compiler logging turned out to be very helpful.

In Settings->Global Compiler Settings -> Select: cygwin gcc, other settings -> Advanced Options
-> Command Tab: Link object files to console executable (I need a command-line program)
I changed the order in the linker command line template from the default:

$linker $libdirs -o $exe_output $link_objects $link_resobjects $link_options $libs

to

$linker $link_options -o $exe_output $link_objects $link_resobjects $libdirs $libs

Then I just cheated Code::Blocks by putting one of the link directories equal to this option:
-Wl,-rpath,/home/PETScSource/petsc-3.1-p5/cygwin7/lib 

As a result, the IDE compiled a linker command line that works.  Done!
 


Navigation

[0] Message Index

[*] Previous page

Go to full version