Cygwin Gcc - Access - c

I'm currently on Windows Vista Basic.
I have recently started on Eclipse, and for that I was required to install cygwin.
After that I made an edit in the PATH environment variable in "My Computer>Properties>Advanced Settings". In order to check the functionality, I started cmd-prompt and types
C:>gcc
This gives the following output: ACCESS IS DENIED
I know it's a security permission problem, but I don't know where exactly to do the change in the security settings. Last time I tried it started showing "error-illegal operation" and some error code.

You can not use gcc in your cmd. you must use it in cygwin shell that installed when you install cygwin

You can use gcc without using the cygwin shell !!
But you will probably end up with some configuration problems,
such as not having the correct dll's in the right places.
Another common error that can occur, is if you have multiple instances
of cygwin installed, the search paths get confused and the gcc system
can't find relevant compiler or tries to use the wrong compiler.
All the same this is very possible, I've done it myself hundreds of time,
when testing compilers I have written.
You might want to try invoking 'cc1.exe' for c, or 'cc1plus.exe' for c++,
remember to copy the cygwin dll's into the same directory as cc1 or cc1plus,
Other than that it could be your user account permissions.
Hope this helps.
/Tony

Related

Using Visual Studio 2008 with Code Warrior compiler

New to the site. I am hoping you can help me as I've been beating my head against the wall on this one for a month now.
This is for work, and we are kind of proprietary but I will try to share as much information as possible. We have MPC5674F microcontroller on our main development board. To write code before, we used Microsoft Visual Studio 2008 along with a makefile and gcc compiler to create a .s19 file that is then flashed onto the board. Before, Visual Studio would not recognize make command. I went into C:\MinGW folder and found 3 different make.exe type files. There is gnatmake.exe, mingw32-make.exe and regular make.exe in C:\MinGW\msys\1.0\bin. I also found a regular make.exe in an NXP folder from the S32Design Studio. All of those make commands give me different result. If I change one that is by MinGW, then it gets stuck in the makefile saying The system cannot find the path specified to an echo.exe command, even though I can once again go into command window and type echo and it outputs ECHO is on. If I use just make.exe from either NXP of the other folder from MinGW, it compiles without errors but there is no file output, or even the process of how it compiled. In our makefile we specify to output each file that it compiles and nothing happens. If I use gnatmake.exe It gets stuck at command gcc -c -Ietc\ -I- -x ada etc\makefile where it says there is illegal character and target_name is an Ada 2020 feature. Not sure what any of those mean.
I managed to somehow previously get this to compile before, but since then the PC (Windows 10) had to be wiped and reinstalled. Guys that have set this up are long since retired (before I started) so I am hoping you guys can help me out.
Okay so I managed to get it to work. How, I am not entirely sure. I did wind up editing my commands for linux inside the makefile to have quotes around them because Windows kept removing slashes from the path written in the makefile. Also I provided a path to the Unix utilities and the make.exe to C:\MinGW\msys\1.0\bin instead of C:\MinGW\bin. I also had to add the same path to the $Path variable in Environmental Variable The code compiles now and seems to work after flashing it onto our system. My hope now is the instructions I wrote for anyone else to do this will work and I didn't forget something.

How do you debug C code in visual studio code

If I am to compile my code in the terminal, I would do:
cc -std=c99 -Wall -Werror ....
If I'm to run my code in the terminal I would do:
./testprogram text.txt 1000 1000
The numbers and the text file is significant to the program.
Hopefully that gives some insight into the version of c I'm using and how to execute my program. Now: how do you debug this with visual studio code? I have installed the c/c++ extension.
Every time I try to start debug it asks me to chose between two environments:
c++ (GDB/LLDB)
c++ (windows).
My first problem is that non of those two options are just plain c, but maybe I just don't know better and there isn't much difference. Never the less, I gamble on one of the environment, usually the first one, then I'm asked to pick between:
two gcc-9 build and debug active file,
one gcc build and debug active file,
and defult configuration.
I usually pick the defult config one and that leads me to the launch.json page. I put in my program directory: "${workspaceFolder}/testprogram.c" and error.. :
Unable to start debugging. Launch options string provided by the project system is invalid. Unable to determine path to debugger. Please specify the "MIDebuggerPath" option.
Nothing I've tried so far or any googling have helped so hopefully someone with a lot of experience would be able to help out here. Thanks in advance.

