I am compiling C code using the Intel compiler. I integrated icc with visual studio 2010. I want to create an optimized executable file that will run on a Windows machine. This is a virtual machine in the cloud. I have no way to install any redistributable library on the target computer. I want to statically link all the required libraries. How can i do this?
I assume you meant icl, since you mention VS2010 / Windows (icc will be the Linux / Mac version): just select "Multi-threaded (/ MT)" under "Project Settings" → "Configuration Properties" → C / C ++ → code generation should work. This will cause both the MSVC environment and Intel runtime to be statically associated with the application.
But then it also depends on what other libraries you use, it may not work for everyone. In this case, you can check the dependencies with depend.exe (http://www.dependencywalker.com/) and copy them side by side with your .exe to the target machine.
Try adding -i-static -static-libcxato the last link.
-i-static -static-libcxa
This should lead to static linking only for intel libraries.
( -static, littleadvadv, )
-static
. (, ) . LD_LIBRARY_PATH=. . , .
LD_LIBRARY_PATH=.
EDIT: , "Windows-". UNIX, , , . , - .