[CMake] Can't compile a quite simple Fortran static library

Bill Hoffman bill.hoffman at kitware.com
Wed Aug 20 11:52:08 EDT 2008


Bill Hoffman wrote:

>>
>> CMake 2.6 successfully creates the Visual Studio project but, when I 
>> hit the build button, I get the following error message:
>>
>>
>> 1>------ Build started: Project: edgepack, Configuration: Debug Win32 
>> ------
>> 1>Compiling with Intel Fortran 9.1 C:\Arquivos de 
>> programas\Intel\Compiler\Fortran\9.1\IA32\...
>> 1>..\..\src\EdgePack\block3d.f
>> 1>libifcoremt.lib(libifcoremain.obj) : error LNK2019: unresolved 
>> external symbol _MAIN__ referenced in function _main
>> 1>block3d.exe : fatal error LNK1120: 1 unresolved externals
>> 1>
>> 1>Build log written to  
>> "file://C:\users\Renato\svn\EdgeCFD-HEAD\CMake-tests\EdgePack\Debug\BuildLog.htm" 
>>
>> 1>edgepack build failed.
>> 1>
>> 2>------ Skipped Build: Project: ALL_BUILD, Configuration: Debug Win32 
>> ------
>> 2>Project not selected to build for this solution configuration
>> ========== Build: 0 succeeded, 1 failed, 1 up-to-date, 1 skipped 
>> ==========
>>
>>
> 
> Strange, looks like it is trying to create block3d.exe.   Can you send 
> me the generated project files?
> 

OK Clinton tested this for me with an intel fortran compiler.

He found this:

1. it worked just fine with cmake 2.6.0
2. He modified the paths in the project you generated with cmake, and 
that worked fine.

So, we are unable to reproduce your problem.

Looking at the buildlog.html that you sent me, I see this:

------ Build started: Project: edgepack, Configuration: Debug|Win32 
------   Compiling with Intel Fortran 9.1 C:\Arquivos de 
programas\Intel\Compiler\Fortran\9.1\IA32\...  ifort /nologo /Zi /fpp 
/define:ASLIB /define:CMAKE_INTDIR=\&quotDebug\" /module:&quot.\Debug" 
/object:&quotedgepack.dir\Debug\\" /libs:static /threads  /extfor:f 
/Qvc8 /Qlocation,link,&quotC:\Arquivos de programas\Microsoft Visual 
Studio 8\VC\bin" 
&quotC:\users\Renato\svn\EdgeCFD-HEAD\src\EdgePack\block3d.f" 
libifcoremt.lib(libifcoremain.obj) : error LNK2019: unresolved external 
symbol _MAIN__ referenced in function _main block3d.exe : fatal error 
LNK1120: 1 unresolved externals     edgepack build failed.


So, it is building the static library edgepack, and compiling one of the 
files block3d.f, but instead of creating block3d.obj, it is trying to 
create block3d.exe.   The only thing odd I can see is: 
"/Qlocation,link,&"  It should not have link options for compiling an 
object file.  However, that does not show up in the .vfproj file at all. 
  So, it must be some global setting that you have in your visual 
stduio.   One difference is that Clinton is using Intel 10.1.

-Bill


More information about the CMake mailing list