Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: nnarcozy on May 03, 2012, 03:24:22 pm

Title: compiler problem
Post by: nnarcozy on May 03, 2012, 03:24:22 pm
Hello,
I have just discovered C::B is a beautiful tool. I thank the authors. I am working on windows 7 with MinGW and gfortran. When I create a fortran project that contains only a main.f90 file: I come very well to compile, linker and run my program.
But in a case more complicated where I have a main file and then two files which contain a module and a dll file: it does not work.
 To compile my project with ms-dos command I put me in the directory and I type :
gfortran ok_module.f90 ok_module2.F90 ok.f90 bolsig_g.dll
this works well but not with C: B.
ld.exe||cannot find -lbolsig_g.dll|
While I have put in the section project > Build options > Linker settings > Link libraries and project > Build options > search directories > linker the file bolsig_g.dll.
More I am not sure that it tries to compile the files in good order. May he begins by ok.f90 then ok_module.f90 and finally ok_module2.f90. While it would make ok_module.f90 then ok_module2.f90 then ok.f90. How to tell the order?

Thanks a lot
Title: Re: compiler problem
Post by: stahta01 on May 03, 2012, 04:00:20 pm
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F (http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F)
Title: Re: compiler problem
Post by: nnarcozy on May 03, 2012, 04:14:33 pm
Thank you for your answer.

I put the option and i said :
gfortran.exe -LD:\ProjetFortran\r1fortran\r1fort\  -o bin\Debug\r1fort.exe obj\Debug\ok_module.o obj\Debug\dvode_f90_m.o obj\Debug\zdplaskin_m.o obj\Debug\ok.o    -lbolsig_g.dll

I don't konw why i put -lbolsig_g.dll instead of bolsig_g.dll. I try with this command line in msdos command :
gfortran.exe -LD:\ProjetFortran\r1fortran\r1fort\  -o bin\Debug\r1fort.exe obj\Debug\ok_module.o obj\Debug\dvode_f90_m.o obj\Debug\zdplaskin_m.o obj\Debug\ok.o   bolsig_g.dll
and it's working.
Title: Re: compiler problem
Post by: nnarcozy on May 03, 2012, 05:14:02 pm
Ok I have found two solutions.

Solution 1:

I have put in the section project > Build options > Linker settings > Link libraries the file bolsig_g.dll.
And I have removed the '-l' option in the Settings>compiler>global compiler settings>Gnu fortran compiler>other settings>advanced options > others > Link library.

That's works I have not enough knowledge in programing to understand why the option -l have to be removed with my bolsig_g.dll

Solution 2 :
I really don't like the 1 solution. I have found another way.
I have removed in the section project > Build options > Linker settings > Link libraries the file bolsig_g.dll.
Then in project>properties>build targets> build target files > selected file properties of bolsig_g.dll > build > uncheck the compile file box and check the link file.
Then rename the file bolsig_g.dll in bolsig_g.o and I put it in the obj/debug and obj/release folder of my project.

 
Tanks a lot

PS: To tell the order of compiling file: project>properties>build targets> build target files > selected file properties>build> you have a cursor for selected the priority of the file
Title: Re: compiler problem
Post by: MortenMacFly on May 04, 2012, 02:56:10 pm
Make use of the "fortran project" 3rd party plugin. This will help you lot!
See: http://darmar.vgtu.lt/