jjames01
Posts: 4
Joined: Sun Dec 10, 2017 9:41 pm

VS17 Help

Tue Dec 12, 2017 11:27 pm

Can anyone plz help me fix this issue in visual studio 17. I cant get my code to build because of this error . Im trying to deploy it to my rpi using visual GDB

Code: Select all

1>------ Build started: Project: ledtest3, Configuration: Debug VisualGDB ------
1>ledtest3.cpp
1>Linking ../VisualGDB/Debug/ledtest3...
1>c:/sysgcc/raspberry/bin/../lib/gcc/arm-linux-gnueabihf/6/../../../../arm-linux-gnueabihf/bin/ld.exe: cannot find -l-Wl,--rpath=$ORIGIN
1>collect2.exe : error : ld returned 1 exit status
1>Done building project "ledtest3.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


jahboater
Posts: 2505
Joined: Wed Feb 04, 2015 6:38 pm

Re: VS17 Help

Wed Dec 13, 2017 11:30 am

Why doesn't "ledtest3.cpp" build on the Pi itself?

Heater
Posts: 8978
Joined: Tue Jul 17, 2012 3:02 pm

Re: VS17 Help

Wed Dec 13, 2017 1:14 pm

Yes, do your self a big favor and forget the Visual Studio monster.

Copy your source code to the Pi and compile/build it there.

User avatar
rurwin
Forum Moderator
Forum Moderator
Posts: 4249
Joined: Mon Jan 09, 2012 3:16 pm
Contact: Website

Re: VS17 Help

Wed Dec 13, 2017 1:41 pm

It is saying that it can't find the library lib-Wl,--rpath=$ORIGIN.lib

The -l flag to ld specifies the name of the library to which it prepends "lib".

The command line seems to contain the string "-l-Wl,--rpath=$ORIGIN.lib"
The -Wl,--rpath=$ORIGIN.lib was intended to be an option in which case it should have a space before it. But that leaves a bare "-l" and, if I understand correctly, that isn't a valid option.

In all such cases, if you understand what the computer thinks you mean and why it thinks that, you can usually work out what went wrong.

There are reasons that using this workflow may be necessary. If the Raspberry Pi was not available for example. This might be an embedded system as part of a bigger project and all of the other work is done in VS. You would not want to require a Raspberry Pi for everyone who needed to build the entire project.

jahboater
Posts: 2505
Joined: Wed Feb 04, 2015 6:38 pm

Re: VS17 Help

Wed Dec 13, 2017 4:00 pm

rurwin wrote:
Wed Dec 13, 2017 1:41 pm
There are reasons that using this workflow may be necessary. If the Raspberry Pi was not available for example. This might be an embedded system as part of a bigger project and all of the other work is done in VS. You would not want to require a Raspberry Pi for everyone who needed to build the entire project.
Yes of course.

But, I think many newcomers to the Pi underrate its capability as a development environment.
Perhaps they cant see how a $35 computer the size of a credit card, with free software, can be any good!
Or they are simply very familiar with, and comfortable with, their Visual Studio setup and developing on the Pi is taking a step into the unknown.
Or they need to justify spending a fortune on their high end PC/Visual Studio ...

My Pi3 is currently building a 17 million source line project as we speak.

Heater
Posts: 8978
Joined: Tue Jul 17, 2012 3:02 pm

Re: VS17 Help

Wed Dec 13, 2017 6:51 pm

rurwin,
There are reasons that using this workflow may be necessary. If the Raspberry Pi was not available for example. This might be an embedded system as part of a bigger project and all of the other work is done in VS. You would not want to require a Raspberry Pi for everyone who needed to build the entire project.
Perhaps, maybe.

I don't buy it. In all my decades of developing software for embedded systems that has never been true. Even when the bigger picture of the project was a Windows application.

Yes, I have had to use MS Visual Studio from time to time.

No probs, we arrange that our code can compile and run on Windows, Mac, Linux, whatever. Developers do not need the target system at hand.

Yes there is that pesky problem that under Windows, for example, there are all kinds of API's your target has, to GPIO and such, that are not available. That is an excellent opportunity to write stubs and simulations of those API's and do unit testing.

