我有以下批处理文件来构建我的代码:
rem clean the bin directory
rmdir bin\
mkdir bin\
copy externals\glfw\lib-vc2015\glfw3.lib bin\glfw3.lib
rem setup the compiler
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.bat"
rem compile
cl ^
src\*.c ^
bin\glfw3.lib ^
/I externals\glfw\include ^
/TC ^
/Fo:bin\ ^
/Fe:bin\game.exe
rem runs the game if the game was built
if exist bin\game.exe (bin\game.exe)
构建过程有效,但链接到glfw3.lib
除外我的输出是:
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23506 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
main.c
glfw3.lib
bin\glfw3.lib(1): error C2059: syntax error: '!'
bin\glfw3.lib(2): error C2018: unknown character '0x60'
bin\glfw3.lib(3): error C2018: unknown character '0x1'
bin\glfw3.lib(3): error C3873: '0xa1': this character is not allowed as a first character of an identifier
bin\glfw3.lib(3): error C2018: unknown character '0x10'
bin\glfw3.lib(3): error C2018: unknown character '0x2'
bin\glfw3.lib(3): error C2018: unknown character '0x40'
bin\glfw3.lib(3): error C2059: syntax error: 'bad suffix on number'
bin\glfw3.lib(3): error C2177: constant too big
bin\glfw3.lib(3): error C2041: illegal digit '9' for base '8'
bin\glfw3.lib(3): error C2041: illegal digit '8' for base '8'
bin\glfw3.lib(3): error C2018: unknown character '0x60'
bin\glfw3.lib(4): error C2018: unknown character '0x1'
bin\glfw3.lib(4): error C3873: '0xa1': this character is not allowed as a first character of an identifier
bin\glfw3.lib(4): error C2018: unknown character '0x10'
bin\glfw3.lib(4): error C2018: unknown character '0x2'
bin\glfw3.lib(4): error C2018: unknown character '0x7'
bin\glfw3.lib(5): error C2018: unknown character '0x1'
bin\glfw3.lib(5): error C2018: unknown character '0x7'
bin\glfw3.lib(6): error C2018: unknown character '0x1'
bin\glfw3.lib(6): error C2018: unknown character '0x8'
bin\glfw3.lib(8): error C2018: unknown character '0x1'
bin\glfw3.lib(9): error C2018: unknown character '0x7'
bin\glfw3.lib(9): error C2018: unknown character '0x8'
bin\glfw3.lib(9): error C2018: unknown character '0x1'
bin\glfw3.lib(9): error C2018: unknown character '0x3'
bin\glfw3.lib(9): error C2018: unknown character '0x6'
bin\glfw3.lib(9): error C2018: unknown character '0x4'
bin\glfw3.lib(11): error C2018: unknown character '0x1'
bin\glfw3.lib(11): error C2018: unknown character '0x7'
bin\glfw3.lib(11): error C2018: unknown character '0x6'
bin\glfw3.lib(11): error C2018: unknown character '0x3'
bin\glfw3.lib(11): error C2018: unknown character '0x5'
bin\glfw3.lib(11): error C2018: unknown character '0x2'
bin\glfw3.lib(12): error C2018: unknown character '0x5'
bin\glfw3.lib(12): error C2018: unknown character '0x2'
bin\glfw3.lib(12): error C2018: unknown character '0x7'
bin\glfw3.lib(12): error C2018: unknown character '0x3'
bin\glfw3.lib(12): error C2018: unknown character '0x1'
bin\glfw3.lib(12): error C2018: unknown character '0x4'
bin\glfw3.lib(16): error C2018: unknown character '0x8'
bin\glfw3.lib(19): error C2018: unknown character '0x8'
bin\glfw3.lib(19): error C2018: unknown character '0x7'
bin\glfw3.lib(19): error C2018: unknown character '0x3'
bin\glfw3.lib(19): error C2018: unknown character '0x1'
bin\glfw3.lib(19): error C2018: unknown character '0x4'
bin\glfw3.lib(19): error C2018: unknown character '0x6'
bin\glfw3.lib(19): error C2018: unknown character '0x2'
bin\glfw3.lib(19): error C2018: unknown character '0x5'
bin\glfw3.lib(21): error C2018: unknown character '0x8'
bin\glfw3.lib(22): error C2018: unknown character '0x8'
bin\glfw3.lib(24): error C2018: unknown character '0x8'
bin\glfw3.lib(31): error C2018: unknown character '0x1'
bin\glfw3.lib(31): error C2018: unknown character '0x6'
bin\glfw3.lib(31): error C2018: unknown character '0x3'
bin\glfw3.lib(31): error C2018: unknown character '0x8'
bin\glfw3.lib(32): error C2018: unknown character '0x8'
bin\glfw3.lib(40): error C2018: unknown character '0x8'
bin\glfw3.lib(45): error C2018: unknown character '0x8'
bin\glfw3.lib(45): error C2018: unknown character '0x40'
bin\glfw3.lib(45): error C2059: syntax error: 'bad suffix on number'
bin\glfw3.lib(45): error C2177: constant too big
bin\glfw3.lib(45): error C2041: illegal digit '9' for base '8'
bin\glfw3.lib(45): error C2041: illegal digit '8' for base '8'
bin\glfw3.lib(46): error C2018: unknown character '0x60'
bin\glfw3.lib(47): error C3872: '0x2020': this character is not allowed in an identifier
bin\glfw3.lib(47): error C2018: unknown character '0x12'
bin\glfw3.lib(47): error C2018: unknown character '0x1c'
bin\glfw3.lib(47): error C2018: unknown character '0x1'
bin\glfw3.lib(47): error C3873: '0x201e': this character is not allowed as a first character of an identifier
bin\glfw3.lib(48): error C2018: unknown character '0x10'
bin\glfw3.lib(48): error C3872: '0x24': this character is not allowed in an identifier
bin\glfw3.lib(48): error C2018: unknown character '0x40'
bin\glfw3.lib(48): error C2018: unknown character '0x1'
bin\glfw3.lib(48): error C2018: unknown character '0xe'
bin\glfw3.lib(48): error C2018: unknown character '0xf'
bin\glfw3.lib(48): error C2018: unknown character '0x6'
bin\glfw3.lib(48): error C2018: unknown character '0x60'
bin\glfw3.lib(48): error C2018: unknown character '0x12'
bin\glfw3.lib(48): error C2018: unknown character '0x14'
bin\glfw3.lib(48): error C2018: unknown character '0x13'
bin\glfw3.lib(48): error C2018: unknown character '0x7'
bin\glfw3.lib(48): error C2018: unknown character '0x2'
bin\glfw3.lib(48): error C2018: unknown character '0x1b'
bin\glfw3.lib(48): error C2018: unknown character '0x15'
bin\glfw3.lib(48): error C2018: unknown character '0x1f'
bin\glfw3.lib(48): error C2018: unknown character '0x16'
bin\glfw3.lib(48): error C2018: unknown character '0x3'
bin\glfw3.lib(48): error C2018: unknown character '0x17'
bin\glfw3.lib(48): error C3872: '0x2014': this character is not allowed in an identifier
bin\glfw3.lib(48): error C2018: unknown character '0x18'
bin\glfw3.lib(48): error C3873: '0x201a': this character is not allowed as a first character of an identifier
bin\glfw3.lib(48): error C3872: '0x8f': this character is not allowed in an identifier
bin\glfw3.lib(48): error C3872: '0x4': this character is not allowed in an identifier
bin\glfw3.lib(48): error C3872: '0xa0': this character is not allowed in an identifier
bin\glfw3.lib(48): error C2018: unknown character '0x1d'
bin\glfw3.lib(48): error C2018: unknown character '0x1e'
bin\glfw3.lib(49): error C2018: unknown character '0x10'
bin\glfw3.lib(49): error C2018: unknown character '0x60'
bin\glfw3.lib(49): error C2018: unknown character '0x8'
bin\glfw3.lib(49): error C2018: unknown character '0x40'
bin\glfw3.lib(49): fatal error C1003: error count exceeds 100; stopping compilation
我以前从未见过这样的错误。这让我觉得图书馆已经腐败了。我尝试了几个不同版本的.lib文件,但没有任何改变。
有什么想法吗?
答案 0 :(得分:1)
如果您想知道CL选项,请键入CL /?
要解决您的问题,请在bin \ glfw3.lib前面添加/链接。没有它,CL认为它是源文件,因此编译错误