News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

compiler problem

Started by nnarcozy, May 03, 2012, 03:24:22 PM

Previous topic - Next topic

nnarcozy

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

stahta01

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

nnarcozy

#2
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.

nnarcozy

#3
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

MortenMacFly

Make use of the "fortran project" 3rd party plugin. This will help you lot!
See: http://darmar.vgtu.lt/
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]