Tying your development team to a single IDE from a single vendor is so 1990's.

User avatar
rurwin
Forum Moderator
Forum Moderator
Posts: 4249
Joined: Mon Jan 09, 2012 3:16 pm
Contact: Website

Re: VS17 Help

Thu Dec 14, 2017 4:02 pm

We could argue all day, Heater; we often do. But it would be off-topic in this thread. If the OP wanted to defend their position, that would be OK.

Heater
Posts: 8978
Joined: Tue Jul 17, 2012 3:02 pm

Re: VS17 Help

Fri Dec 15, 2017 12:46 am

rurwin,

I'm not here to start a fight, but I find the whole idea that anyone would want to develop software for Unix/Linux on a Windows machine using Visual Studio is so mind bendingly weird.

jahboater
Posts: 2505
Joined: Wed Feb 04, 2015 6:38 pm

Re: VS17 Help

Fri Dec 15, 2017 10:03 am

+1

I don't know of course, but I suspect "ledtest3.cpp" is only a few lines of code. The setup cost (time and effort) of cross compiling will likely be far more than that for the actual project itself.

But ...
Its easy for people here with many decades of experience on countless platforms to just start using the Pi/Raspbian native. I am sure someone with relatively little experience on one platform only (say Visual Studio), would be out of their comfort zone.

Still ridiculous!

Software development on the Pi is an absolute dream compared to what I had to use for most of my career.

User avatar
DougieLawson
Posts: 32355
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: VS17 Help

Sat Dec 16, 2017 4:16 pm

jjames01 wrote:
Tue Dec 12, 2017 11:27 pm
Can anyone plz help me fix this issue in visual studio 17. I cant get my code to build because of this error . Im trying to deploy it to my rpi using visual GDB
If you can post your C++ code I can give it a go on my VS2017 installation that's set up to write code on windows 10 and deploy it to one of my Raspberries.

It's not alien doing that if you want to work with portable code.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3Bs*3, 3B+

Any DMs sent on Twitter will be answered next month.

Heater
Posts: 8978
Joined: Tue Jul 17, 2012 3:02 pm

Re: VS17 Help

Sat Dec 16, 2017 6:14 pm

Dougie,
It's not alien doing that if you want to work with portable code.
Sure it is.

For nearly two decades now I have been insisting that all code I write or any team working under me writes is runnable on Mac, Linux and Windows. Even if the target was some other architecture processor running an embedded OS like PSOS or VxWorks.

When I took time out to work for Nokia Networks I was happy to find the project managers there had the same idea.

Sure we would build for Windows with Visual Studio.

We build for the other platforms with more suitable tools. Or or now a days with the Pi, on the platform itself.

User avatar
DougieLawson
Posts: 32355
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: VS17 Help

Sat Dec 16, 2017 8:24 pm

You're always decrying Microsoft products, stop it - it's a waste of time, Microsoft aren't going away. If folks choose to use VS2017 (which is a decent and serviceable product) then that's their choice.

The "Linux is best, Microsoft is evil" argument got very stale a number of years ago. VS2017 is free software, my copy didn't cost anything other than some space on my 2TB hard drive in my Win10 laptop. I use Windows because I can't find a usable/feature rich IBM3270 emulator for Linux and I need that for my day job.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3Bs*3, 3B+

Any DMs sent on Twitter will be answered next month.

Heater
Posts: 8978
Joined: Tue Jul 17, 2012 3:02 pm

Re: VS17 Help

Sat Dec 16, 2017 9:17 pm

Dougie,
You're always decrying Microsoft products, stop it...
You obviously missed my posts were I tell how I love MS Visual Studio Code. How I have been using Win 10 almost exclusively for nearly two years now. How I'm happy that Win 10 runs all the Free and Open Source software I know and love from Linux. How I think the Linux Subsystem For Windows is amazingly useful and cool.

Imagine that, the two years of "Linux on the Desktop". With Windows underneath!
The "Linux is best, Microsoft is evil" argument got very stale a number of years ago
I think you miss-characterize me.

