Simply put, I downloaded a port of V-USB for Arduino and can't seem to compile the example that came with it. I get the following message when trying to compile using Arduino IDE 1.0.1
avr-gcc: error: unrecognized command line option '-assembler-with-cpp'
I understand that this is most likely version incompatibility issue and could be avoided by downgrading my avr-gcc to an older version, but is it possible to do some trick to make it compile using the up to date version of avr-gcc?
Just a few notes about environment I'm trying this on
OS: Fedora release 17 (Beefy Miracle)
avr-gcc: (Fedora 4.7.2-1.fc17) 4.7.2
Arduino IDE: (arduino-1.0.1-1.fc17) 1.0.1
The -assembler-with-cpp option instructs the compiler to consider all following files to be assembler files requiring preprocessing. From a quick glance in v-usb, they provide .asm wrappers for .S files. You don't need to use those and the compiler will recognize the .S files automatically without any options.
If the problem isn't with the .asm wrappers detailed above, you can rename the files in question to .S.
Have you tried compiling without the flag? What happened?
With the hints from Jester I managed to solve this problem by updating the IDE to version 1.0.3 (1.0.2 might work as well) and it worked like a charm.
So I guess the problem wasn't the code or compiler, the problem was that the IDE 1.0.1 was expecting an older version of the avr-gcc and used a deprecated flag for compiling and simply failed since that flag is no longer available on the new compiler so you either have to downgrade the compiler or upgrade the IDE and from my perspective, upgrading is always the right choice to make.
Related
I stumbled upon free stuff in the form of Intel oneAPI toolkit and everything works great, the samples compile fine but I don't know how to specify the C++ standard in the compiler options. From what I understand DPC++ is built on top of Clang so I should be able to choose which C++ version it compiles for but I don't know how.
How do I get my C++17 code to work?
This is an ongoing issue, there are reports of other users with the same issue. As far as I know it hasn't been solved yet, what you can do meanwhile is to run the program from the command line:
Go to the folder where you installed OneApi, let's say C:\Program Files (x86)\inteloneapi\ and run setvars.bat to set environment variables.
Then compile the program using the C++17 flag, navigate to the folder where the source code is and run dpcpp filename(s).cpp -std=c++17.
I'm trying to include curses.h and some functions from that lib (specifically detecting a keyboard hit without stopping), but whenever I try, it gives the error "symbols not found." I'm assuming that this is because the clang++ compiler sees curses.h as a C library. I've gathered I need to link curses.h, but I don't know how and I could not find any real guides.
I'm writing a program in C++ using VSCode and clang++ on a mac. Any help is appreciated.
For anyone else who has this problem- my clang version was outdated. It was installed, so after a brief check, I thought all was good. However, it was not able to compile (nor find some libs for some reason) the newer versions of C++. Installing the latest version of clang fixed all issues.
I was trying to use the boost library first time. Using as an environment Eclipse 4.3 with CDT and as compiler gcc 3.4 and boost 1.53.
I was browsing various sites to find info on how to setup boost, but it doesn't seem to work. When I compile trying to include boost/asio.hpp I get the error:
You must add -D__USE_W32_SOCKETS to your compiler options
However, I don't want to use windows sockets, I want to use posix, so I don't really know what is wrong. As I need the project to run on HP-UX later, I dont want to get to Windows specific. If I use now windows sockets will the program later be easily portable to Unix, or are all the details encapsulated in boost, and I don't have to care anyway?
I tested a simple testprogram using FOREACH loop to confirm that boost itself works, and this is the case.
I also found this: https://svn.boost.org/trac/boost/ticket/7881 so does it mean that this problem is currently currently not supported, or am I doing something wrong?
It seems what you're trying to do is not supported by the library, the documentation states the following under supported platforms
The following platforms and compilers have been tested:
Win32 and Win64 using Visual C++ 7.1 and Visual C++ 8.0.
Win32 using MinGW.
Win32 using Cygwin. (__USE_W32_SOCKETS must be defined.)
Linux (2.4 or 2.6 kernels) using g++ 3.3 or later.
Solaris using g++ 3.3 or later.
Mac OS X 10.4 using g++ 3.3 or later.
added emphasis is mine. If that's not possible, you might try the patch suggested in the linked ticket. However, grepping through the source code I see several occurrences of #if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) so it's not obvious that simply patching io_service.hpp will resolve anything. You might try adding -U__CYGWIN__ to your CXXFLAGS, though the cygwin toolchain may not like that.
Full disclosure: I am not a Windows guy so hopefully someone else will chime in.
The libboost-devel package in the Cygwin distribution includes patches to not use Winsock on Cygwin in Boost.Asio. I suggest trying that in conjunction with the gcc4 packages, which provide more recent versions of GCC.
I've been updating my Mac toolchain in order to take advantage of C++11 features and eventually get pretty-print debugging of STL data structures. I used Homebrew to build the gcc 4.7.2 compiler. I've been able to recompile the source of my current project using this new compiler. However all versions of gdb that I've tried have various problems when setting breakpoints, viewing source code or viewing local variables.
The version of gdb that I believe is installed as part of the Xcode command-line tools, version 6.3.50, has trouble displaying various template-based variables. I've also built and tried to use several other gdb versions (7.3.1, 7.4.1 & 7.5.1), but each gdb version has problems that make it difficult to impossible to set breakpoints, view source code and view variables. Specifically, these gdb versions don't know the source file or line number of functions defined in header files, breakpoints can't be set in these header-file functions, and many local variables have been "optimized out".
Has anybody else experienced these problems, and if so have you been able to resolve them? Which versions should I be using in my toolchain in order to avoid these problems?
For the record, my development is on a recent MBP running the latest Mountain Lion updates. My IDE is Eclipse Juno with CDT version 8.1.1. And, yes, I've code signed all versions of gdb that I've built and attempted to use.
Thanks for any input,
Bob
many local variables have been "optimized out".
Is this happening while debugging optimized code? If so, that is expected. You may not have seen this happening before, because older GCC didn't quite optimize that much.
To fix: build your to-be-debugged code with -g -O0 flags.
I am taking a programming class and we are required to use the gcc 4.1.2 compiler to compile our c++ projects. I will be creating my projects in xcode and can't find how to set that compiler. I went to the get info window on the project and hit the drop down under Compiler Version, however I do not have 4.1.2 on the list. It seems that this compiler is not installed on my computer. Does anybody know where I can download it and how I can set it as my system default gcc compiler for the term?
You can probably get away with using whatever version of GCC is on your Mac, and doing a final compile on the university machines as a check. In general, the user visible changes using a later version is stricter syntax checking, so you might do something on the Mac that won't pass a newer compiler, but that generally isn't too common. I haven't had to change more than a few lines on our 50k line codebase.
With the current developer tools, only gcc 4.0 and 4.2 are available. You could probably get gcc 4.1.2 via MacPorts, however, I'm not sure whether you can integrate it into XCode.
Before you try this, you should maybe first check with the class instructor whether it is really necessary to use exactly 4.1.2, or if it is OK to use 4.0 resp. 4.2 instead.