Reputation: 1640
Whenever I want to compile a LateX file with Sublime Text 2, (build 2221 on OS X), I get an output like this:
ld: warning: ignoring file /Users/magnus/Documents/test.tex, file was built for unsupported file format ( 0x5C 0x64 0x6F 0x63 0x75 0x6D 0x65 0x6E 0x74 0x63 0x6C 0x61 0x73 0x73 0x7B 0x61 ) which is not the architecture being linked (x86_64): /Users/magnus/Documents/test.tex
Undefined symbols for architecture x86_64:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
[Finished in 0.0s with exit code 1]
Obviously, ST2 tries to compile .tex files with clang. I checked all the sublime-build files and preferences (at least those I know), but could not find a misconfiguration. Ask me to add configuration files if you need them. When I compile the document (with pdflatex blah.tex) in the terminal, it works, thus it shouldn't be a malfunction of my system.
Does anybody know how to fix this? Thanks in advance.
Upvotes: 1
Views: 712
Reputation: 102852
Sublime Text build systems have selectors in them to determine the type of file to be built. For example, in the Python.sublime-build
file is the line
"selector": "source.python"
so that only files with the Python syntax set are built when Tools -> Build Systems
is set to Automatic
. However, if you specifically select a certain build system, it will be used to build all files, regardless of any selector statements.
Probably what happened in your case was that your Build System was set to C/C++, which invoked clang
on your LaTeX files. Set the build system back to Automatic, or specifically select the LaTeX build system, and you should be all set.
Upvotes: 2