Linux may or may not be best. Depends what you want to do and if it can do it for you. Like any other OS or other software.

Microsoft may or may not be evil.

Those are not my primary concerns.

No. My primary argument is that it is a really bad idea for all the people, companies, corporations, governments and other organizations of the world to be reliant on a single source of supply for their operating system and other software. Especially when, for most, that single source of supply is a corporation in a foreign country over which they have no control.

I could make the same case for banks, insurance companies, etc, being beholden to Oracle or IBM.
I use Windows because I can't find a usable/feature rich IBM3270 emulator for Linux and I need that for my day job.
Exactly. You make my case for me.

User avatar
jcyr
Posts: 59
Joined: Sun Apr 23, 2017 1:31 pm
Location: Atlanta

Re: VS17 Help

Sat Dec 16, 2017 9:30 pm

If folks choose to use VS2017 (which is a decent and serviceable product) then that's their choice.
Actually VS 2017 is a great product!!! In fact the very best, bar none, for developing C or C++ code targeted to the Windows ecosystem.
If you want your child to get the best education possible, it is actually more important to get him assigned to a great teacher than to a great school. -- Bill Gates

Heater
Posts: 8978
Joined: Tue Jul 17, 2012 3:02 pm

Re: VS17 Help

Sat Dec 16, 2017 9:37 pm

jcyr,
Actually VS 2017 is a great product!!! In fact the very best, bar none, for developing C or C++ code...
Sounds great.
...targeted to the Windows ecosystem.
Oh.

Never mind.

jahboater
Posts: 2505
Joined: Wed Feb 04, 2015 6:38 pm

Re: VS17 Help

Sat Dec 16, 2017 9:37 pm

DougieLawson wrote:
Sat Dec 16, 2017 8:24 pm
You're always decrying Microsoft products, stop it - it's a waste of time, Microsoft aren't going away. If folks choose to use VS2017 (which is a decent and serviceable product) then that's their choice.
I don't think its anything to do with Microsoft or Linux specifically, its about building an executable on platform (a) to be used on platform (b). It appears daft when platform (b) itself has a truly excellent software development environment.

This is nothing to do with writing portable code where you compile the same code on each platform, to be used on the platform its built on (usually much easier than cross compiling).

In this thread it looks like a little LED twiddling is to be done which is not portable anyway (PC's don't have GPIO headers).

jahboater
Posts: 2505
Joined: Wed Feb 04, 2015 6:38 pm

Re: VS17 Help

Sat Dec 16, 2017 9:45 pm

I use Windows because I can't find a usable/feature rich IBM3270 emulator for Linux and I need that for my day job.
Real 3270's were a joy to use IMO (30+ years ago), but I never found any emulator that was any good by comparison.

Heater
Posts: 8978
Joined: Tue Jul 17, 2012 3:02 pm

Re: VS17 Help

Sat Dec 16, 2017 9:50 pm

jahboater,
...its about building an executable on platform (a) to be used on platform (b). It appears daft when platform (b) itself has a truly excellent software development environment.
Yes.
In this thread it looks like a little LED twiddling is to be done which is not portable anyway (PC's don't have GPIO headers).
Mostly. Oddly enough most of the "PC class" machines around me today have GPIO capability. Building a cross-platform LED flasher that worked on Pi or these PC's would be trivial.

Well, I'd move the source to the Pi for compilation there.

User avatar
DougieLawson
Posts: 32355
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: VS17 Help

Sat Dec 16, 2017 10:34 pm

jahboater wrote:
Sat Dec 16, 2017 9:45 pm
I use Windows because I can't find a usable/feature rich IBM3270 emulator for Linux and I need that for my day job.
Real 3270's were a joy to use IMO (30+ years ago), but I never found any emulator that was any good by comparison.
Tom Brennan's Vista is the best USD$30 3270 emulator you can buy. It's Windows only.

Real 3270s had wonderful keyboards and nice green letters on a black field. The first ones I used only did UPPER CASE text in 24 lines of 80 columns.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3Bs*3, 3B+