Can i compile a C program using GCC which automatically asks for admin rights?

I'd like to compile a program which simply kills a task after a previously executed program has quit. This doesn't work without admin privileges.
I'm aware that you can choose "Run program as administrator" from the compatibility tab in the properties of the executable, but if possible I'd like to avoid the necessarity of doing so when distributing the program.
I'm using GCC 4.8.1 on Windows 8.1 to compile.
Edit: About 5 years later I'd propably have gone with system("tskill <processname>") in this situation, since it doesn't require admin rights on user processes. Alternatively some hack using runas/vbscript.
It looks like this may have already been figured out - you might want to look here and see if any of this helps: Embed manifest file to require administrator execution level with mingw32
From what I can tell by reading that question, it seems that requiring administrator rights to open an application is not something you have to do in code, but instead involves the resources in the compiled executable. That is not something I am too familiar with, but it looks like the link I gave can get you started down the right path.

Getting the examples in libspotify to work under Windows 7

I want to get started with libspotify on my Win 7 machine but I dont have a clue on how to get it all setup so that I can even run the examples included in the pack. I have a Spotify Premium account and I have tried installing libspotify by copying libspotify.dll to c:\windows, c:\windows\system32 and to c:\windows\SysWOW64 and also changed the path variable to include the path where libspotify.dll is located but I still dont understand how to get the examples to work.
I have Code::Blocks installed but as soon as I try to import and run any of the .c files included in the /examples/ folder I get all kinds of error messages. The truth is that I am not even sure how to install libspotify and the documentation is absolutely non existent so for a beginner it is impossible to even have a chance at getting started.
Is there somebody out there who can do a simple walkthrough on how to install libspotify and get the examples up and running on a Win 7 (64-bit) machine?
The only thing I really want to do with libspotify is to be able to via a command prompt or something like that be able to queue a song in Spotify so I dont really care about the other parts. But I can probably solve that by myself as long as I can get an example up and running.
Sadly libspotify is not well-supported on Windows, in fact the example code won't even build because there is no Windows audio driver for them. Your best bet to just get up and running would be to use mingw, or linux in a VirtualBox environment.

Eclipse cross-compile... how can I do that?

I am developing on a Windows machine using Eclipse in C code.
All the files are physically located on a Linux server.
I am using Eclipse only for editing and code browsing.
When I want to compile, I open a terminal and telnet to the Linux server from which I call a file that sets up few variables and eventually invoke a "make" command.
The server is pretty busy.. I would then like to be able to compile locally [and then just ftp these executable files back to the Linux machine so that I can execute them.. unless Eclipse can do that on its own :) ].... any idea how can that be done? I am not well versed in Eclipse or OS usage.... so if you could answer and explain what I should do.. I would really appreciate...
I changed the Build Command under Project Properties menu by just calling the script file on the server I usually invoke to compile... That looked fairly simple.. well... that was too good to be true... and of course.. it didn't work! I am getting this error if I use the default "make" (Cannot run program "make": Launching failed).... while getting (Cannot run program "T:\compile": Launching failed) if I try to invoke my script file that I use to compile...
thanks,
You should take a look at running a crosstool-ng setup on your windows box inside cygwin. And then have eclipse use that compiler. This will allow you to develop for your target Linux platform easily.
Here's some slides
It sounds like you're developing for a desktop/server platform, so you'll have to make sure you set up your crosstool-ng with the same versions of standard libs as your server has (libc, libstdc++, etc). You also want to make sure your crosstool-ng has the same version of gcc as the target as well.
If you don't want to mess with getting all that setup, you could always install Linux as a virtual machine on your windows box and work inside there.

Resources