I have installed Bochs and DLX linux in it. I wrote a Hello world C program in it. But I don't know how to compile the program in it.
When i type gcc hello.c i get an error saying "bash: gcc: command not found".
Please suggest.
Thanks
DLXLINUX is a very small and a bit outdated distro. Maybe you need to create a certain environment inside the image in order to use gcc and stuff.
Here is a small tutorial teaching how to set a network for it. Maybe after it you can play with it:
http://bochs.sourceforge.net/doc/docbook/user/dlxlinux-networking.html
Related
The program I am trying to compile for my arduino micro does not compile in the 'standard' arduino IDE. The reason is subject to a completely different topic discussed at the arduino forum. Cut a long story short, I write pure C and the arduino GUI only does C++. Trust me, I have tried to tweak the interface so it would use avr-gcc, but you enter in an infinite compile - error - refactor loop. I need an other solution.
I am using code::blocks as IDE and want to flash the avr-gcc compiled code onto the arduino micro board using avr-dude on linux kubuntu machine. How would one achieve this?
Problem is I have been running in circles for quite some time now trying to find the correct command line arguments or code:blocks post compiler settings. All information out there is either very old or irrelevant.
I'll keep you posted if I find relevant info
avrdude -V -F -C <avrdude.conf> -p <processor> -P <tty-port> -c stk500v1 -b <baud-rate> -U flash:w:<your-application>.hex
An easy way to see all the settings and get a suitable command line for your system is to use the Arduino gui. Enable verbose upload in the preferences, then program in a basic program like blink. Copy/paste that command line and change the hex file.
I did it here
here
body 24262830
I want to program at my school in my free time, but the compilers they have are buggy. I want to use gcc. The rules at my school say that I cannot install anything on the desktops there. I was thinking about installing gcc on a usb then I would use a bash emulator to compile the files. Would this work and if not how would I do it then?
I'm using this whenever I need to code on a laptop/PC i don't own : https://code.google.com/p/pocketcpp/
It compiles C and C++
The following html link contains all the relevant bash command line records of the installation process. Thank you for help!
That was a bad question
I didn't use XCode through I know Xcode will make it easier! I use an Air, memory of 4GB currently.
If this won't work easily I probably will quit learning C or run and compile C on Windows. :(
And XCode stuff, whatever.
You command-line output indicates rather clearly that you aren't telling gcc what to compile, so it's throwing its hands up in exasperation:
$ gcc
i686-apple-darwin10-gcc-4.2.1: no input files
You'll need to specify the file you're compiling. Better yet, use an IDE, like Xcode.
<Shrug> What do you want us to say?
Obviousy Macports is trying to build/install gcc but it can't without a compiler. Yes gcc can be built without a preexisting compiler, but good luck and why? Especially when XCode is a free download, click click let it start and a little while later it's done. At that point as pointed out elsewhere, gcc, g++ will work, but it's not actually gcc but clang in disguise.
If you want, you can use macports or brew or whatever later if you really want to, but again why? For programs that only work using gcc extensions? Doubt it. You just want a c/c++ compiler. If you ever want to do programs for the Mac or IPhone, you need XCode anyway, gcc won't do.
I'm trying to compile a simple C program on mac However I can't ever seem to get Xcode to work so I want something else. I also want to check the code for errors while I'm running it anyone got a good idea?
open Terminal, cd to your source directory,
then type gcc -Wall yourProgram.c -o YourProgram and if everything is good, you will be able to execute the program typing ./YourProgram
Also, if you are just learning C, then do not use IDEs just yet. get used to the terminal and as your experience builds, move to an IDE.]
Also there are tools like lint that analyze your code statically. Use gdb and if available, use valgrind as well for runtime debugging. I am not sure if valgrind is available on mac. Have a look at dtrace and how to use it.
I am trying to run a MPI program with C language.
I have installed GCC compiler and the openmpi libraries. I am running ubuntu Linux and Netbeans IDE. My challenge is that after including ‘mpi.h’ in my header file and compiling the application, I still get ‘fatal error : cannot find file mpi.c’. I have the files in home/user/lib/openmpi/include, but I cant get it too work.
Can anyone help?
You could try to change the compiler to /path/mpicc and the debugger to mpirun. This should work, although I did not test it, but probably the best way to compile MPI code is via terminal.
If you really depend on the IDE you cound try writing your code with it (to take advantage of auto-completion and such) and compile it in terminal using mpicc -o main.exe main.cpp [other .cpp files] and run it with mpirun -np number_of_processes_to_use ./main.exe [args]. You could write a small script or a Makefile to do it all in one command.
Good luck!
to save yourself some sanity, I'd recommend opening up a terminal and going from there (at least until you figure out what's what).
Also, using the mpi compiler to do things would simplify your life. (and likely automatically solve the missing source issue, as it should know where they are by default).
If you still can't locate them during compile then I'd look at adding the location where mpi.c & mpi.h are located to your C Include Path: How to add a default include path for gcc in linux?