Any DMs sent on Twitter will be answered next month.

User avatar
rurwin
Forum Moderator
Forum Moderator
Posts: 4249
Joined: Mon Jan 09, 2012 3:16 pm
Contact: Website

Re: VS17 Help

Mon Dec 18, 2017 9:30 am

We will probably never know why the OP is building in VS, because we may have scared them off.

But...
Consider a development team of 100 developers, or even just 25. Consider daily builds carried out by a dedicated VM in a server farm. That is how real-world projects work. It isn't unusual and it is considered best-practice. There is no way that I would want to maintain 25 Raspberry Pi's in order to certify that they were running identical environments. Nor would I want to hang a Raspberry Pi off a server farm. The OP was just flashing LEDS, but we always write some simple code as proof of concept first. Or they may have just been trying out VS's targeted build process for use in some project unrelated to the Raspberry Pi but the Pi was to hand.

In most cases it is a good idea to compile Raspberry code on a Raspberry but there are situations in which it would be a terrible idea and others in which it is simply not the point of the exercise. We don't know which applies in this case, so we should not rush to condemnation.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 19335
Joined: Sat Jul 30, 2011 7:41 pm

Re: VS17 Help

Mon Dec 18, 2017 9:47 am

Right, angry mod alert. You lot should know better. If you want to have a bunfight, take it OFF THIS THREAD. You've probably already frightened of the OP. So great, well done you. Hiope you are proud of yourselves.

Idiots.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Please direct all questions to the forum, I do not do support via PM.

User avatar
jcyr
Posts: 59
Joined: Sun Apr 23, 2017 1:31 pm
Location: Atlanta

Re: VS17 Help

Mon Dec 18, 2017 3:18 pm

Real 3270s had wonderful keyboards and nice green letters on a black field. The first ones I used only did UPPER CASE text in 24 lines of 80 columns.
Indeed. And that same keyboard later showed up with the first generation of IBM PCs. To this day those remain the gold standard in keyboard design. Wish I had kept one.
If you want your child to get the best education possible, it is actually more important to get him assigned to a great teacher than to a great school. -- Bill Gates

jahboater
Posts: 2505
Joined: Wed Feb 04, 2015 6:38 pm

Re: VS17 Help

Mon Dec 18, 2017 3:34 pm

jcyr wrote:
Mon Dec 18, 2017 3:18 pm
Real 3270s had wonderful keyboards and nice green letters on a black field. The first ones I used only did UPPER CASE text in 24 lines of 80 columns.
Indeed. And that same keyboard later showed up with the first generation of IBM PCs. To this day those remain the gold standard in keyboard design. Wish I had kept one.
You can still buy similar:-

http://www.keyboardco.com/keyboard/orig ... ge-usb.asp

Oh dear, off topic.

User avatar
rurwin
Forum Moderator
Forum Moderator
Posts: 4249
Joined: Mon Jan 09, 2012 3:16 pm
Contact: Website

Re: VS17 Help

Mon Dec 18, 2017 4:44 pm

IBM M-type is just the tip of the iceberg. Its modern commercial version is probably the Cherry GP80. I've got one at home and one at work. At home it's been relegated to spare since it's so loud. But that, and just about every mechanical keyboard you will find out there, is just the Cherry MX blue key-switch.

http://www.wasdkeyboards.com/mechanical-keyboard-guide

This is my personal keyboard:
20140807_192740-600.jpg
20140807_192740-600.jpg (85.29 KiB) Viewed 1615 times
It uses Cherry MX red key-switches with dampeners -- very light, and very quiet

jahboater
Posts: 2505
Joined: Wed Feb 04, 2015 6:38 pm

Re: VS17 Help

Mon Dec 18, 2017 6:03 pm

Interesting, I didn't know about the dampeners.
I do find the IBM style "buckling spring" keyboards feel different to the cherry mx blues - a lot louder, but satisfyingly fast to type on, with few errors. I have both. Most of the time I use the Filco Majestouch 2 keyboards with the mx blue key switches.

Return to “General programming discussion”

Who is online

Users browsing this forum: No registered users and 1 guest