Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

error LNK2001/ error LNK1120

zeppelinnt
Beginner
3,165 Views
Hi there,
I hope someone can help me.
After we updated our Fortran to Visual Studio 2010 und
Intel Fortran Compiler Professional Edition we got these two errors:

Fehler1error LNK2001: Nicht aufgelstes externes Symbol "_mainCRTStartup".D:\\FTN-Tests\\wing test\\Wing2\\LINKLAST2
Fehler2error LNK1120: 1 nicht aufgelste externe Verweise.D:\\FTN-Tests\\wing test\\Wing2\\Debug\\LAST2.exeLAST2

Sorry for the german installation ;-)

It says unresolved external links.

It seems there someting wrong with the installation but I am not sure.

Everything worked fine before.

May there is someone who has an idea?

Cheers,

Alex

0 Kudos
14 Replies
mecej4
Honored Contributor III
3,165 Views
Please report the compiler and linker command lines that, when run, produced the error messages above. Or, if the build was performed inside VisualStudio, please attach a copy of the build log file.

It appears that a number of object files, none of which contained a compiled Fortran main program, were given to the linker.

You may also check the files in the project and do a "clean and rebuild".
0 Kudos
Steven_L_Intel1
Employee
3,165 Views
Also, is this a mixed-language (Fortran and C/C++) application? If so, which language has the main program? You may need to recreate the project dependencies as explained in the compiler release notes and here.
0 Kudos
SergeyKostrov
Valued Contributor II
3,165 Views
Quoting zeppelinnt
...
It seems there someting wrong with the installation but I am not sure. Everything worked fine before.
May there is someone who has an idea?..


Hi Alex,

This is a linker error and it is not clear for me how it could be related to the update you've done. Here are
some details about startup functions:

Console Win32application uses 'main' entry-function - EntryPointSymbolis'mainCRTStartup' function
GUI Win32 applicationuses 'WinMain' entry-function - EntryPointSymbol is 'WinMainCRTStartup' function

Entry Point Symbols are defined in Project Settings in 'Linker -> Advanced -> Entry Point'.

I would also look at a Character Set option, that is aUNICODE or MBCS, because I had a similar problem in the past.

Best regards,
Sergey

