I'm struggling with the importation of C++ (2017) dlls in Matlab (2019a).
In particular, since I'm not familiar with C++, I tried to create the MathLibrary defined in https://github.com/MicrosoftDocs/cpp-docs/blob/master/docs/build/walkthrough-creating-and-using-a-dynamic-link-library-cpp.md.
I created the library according to the guide, compiled both Debug and Release (x86), and the import with the MathClient described works fine.
However, I tried to import the library in Matlab (after adding the needed folders to the current path) with:
if libisloaded('MathLibrary') == 0
handle = loadlibrary('MathLibrary.dll','MathLibrary.h');
end
and it throws a tons of errors:
Warning: Message from C preprocessor:
cl : command line warning D9027: source file 'C:\Users\miche\source\repos\MathLibrary\Release\MathLibrary.lib' ignored
cl : command line warning D9021 : no operation performed
> In loadlibrary
Error loading library intermediate output follows.
The actual error is at the end of this output.
*********
Unescaped left brace in regex is deprecated here (and will be fatal in Perl 5.30), passed through in regex; marked by <-- HERE in m/struct([^;,{(]*){ <-- HERE (.*?)\}([^;])*;/ at D:\Program Files\MATLAB\R2019a\toolbox\matlab\general\private\prototypes.pl line 912.
Warning no reference to header 'MathLibrary' added with addheader was found in source.
*********
Error using loadlibrary
Building MathLibrary_thunk_pcwin64 failed. Compiler output is:
cl -I"D:\Program Files\MATLAB\R2019a\extern\include" /Zp8 /W3
/nologo -I"D:\Program Files\MATLAB\R2019a\bin"
-I"C:\Users\user\source\repos\MathLibrary\Release"
"MathLibrary_thunk_pcwin64.c" -LD
-Fe"MathLibrary_thunk_pcwin64.dll"
MathLibrary_thunk_pcwin64.c
C:\Users\miche\source\repos\MathLibrary\Release\MathLibrary.lib(1):
error C2059: syntax error: '!'
C:\Users\miche\source\repos\MathLibrary\Release\MathLibrary.lib(2):
error C2018: character '0x60' unknown
and then it just goes on like this, with a lot of character errors.
What is wrong with my code? How do I solve this?
Related
I am struggling my way through making daal work in my project, and have now come across the following error - I am struggling to make any sense of it and not quite sure where to even start with debugging.
I am trying to replicate this website's code: https://www.codeproject.com/Articles/1151606/Lightning-Fast-R-Machine-Learning-Algorithms but in Windows 10, and have the following software (exactly as per the website):
Intel DAAL 2017 Beta update 1
R version 3.3.1 (Bug in Your Hair)
Rcpp package version 0.12.5
Inline package version 0.3.14
e1071 package version 1.6-7
I have done the following:
copied the daal packages from C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\daal\include into the Include for R
followed the instructions in https://software.intel.com/en-us/get-started-with-daal-for-windows
The following is the error I am getting - please help me someone as I am struggling!
file473877c213b9.cpp: In function 'SEXPREC* file473877c213b9(SEXP, SEXP)':
file473877c213b9.cpp:37:49: error: incomplete universal character name \U
std::string fname = Rcpp::as<std::string>(-"C:\Users\Documents\BAJAJ.csv");
^
file473877c213b9.cpp:37:49: warning: unknown escape sequence: '\D'
file473877c213b9.cpp:37:49: warning: unknown escape sequence: '\B'
file473877c213b9.cpp:37:49: error: wrong type argument to unary minus
file473877c213b9.cpp:38:29: error: no matching function for call to 'as(int)'
int k = Rcpp::as<int>(7);
---------------------------------------------------------------------------------
make: *** [file473877c213b9.o] Error 1
Warning message:
running command 'make -f "C:/R/R-33~1.1/etc/x64/Makeconf" -f "C:/R/R-33~1.1/share/make/winshlib.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="file473877c213b9.dll" WIN=64 TCLBIN=64 OBJECTS="file473877c213b9.o"' had status 2
---------------------------------------------------------------------------------
Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! In file included from file3f9022477144.cpp:3:0:
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\daal\include\daal.h:25:0: warning: ignoring #pragma warning [-Wunknown-pragmas]
#pragma warning(disable:809)
^
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\daal\include\daal.h:38:0: warning: ignoring #pragma comment [-Wunknown-pragmas]
#pragma comment(lib, "tbb.lib" )
^
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\daal\include\daal.h:39:0: warning: ignoring #pragma comment [-Wunknown-pragmas]
#pragma comment(lib, "tbbmalloc.lib" )
^
In file included from C:/R/R-33~1.1/include/data_management/data/data_dictionary.h:35:0,
from C:/R/R-33~1.1/include/data_management/data_source/data_source.h:33,
from C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\daal\in
In addition: Warning message:
running command 'C:/R/R-33~1.1/bin/x64/R CMD SHLIB file3f9022477144.cpp 2> file3f9022477144.cpp.err.txt' had status 1
Many thanks in advance for any help anyone can provide (i'm not a coder so am struggling!)
Keyur
edit 21 July 2018 - excerpts of my code to provide further details
library(Rcpp)
library(inline)
# Create and register a Rcpp plugin
plug <- Rcpp:::Rcpp.plugin.maker(
include.before = "#include <C:\\Program Files (x86)\\IntelSWTools\\compilers_and_libraries_2017.1.143\\windows\\daal\\include\\daal.h> ",
libs = paste("/Qdaal[-C:\\Program Files (x86)\\IntelSWTools\\compilers_and_libraries_2017.1.143\\windows\\daal\\lib\\intel64_win\\daal_core.lib]",
"/Qdaal[-C:\\Program Files (x86)\\IntelSWTools\\compilers_and_libraries_2017.1.143\\windows\\daal\\lib\\intel64_win\\daal_thread.lib]", sep=""))
registerPlugin("daalNB", plug)
# load data
readCSV <- '
using namespace daal;
using namespace daal::data_management;
// Inputs:
// file - file name
// ncols - number of columns in file
std::string fname = Rcpp::as<std::string>("C://Users//Documents//BAJAJ.csv");
int k = Rcpp::as<int>(7);......***rest of the code as per the website referenced above, ie same code for the readCSV, train and predict functions***
Functions to actually call the functions:
# R function for loading data and labels
loadData <- cxxfunction(signature(file="character", ncols="integer"),readCSV, plugin="daalNB")
# R function for training a model
nbTrain <- cxxfunction(signature(X="raw", y="raw", nclasses="integer"),
train, plugin="daalNB")
# R function for scoring
nbPredict <- cxxfunction(signature(model="raw", X="raw", nclasses="integer"),
predict, plugin="daalNB")
The errors I am getting in relation to the readCSV <- function:
C:/Users/Documents/R/win-library/3.3/Rcpp/include/Rcpp/as.h:151:29: note: template argument deduction/substitution failed:
file40e81ac24329.cpp:36:89: note: cannot convert '"C://Users//Documents//BAJAJ.csv"' (type 'const char [40]') to type 'SEXP'
std::string fname = Rcpp::as<std::string>("C://Users//Documents//BAJAJ.csv");
^
file40e81ac24329.cpp:37:29: error: no matching function for call to 'as(int)'
int k = Rcpp::as<int>(7);
make: *** [file40e81ac24329.o] Error 1
Warning message:
running command 'make -f "C:/R/R-33~1.1/etc/x64/Makeconf" -f "C:/R/R-33~1.1/share/make/winshlib.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="file40e81ac24329.dll" WIN=64 TCLBIN=64 OBJECTS="file40e81ac24329.o"' had status 2
ERROR(s) during compilation: source code errors or compiler configuration errors!
The below error summmary appears in red in the R Studio console:
Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! In file included from file40e81ac24329.cpp:3:0:
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\daal\include\daal.h:25:0: warning: ignoring #pragma warning [-Wunknown-pragmas]
#pragma warning(disable:809)
^
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\daal\include\daal.h:38:0: warning: ignoring #pragma comment [-Wunknown-pragmas]
#pragma comment(lib, "tbb.lib" )
^
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\daal\include\daal.h:39:0: warning: ignoring #pragma comment [-Wunknown-pragmas]
#pragma comment(lib, "tbbmalloc.lib" )
^
In file included from C:/R/R-33~1.1/include/data_management/data/data_dictionary.h:35:0,
from C:/R/R-33~1.1/include/data_management/data_source/data_source.h:33,
from C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.1.143\windows\daal\in
In addition: Warning message:
running command 'C:/R/R-33~1.1/bin/x64/R CMD SHLIB file40e81ac24329.cpp 2> file40e81ac24329.cpp.err.txt' had status 1
Edit - 23 July 2018
I made the changes to the csv path as suggested by Ralf, and also inserted the following in the Makevars.win file:
CXX=C:/IntelSWTools2018/compilers_and_libraries_2018.3.210/windows/bin/intel64/icl.exe
CXXFLAGS=-I"C:/IntelSWTools2018/compilers_and_libraries_2018.3.210/windows/daal/include" -I"C:/IntelSWTools2018/compilers_and_libraries_2018.3.210/windows/compiler/include" -I"C:/Program Files (x86)/Windows Kits/10/Include/10.0.10240.0/ucrt" -I"C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include
Now am getting the following errors:
Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! Intel(R) C++ Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 18.0.3.210 Build 20180410
Copyright (C) 1985-2018 Intel Corporation. All rights reserved.
icl: NOTE: The evaluation period for this product ends on 4-aug-2018 UTC.
compilation aborted for file35d0134c2a9d.cpp (code 2)
make: *** [file35d0134c2a9d.o] Error 2
Warning message:
running command 'make -f "C:/R/R-33~1.1/etc/x64/Makeconf" -f "C:/R/R-33~1.1/share/make/winshlib.mk" -f "C:/Users/Documents/.R/Makevars.win" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="file35d0134c2a9d.dll" WIN=64 TCLBIN=64 OBJECTS="file35d0134c2a9d.o"' had status 2
In addition: Warning message:
running command 'C:/R/R-33~1.1/bin/x64/R CMD SHLIB file35d0134c2a9d.cpp 2> file35d0134c2a9d.cpp.err.txt' had status 1
I can see a few lines in the code which suggest some issues, but cant make head or tail of these:
C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include/xmmintrin.h(61): error #2277: invalid definition of __m128; use #include "xmmintrin.h" instead
C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include/xlocale(341): warning #583: C++ exception handler found but /EHsc option was not specified
C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include/xlocale(367): warning #583: C++ exception handler found but /EHsc option was not specified
C:/Users/Documents/R/win-library/3.3/Rcpp/include/Rcpp/internal/NAComparator.h(62): error: expected a ")"
C:/Users/Documents/R/win-library/3.3/Rcpp/include/Rcpp/r_cast.h(32): warning #583: C++ exception handler found but /EHsc option was not specified
C:/Users/Documents/R/win-library/3.3/Rcpp/include/Rcpp/module/Module_generated_CppFunction.h(53): warning #583: C++ exception handler found but /EHsc option was not specified
C:/Users/Documents/R/win-library/3.3/Rcpp/include/Rcpp/module/Module_generated_CppFunction.h(93): warning #583: C++ exception handler found but /EHsc option was not specified
C:/Users/Documents/R/win-library/3.3/Rcpp/include/Rcpp/api/meat/module/Module.h(40): warning #583: C++ exception handler found but /EHsc option was not specified
C:/Users/Documents/R/win-library/3.3/Rcpp/include/Rcpp/api/meat/module/Module.h(40): warning #583: C++ exception handler found but /EHsc option was not specified
C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include/xstring(2195): warning #583: C++ exception handler found but /EHsc option was not specified
Edit 25 July 2018
Have now gone back to the exact packages daal versions noted in the website (very old!), and changed the CSV path as per Ralf's suggestion, and am getting the following compilation errors:
Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! file2ddc1463da6.o:file2ddc1463da6.cpp:(.text+0x2e6): undefined reference to `daal::data_management::interface1::SerializationIface::serialize(daal::data_management::interface1::InputDataArchive&)'
file2ddc1463da6.o:file2ddc1463da6.cpp:(.text+0x304): undefined reference to `daal::data_management::interface1::SerializationIface::serialize(daal::data_management::interface1::InputDataArchive&)'
file2ddc1463da6.o:file2ddc1463da6.cpp:(.text$_ZN4daal15data_management10interface118SerializationIfacenwEy[_ZN4daal15data_management10interface118SerializationIfacenwEy]+0x16): undefined reference to `daal::services::daal_malloc(unsigned long long, unsigned long long)'
file2ddc1463da6.o:file2ddc1463da6.cpp:(.text$_ZN4daal15data_management10interface118SerializationIfacenaEy[_ZN4daal15data_management10interface118SerializationIfacenaEy]+0x16): undefined reference to `daal::services::daal_malloc(unsigned long long, unsigned long long)'
fi
The source of these are a tonne of lines such as:
file2ddc1463da6.o:file2ddc1463da6.cpp:(.text+0x2e6): undefined reference to `daal::data_management::interface1::SerializationIface::serialize(daal::data_management::interface1::InputDataArchive&)'
file2ddc1463da6.o:file2ddc1463da6.cpp:(.text+0x304): undefined reference to `daal::data_management::interface1::SerializationIface::serialize(daal::data_management::interface1::InputDataArchive&)'
file2ddc1463da6.o:file2ddc1463da6.cpp:(.text$_ZN4daal15data_management10interface118SerializationIfacenwEy[_ZN4daal15data_management10interface118SerializationIfacenwEy]+0x16): undefined reference to `daal::services::daal_malloc(unsigned long long, unsigned long long)'
file2ddc1463da6.o:file2ddc1463da6.cpp:(.text$_ZN4daal15data_management10interface118SerializationIfacenaEy[_ZN4daal15data_management10interface118SerializationIfacenaEy]+0x16): undefined reference to `daal::services::daal_malloc(unsigned long long, unsigned long long)'
file2ddc1463da6.o:file2ddc1463da6.cpp:(.text$_ZN4daal15data_management10interface118SerializationIfacedlEPvy[_ZN4daal15data_management10interface118SerializationIfacedlEPvy]+0x15): undefined reference to `daal::services::daal_free(void*)'
The Rcpp::as function you use is needed to convert between an R internal data type (SEXP) and normal C++ data types (int, string, ...). This is needed when you pass arguments from R to your C++ function. Since you specify the parameter in the C++ code, you do not need this function. The following should work in your readCsv function:
std::string fname = "C:/Users/Documents/BAJAJ.csv";
int k = 7;
Alternatively you can stick to the version from the tutorial where these parameters are passed in from R.
BTW, you don’t need to double /. Only \ has a special meaning and has to be doubled to refer to the literal version.
I have a Visual Studio 2017 project, where I'm trying to interface a C++ and Assembly program. So I have a header ("indexof.h") that has the Prototypes for the assembly procedures in an extern "C" block, and a main.cpp, which includes indexof.h and uses the procedures made available in it, and then an IndexOf.asm file that contains my assembly code (which also has prototypes for its procedures, before the .code section). Unfortunately, when I attempt to run it, I get this error:
1>Assembling IndexOf.asm...
1>MASM : fatal error A1000: cannot open file : IndexOf.asm
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\BuildCustomizations\masm.targets(50,5): error MSB3721: The command "ml.exe /c /nologo /Zf /Zi /Fo"Debug\IndexOf.obj" /W3 /errorReport:prompt /TaIndexOf.asm" exited with code 1.
1>Done building project "IndexOf_asm.vcxproj" -- FAILED.
I desperately need help (It's due tomorrow), this was a project setup provided by my class, I'm just trying to run it, and I haven't even gotten to the actual thing I need to do yet. Thank you!
I have added some information to this question, below the line of xxxx.
I am attempting to move a large ActiveX (legacy) control from Visual C++ version 6 to Visual Studio 2010. The build went just fine under VSC++6. The automated conversion (within VS2010) seemed to run smoothly. There were a number of minor errors which had to be corrected in the code, such as having to declare variables to be integer rather than letting them default. Upon fixing the last error and building, the link step gave this error:
1>LINK : fatal error LNK1104: cannot open file '.\Debug\/.obj'
I have searched and found a couple people had asked about this problem, but the solutions were very project specific. I could find nothing that applied to my situation.
There were two projects in the original solution. To attempt to solve the problem, I separated them into two separate solutions, one of which produces a .dll and works and the other (to produce the activeX component) which fails with the above error.
I really don't know where to look.
I have no .cpp nor .h files with Debug in the filename.
There must be something telling the linker to look for this file... but where? How would I even recognize it. (I'm not even sure what the forward slash in the filename represents. Is it escaping the period... or does the pair of characters (backslash forwardslash, \ /) escape the forward slash meaning it is part of the filename?)
Where do I even start?
I think that I have heard that Visual Studio generates command lines which actually do the compilation and linking. Is there any way to see the generated command line to do the Link?
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I just located 3 files with names and content as shown. They seem to be
related to the problem. The 3rd file shows the bad file name (twice). Can anyone tell me where in the Visual Studio GUI they are set up? Or what may cause the erroneous entries in the last file?
custombuild.command.1.tlog -------------------
^C:\DOCUMENTS AND SETTINGS\USER1\DESKTOP\QUILT00\QGETL32.ASM
..\Assembler\ml /Fo.\Debug\Qgetl32.obj /coff /I. /Zi /c /Cx /Ta Qgetl32.asm
^C:\DOCUMENTS AND SETTINGS\USER1\DESKTOP\QUILT00\ROT32.ASM
..\Assembler\ml /Fo.\Debug\Rot32.obj /coff /I. /Zi /c /Cx /Ta Rot32.asm
custombuild.read.1.tlog ----------------------
^C:\DOCUMENTS AND SETTINGS\USER1\DESKTOP\QUILT00\QGETL32.ASM
^C:\DOCUMENTS AND SETTINGS\USER1\DESKTOP\QUILT00\ROT32.ASM
custombuild.write.1.tlog ---------------------
^C:\DOCUMENTS AND SETTINGS\USER1\DESKTOP\QUILT00\QGETL32.ASM
C:\DOCUMENTS AND SETTINGS\USER1\DESKTOP\QUILT00\DEBUG\.OBJ
^C:\DOCUMENTS AND SETTINGS\USER1\DESKTOP\QUILT00\ROT32.ASM
C:\DOCUMENTS AND SETTINGS\USER1\DESKTOP\QUILT00\DEBUG\.OBJ
I tried to compile a project with Visual Studio 6 SP6 and got the following:
usbcore.h(18) : fatal error C1001: INTERNAL COMPILER ERROR
(compiler file 'msc1.cpp', line 1794)
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information
Line 18 of usbcore.h contains the include directive:
18: #include "usbiface.h"
Empty or non-existing usbiface.h produces the same error. I commented this line and got the same error but for the next include file.
To sum this up: the compiler error occurs for each #include directive that refers to the common project headers.
I figured out what caused that error. One of the include paths (passed to a compiler with the /I switch) had a trailing backslash.
The compiler cmdline is: CPP /nologo /MT /W3 /GX /Zi /Od /I "$(ZLIB_PATH)" /I "..\headers"
and ZLIB_PATH had a trailing backshlash. Removing that backslash solved the problem.
In my case, changing the tag WholeProgramOptimizationtrue from true to false fixed the problem.
I ran into this problem when I left the parenthesis off of the definition of a ctor. It was a stupid error but it was very taxing to check out all of these tough fixes. So I just offer this as a possibility. I would not have expected an internal compiler error.
In my case (VC6.0 SP6a), it is due to the confusing using statement. It seems the compiler can't determine whether I'm defining Foo::Bar or Bar (in global namespace).
namespace Foo {
class Bar;
}
using Foo::Bar;
class Bar {
};
In my case I had to turn off the "Generate browse info" option to avoid this. (Project settings \ C/C++ \ General)
I am getting a really strange linker error appearing:
link.exe : fatal error LNK1107: invalid or corrupt file: cannot read at 0x270
But this is strange, because usually the error message tells you what object is invalid or corrupt. In other words, typically this error message looks something like this:
myDLL.dll : fatal error LNK1107: ....
However, in this case, the invalid object is the application itself (link.exe) that is running!
I've tried replacing the executable with another copy that I know is valid. Same error.
The command I am running is this:
../vendor/microsoft/msdev80_2005/VC/bin/link.exe /NOLOGO /SUBSYSTEM:CONSOLE /LIB
PATH:../vendor/microsoft/msdev80_2005/VC/atlmfc/lib /LIBPATH:../vendor/microsoft
/msdev80_2005/VC/lib /LIBPATH:../vendor/microsoft/msdev80_2005/VC/PlatformSDK/Li
b /LIBPATH:lib/win32/dbg /OUT:bin/win32/dbg/bugshow.exe Advapi32.lib ws2_32.lib
bugshow/obj/win32/dbg/main.o libA.lib libB.lib libC.lib libD.lib
main.o is getting compiled using the following compiler directive:
../vendor/microsoft/msdev80_2005/VC/bin/cl.exe /nologo /X /w /EHsc -I../vendor/m
icrosoft/msdev80_2005/VC/atlmfc/include -I../vendor/microsoft/msdev80_2005/VC/in
clude -I../vendor/microsoft/msdev80_2005/VC/PlatformSDK/Include /D_WIN32 /DBOOST
_USE_WINDOWS_H /DWIN32_LEAN_AND_MEAN /D_WIN32_WINNT=0x0501 /DBOOST_THREAD_USE_LI
B /DBOOST_ALL_NO_LIB /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE /Z7
/MTd /c -I../vendor/boost.org/boost/1.45.0/include /Fobugshow/obj/win32/dbg/main.o
bugshow/main.cpp
Any ideas why link.exe would be failing like this?
UPDATE:
When I add the folder that link.exe resides in to my PATH, and then call link.exe without the path prefix, I get the following error instead:
LINK: fatal error LNK1181: cannot open input file 'link.exe'
Why is link.exe trying so desperately to open itself??!?!
I figured out the problem!
There is a nasty little ENVIRONMENT variable that the MSVC linker uses (described here) on Microsoft's MSDN page. It says:
LINK, if defined, prepends arguments in the command line.
My system had the environment variable LINK defined as STATIC by a recent application I installed. This caused link.exe to interpret the command-line instantiation of itself as follows:
STATIC link.exe /NOLOGO /SUBSYSTEM:CONSOLE ...
In other words, *argv[1] which is usually the first command line parameter, was actually link.exe. It basically bumped all the arguments down by one offset. This in turn caused link.exe to try and interpret itself as its first input file!
Absolutely, unbelievably frustrating and hard to detect problem...
I read that it produces this error when you've included a header file (.h) in your Linker. I had this problem and solved it by removing the .h in Linker > Input > Addtl Dependencies