cvisual-studiocompilationserverexternal

Visual Studio - how to run and compile C on Linux server


We have had a group project in C (writing a compiler for brainfuck language). We had a pretty good project (with breakpoints, etc.) but we ultimately failed the assignment because our code wouldn't run on the testsystem the university uses. Its a Linux system.

Our tutor told us we should always use the server to compile and test our program to make sure its working correctly.

Now I asked her if its possible to compile and run the file on the server from Visual Studio, she said probably, and mentioned that in her (Linux based) IDE its possible. (normally we copy over the file with FileZilla, then from a sftp connection console access the server and compile and run our program on it which is tedious, so much that one of us wrote a script that does this.... but at some point we ignored it and just debugged from Visual Studio)

Is it possible to use a directory of the server as working directory and when I hit "start debug" it opens a console but connected to the server where some parameters to compile and execute will be used?

I couldn't find anything on the web about this topic, maybe I don't know what I'm looking for / what this is called.

PS: I use VS2015, they probably do too.

@Basile Starynkevitch

ah yes, I love Linux, in fact the last 2 people that came to me for laptop help I "talked into Linux", and if I ever have to setup my pc new I'll also use it. but for now I don't want to change anything to my pc since its totally bloated with stuff and a windows partition and I'm scared to change anything.

@mikedu95 that was what I was looking for. in the linked thread the only solution was WinGDB which costs up to 90 bucks per head. I think we will use a good ol script.

@Weather Vane The program does compile but doesn't run well / fails every testcase. (she even told us exactly what the differences are, why the problems have occurred) we did do periodic tests, but the endphase was pretty heated (3 day coding weekend till 3 in the night) and for the last hours we didn't have time for testing on the server (if only we knew how different it runs on Linux...)

@mah I did not ask to use a Linux compiler in VS but to use the compiler that is on our server from VS. I know what a compiler and what an IDE is


Solution

  • Visual Studio has a GDB extension for remote debugging on Linux. Instructions are in the blog post here... basically, the copy-the-files-over-and-build part of the process is automated using putty. Somewhat cumbersome (for larger projects a file share is probably more appropriate) but it seems to work.