0 Kudos
bernado
Beginner
3,165 Views
i have similar vf link2001/1120 errors as alex has (project working before but suddenly can't compile/link after some config setting changed)
in my project, there exist Fortran main program but still having problem to build...
fyi, here are mycompiler and linker command lines
compiler:
/nologo /fpscomp:filesfromcmd /fpscomp:ioformat /fpscomp:logicals /fpscomp:general /Qfp-speculation=safe /module:"x64\Release\" /object:"x64\Release\" /Fd"x64\Release\vc90.pdb" /libs:static /threads /c
linker:
/OUT:"x64\Release\npm64_cplex.exe" /INCREMENTAL:NO /NOLOGO /MANIFEST /MANIFESTFILE:"C:\KCWorks\UPLAN\src\models\npm64_cplex\x64\Release\npm64_cplex.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /SUBSYSTEM:CONSOLE /STACK:200000000 /ENTRY:"mainCRTStartup" /IMPLIB:"C:\KCWorks\UPLAN\src\models\npm64_cplex\x64\Release\npm64_cplex.lib"
thanks for any idea to help
0 Kudos
Steven_L_Intel1
Employee
3,165 Views
Bernardo, please show the actual error messages. I will comment that your linker setting for /STACK is way too high and will cause you problems running the program. I do not recommend going over 100MB for this, even on x64.
0 Kudos
bernado
Beginner
3,165 Views

hi steve,

i'm usingIntel Visual Fortran Composer XE 2011 Update 9 Integration for Microsoft Visual Studio* 2008, 12.1.3526.2008 on a 64bit Win7 pc

the actual error messages i got after i clicked 'rebuild solution' as following:

-----------

LINK : warning LNK4001: no object files specified; libraries used

LINK : warning LNK4068: /MACHINE not specified; defaulting to X86

LINK : LNK2001: unresolved external symbol _mainCRTStartup

fatal error LNK1120: 1 unresolved externals

-----------

i had no problem build and run the program before with the linker setting for /stack till i encountered this error few days ago (ihave a feeling the project config properties i changed may cause the errors)

by the way, should I choose the compiler selection Platform to 'x64' or 'Win32' underTools -> Options -> under Intel Visual Fortran -> Compilers" ?

thanks

0 Kudos
Steven_L_Intel1
Employee
3,165 Views
You do not use Tools > Options to select a compiler platform - that is used to select which include and library paths are used by default when you do a build in those platforms. You change the solution platform by Build > Configuration Manager, select New... as the platform and it will create an x64 platform for you.

The errors you're getting suggest that no files are being compiled.
0 Kudos
bernado
Beginner
3,165 Views
steve,
thanksfor your reply
yes, I can't even compile any source codes becausethe 'Compile' menu bar was 'disappeared' from the pull-down menu under 'Build' (now, after theBuild > Configuration Manager, there is no menu bar like 'Compile' shown)
in fact, i had no problem building my project last week andhave no idea what trap in vf config settings i triggered to make the 'Compile' menu bar disappear and then linker error happened !@#$%
i think to re-install my VF to get rid of this problem which had been bothering me few days but I will never know what causes this after installation..
0 Kudos
Steven_L_Intel1
Employee
3,165 Views
Bernardo,

I believe I know how to fix this. Follow the instructions in the fourth bullet of Step 1 in this article. Let me know if that works.
0 Kudos
bernado
Beginner
3,165 Views
hi steve,
thank u so much for the 'key' to resolve the issue, it WORKS.now, i can rebuild my project w/o problem
just can't recall when did i blank out the free/fxed format setting???
anyway, many thanks
bernado
0 Kudos
Steven_L_Intel1
Employee
3,165 Views
It is nothing you did explicitly - some customers find this happens when they install an update. We're still not sure why.
0 Kudos
SergeyKostrov
Valued Contributor II
3,165 Views
...I will comment that your linker setting for /STACK is way too high and will cause you problems running
the program.I do not recommend going over 100MB for this, even on x64...


Steve,

Ona 32-bitWindows platformfor some test-cases I useeven higher values for STACK linker option and
they work ( It doesn't matter thatthese values for a C/C++ applcation ):

...
// Case 1
//#pragma comment( linker, "/HEAP:1069547520,1069547520" )
//#pragma comment( linker, "/STACK:4194304,4194304" )

// Case 2
//#pragma comment( linker, "/HEAP:536870912,536870912" )
//#pragma comment( linker, "/STACK:536870912,536870912" )

// Case 3
//#pragma comment( linker, "/HEAP:268435456,268435456" )
//#pragma comment( linker, "/STACK:268435456,268435456" )

// Case 4
//#pragma comment( linker, "/HEAP:134217728,134217728" )
//#pragma comment( linker, "/STACK:134217728,134217728" )
...

Best regards,
Sergey

0 Kudos
Steven_L_Intel1
Employee
3,165 Views
Sergey, I didn't say higher values would not work, but I don't recommend them. If you find the need to raise the stack size higher, you should instead be looking at ways to avoid stack usage. This can mean use of allocatable rather than automatic arrays, the /heap-arrays option or eliminating the need for the compiler to create temporary array copies (this last will improve performance.)

Windows limits the stack to 1GB, even on 64-bit systems.
0 Kudos
SergeyKostrov
Valued Contributor II
3,165 Views
Hi Steve,

Quoting Steve Lionel (Intel)
Sergey, I didn't say higher values would not work, but I don't recommend them. If you find the need to raise the stack size higher, you should instead be looking at ways to avoid stack usage...

In some cases this is simply impossible:

- Case #1: When an applicationneeds to create more than256 threads (with TBB, for example )

- Case #2: Recursive algorithms ( QuickSort on huge arrays orStrassen's matrix multiplication, for example)

However, I have one case that is "in line" with your point of view: on avery compactembedded platforms
with limited memory resources a significantstack increaseis problematic.

Best regards,
Sergey
0 Kudos
Reply