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.

[Windows] Compilation warnings: unknown option '-std=c++11'

See original GitHub issue

Hello, first of all, great work on this tool! it works like a charm!

I’m a windows user, and the default example raises 2 warnings because of those flags I believe: https://github.com/tbenthompson/cppimport/blob/9b3326424c90e7023e34a1ca413221f6509049a3/cppimport/templating.py#L30

cl : Command line warning D9002 : ignoring unknown option '-std=c++11'
cl : Command line warning D9002 : ignoring unknown option '-fvisibility=hidden'

I think msvc has its own set of compiler flags (like /std:c++11) and using those on windows might fix those warnings. Thanks again for the good work!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
tbenthompsoncommented, Mar 4, 2021

Huh, are you sure you’re linking in the JUCE library at all? You may need to add something like

cfg['include_dirs'] = ...
cfg['libraries'] = ['juce'] 

Or whatever the appropriate library name would be. Generally, C++ libraries have headers that needed to included at compile-time and libraries that need to be linked at link-time. In general, I’d suggest you start by getting a simple single C++ file compiling with the library before adding complexity like Python bindings. That’ll also help you understand the various compiler and linker flags and get a better scaffolding for debugging these kinds of problems in the future.

I’m going to close this since I’m pretty sure cppimport isn’t causing your issues. Hope you resolve your problem!

0reactions
kokounetcommented, Mar 4, 2021

Hello again!

Thank you again for your comment, I managed to make it work after all! It was indeed not cppimport causing the issue. I needed to add information on how to compile the library and link to a bunch of system libraries as well!

now the config looks something like this:

<%
import glob
import sys
cfg["include_dirs"] = [
    "JuceLibraryCode",
    "JuceLibraryCode/modules",
    "JuceLibraryCode/modules/juce_audio_processors/format_types/VST3_SDK"
]
cfg["sources"] = sorted(glob.glob("JuceLibraryCode/*.cpp"))
if sys.platform == "win32":
    cfg["libraries"] = [
        "kernel32", "user32", "gdi32", "winspool", "comdlg32", "advapi32",
        "shell32", "ole32", "oleaut32", "uuid", "odbc32", "odbccp32",
    ]
elif sys.platform == "darwin":
    cfg["libraries"] = []
setup_pybind11(cfg)
%>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Command line warning D9002: ignoring unknown option '-std ...
Any idea? Command line warning D9002: ignoring unknown option '-std=c++0x'. Other than the compile warning, the program gets compile and ...
Read more >
std:c++11 vs. - MSDN - Microsoft
It looks like Microsoft is using "-std:" (or "/std:") while other ... cl : Command line warning D9002 : ignoring unknown option '-std=c++11'...
Read more >
Build under windows ignores -std=c++14 · Issue #179 · ifm/ifm3d
The problem is whenever I use the library in my project it throws the same failure: cl : Command line warning D9002 :...
Read more >
Options to Request or Suppress Warnings — gcc 6 ... - Fedora
When an unrecognized warning option is requested (e.g., -Wunknown-warning), GCC emits a diagnostic stating that the option is not recognized. However, if the...
Read more >
Intel® oneAPI DPC++/C++ Compiler Developer Guide and ...
If you specify O9, the compiler issues a warning, then ignores the unrecognized option O9, and proceeds with the compilation. The O option...
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