question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

error while compiling: Error parsing translation unit

See original GitHub issue

This shows up only on Windows, anytime I save the file or activate the current buffer. I’ve tried it on a running Linux system and it works fine.

INFO:EasyClangComplete.plugin.view_config: init completer based on libclang
ERROR:EasyClangComplete.plugin.completion.lib_complete: error while compiling: Error parsing translation unit.
Traceback (most recent call last):
  File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 530, in on_activated_async
    callback.on_activated_async(v)
  File "C:\Users\Satyajith\AppData\Roaming\Sublime Text 3\Packages\EasyClangComplete\EasyClangComplete.py", line 137, in on_activated_async
    self.view_config_manager.load_for_view(view, settings)
  File "C:\Users\Satyajith\AppData\Roaming\Sublime Text 3\Packages\EasyClangComplete\plugin\view_config.py", line 344, in load_for_view
    config = ViewConfig(view, settings)
  File "C:\Users\Satyajith\AppData\Roaming\Sublime Text 3\Packages\EasyClangComplete\plugin\view_config.py", line 66, in __init__
    self.completer.update(view, settings.errors_on_save)
  File "C:\Users\Satyajith\AppData\Roaming\Sublime Text 3\Packages\EasyClangComplete\plugin\completion\lib_complete.py", line 213, in update
    self.tu.reparse()
AttributeError: 'NoneType' object has no attribute 'reparse'

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
niosuscommented, Jan 13, 2017

Ok, so the reason is that your flags are wrong. Consider this line.

DEBUG:EasyClangComplete.plugin.completion.lib_complete: clang flags are: ['-c', '-fsyntax-only', '-x', 'c++', '-std=c++11', 'C:\\TDM-GCC-64\\lib\\gcc\\x86_64-w64-mingw32\\5.1.0\\include', 'C:\\TDM-GCC-64\\lib\\gcc\\x86_64-w64-mingw32\\5.1.0\\include\\C++', 'C:\\Program Files\\LLVM\\lib\\clang\\3.9.0\\include', '-IC:\\Users\\Satyajith\\Documents\\github\\algorithms\\sorting', '-IC:\\Users\\Satyajith\\Documents\\github\\algorithms']

There is a number of includes that have to start with -I like the last two flags, but start with C:\\. Change them to -IC:\\ and the problem should be gone.

But I agree, that the error message could be better. I will target this as soon as I have time.

1reaction
niosuscommented, Jan 13, 2017

Don’t worry. Good software should be able to tell you there is something wrong BEFORE you encounter a cryptic error. I am going to target the usability at some point soon probably. I want this plugin to be as failsafe as possible.

Read more comments on GitHub >

github_iconTop Results From Across the Web

error while compiling: Error parsing translation unit. · Issue #236
Your error looks like one that occurs if you change settings or update/install the plugin and do not restart the sublime text. Try...
Read more >
c++ - Is there a way to get a meaningfull error message when ...
I am trying to compile code at runtime using libclang. I am giving ti deliberately malformed code to try to see how to...
Read more >
Developers - error while compiling: Error parsing translation unit. -
I get this error when displaying the console (ubuntu x64 + clang version 4 from default repos ). Tried to use latest libclang...
Read more >
Valloric/YouCompleteMe - Gitter
Hello, I am trying to install YCMD with vundle and stuck with that error: ... debug 'ClangParseError: Libclang crashed while parsing the translation...
Read more >
Translation unit manipulation - clang
When fatal errors are encountered while parsing a translation unit, semantic analysis is typically stopped early when compiling code.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found