I have came to the new company where at the testing department is a lot of non-programmers. The issues is that the C++ programming experience are needed to write a specific test case (there are more test managers). They have learn some basics and use some standard stuff. Now they push me into the project where we must make their life's easier in several stages.
One of the tasks in the first stage will be to get rid of all terminal commands, so there must be some kind "one click compiling/build" solution available, what is little hard to achieve especially in case when they use both windows and linux approach on the test-benches. I have overview several options:
to install MinGW (or GCC) for compiling (installing on computer needed) + batch files (the problem here is that installing is needed - possibility to compile at "save" button
or docker connection with text-editor (visual studio code) to "remote compile" (https://code.visualstudio.com/remote/advancedcontainers/develop-remote-host)
The question is if there is any other option or approach that can be used in such case? Or which option will be choosen by you? Another stage for them will be also GUI editor for test cases, but this will be a loooong stage. In the first stage we are searching some "between" stage to make there life easier (standard lib + easy compiling solution).
Thanks!
I try to use Xcode (v.7.3.1) for my C++ project (build system - make), but the experience is quite poor (and it was always like that since old versions like v4 when I started using it) - code completion doesn't work, color syntaxing works oddly (no coloring sometimes, or partially colored code), no "jump-to-definition" functionality, can't switch b/w header/source files with shortcuts. Basically, it's just a text editor where I have to use "Find" and Cmd+Shift+O all the time.
Is this intentional and Xcode will never get any proper support for C++ projects with external build system (make) or am I misconfiguring my project? How can I re-index files in the project? How can I make code completion work?
Thanks,
I believe there is a way to use Xcode with makefiles by adding an external build target, file->new->target->External Build System.
This is an older tutorial but the steps may be worth looking through: http://web.ist.utl.pt/jose.alberto.coelho/mac/MakefilesXcode.pdf
I've never had a problem with the syntax highlighting, but I remember the refactoring support being limited for C++ in some ways.
So, I ended up using this workaround: even though, I use external build system, I create Console Application project in Xcode and choose C++ language in settings. Then, I simply add my source files to the project (just drag folders from the Finder window) and then manually create project targets of type External Build System as I need. I don't use default target and don't use generated main.cpp file at all.
My files get indexed with no problems. I'm also able to debug code as I used to.
I still think Xcode developers should review indexing process for the projects with external build system...
Thanks for all the insights though!
I am a student studying statistic.
And my C++ teacher asked us to submit project always by code::block.
However, I am more likely to work with mac os.
And code::blocks not running good with mac.
Is that possible to convert Xcode/Visual studio project to code::block
You need to keep in mind that code::blocks or XCode are IDEs (Integrated Development Environments) which means basically they are text editors. What you need to build a program is a compiled and an IDE usually comes with a compiler bundled with it. What an IDE usually does is keep all you files together and add some info like compiler switches and so on.
This job is usually handled by a separate program, the build tool. The make program is probably the oldest of these programs and you need to have an idea of how they work.
To get to your question you can build your program with whatever editor/IDE you want, then you may need to get your .cpp files and import them in another one.
I'm usually using Visual Studio, but several things bother me when I just quickly want to test some code:
it has a rather long startup time
it always needs a project to execute/debug files
program output gets printed to the console, but the window simply closes when I don't insert a getchar() or a breakpoint in the program and thus I'm not seeing it.
I'm looking for a program which is suitable for a really, really quick programming in Windows. Such as, copying some code from an SO question, running it and seeing its output.
I don't think that console programs or g++ under CygWin are a good solution, because there it takes ages to cd into the right dir to save the file, I'm not used to editors such as Vim, and typing in the compiler commandline myself has always annoyed me etc.
So I guess what I'm looking for is a very lightweight free C/C++ IDE which is preconfigured to work with a free compiler (bonus points if it is even shipped with it.)
What can you recommend which adresses at least two items from the list above?
Is there maybe even a program which can execute/interpret C or C++ in an interactive commandline (like Python)?
I'm looking for a program which is suitable for a really, really quick
programming in Windows. Such as, copying some code from an SO question
and executing it and seeing it's output.
For quick-and-dirty experimental coding, I really like codepad.org. Not having to create a file is especially nice as it saves me from coming up with a suitable name and disk location. Be aware that it uses g++ 4.1.2 behind the scenes so some of the latest C++11 features aren't supported.
"really, really quick (and dirty, throw away?) programming "?
Compiler : VC++ command line - you already have it.
Editor: Notepad or somesuch
Compilation process: A .BAT file you write once
and supply a parameter with the name of the single source file.
Location: Set up some desktop shortcuts to a known directory for your
test code.
Use TCC : Tiny C Compiler
start a command prompt
cd wherever
notepad main.c
write code in notepad. save
back in the command prompt type tcc -run main.c
notice errors, go back to 4
Note that with -run parameter you're invoking tcc like an interpreter
Which compiler you use doesn’t really matter. I prefer G++ but cl.exe (from Visual Studio) works equally well.
In order to use the compiler quickly from the command line, either
include it into your PATH variable by setting it in the system settings, or
create a simple .cmd script which launches a console with the right paths included.
Visual Studio incidentally comes bundled with such a .cmd script which is linked in the Start Menu entry of Visual Studio. Personally, though, I prefer adjusting the PATH variable.
Then you can simply invoke the compiler from any directory in the command line. If you are too lazy to write the whole command line, create a script to do it for you. Or use Cygwin and (C)Make.
Two additional remarks:
Starting the project using the build configuration (Cntr+F5 (?)) leaves the console open after the program has run, without you having to include getch() calls or similar.
I highly recommend you learn an editor such as Emacs or Vim, unless you plan never to use any other platform than Windows, and even then. These editors are just tremendously powerful, and in some ways light-years beyond what the Visual Studio code editor offers.
But if you really don’t have the time, use a decent text editor such as Notepad++ instead.
Open Watcom is easy to install and use, it's fast and it's the closest compiler to MSVC++, although it's noticeably behind in features (especially in C++).
I don't use its IDE at all as I got used to doing most of the stuff in the console, but it's there and the debugger is there too.
Compiling one-filers is easy.
Compiling C code:
wcl386.exe /we /wx /q sourcefile.c
Compiling C++ code:
wcl386.exe /xs /we /wx /q sourcefile.cpp
On my machine, I have a "empty" project called "Test". When I want to test some random code on the internet, I simply put it into main.cpp in that project, and compile.
If you think MSVC takes too long to load, it should be possible to write a batch script that attempts to compile the project and puts the build log in a file. Then you can simply alter the existing main.cpp with notepad, double click the batch file, then pop open the build log or run the executable.
[Edit] I made a batch file to compile the entire solution. Turns out that requires loading visual studio. However, the batch file can compile/run a single cpp file easy enough.
My favorite IDE: http://www.codeblocks.org/
Here is a direct link to the download that includes the MinGW compiler: http://download2.berlios.de/codeblocks/codeblocks-10.05mingw-setup.exe
You're not gonna find any (good) C/C++ interpreters.
Once I used PSPad setting its "compiler" option for C++ files to a reasonable default (cl.exe in the correct directory, speed optimization, all warnings). Then it's just Ctrl+F9.
All of the above compiler recommendations are good. For an editor, I really like Notepad2
I know you didn't ask...
First off, your expectations are not reasonable. no program can guess what you want, over a range of input from the simplest to the most complex. If cd'ing into cygwin is too hard, and starting up visual studio is too time-consuming, you're pretty much toast. Sorry.
That said, you can edit code with notepad (which you can invoke from the command line as notepad foo.cpp). Notepad uses your mouse and the arrow keys on your pc so it's pretty intuitive.
you can use visual studio tools from the command line, without having to fiddle with project files.
Visual studio comes with a tool called nmake, the most basic usage of which is similar to linux make. If you have very simple input, nmake's default rules may be good enough to produce an executable. If not, you may be able to construct a makefile that will take any single simple file, say foo.cpp, and compile and link it to an executable called foo.exe. You'll still have to learn to use nmake, which some people think is easy, and others think is fiendishly difficult. Try nmake foo.cpp and see if the result is what you want.
we work under Linux/Eclipse/C++ using Eclipse's "native" C++ projects (.cproject). the system comprises from several C++ projects all kept under svn version control, using integrated subclipse plugin.
we want to have a script that would checkout, compile and package the system, without us needing to drive this process manually from eclipse, as we do now.
I see that there are generated makefile and support files (sources.mk, subdir.mk etc.), scattered around, which are not under version control (probably the subclipse plugin is "clever" enough to exclude them). I guess I can put them under svn and use in the script we need.
however, this feels shaky. have anybody tried it? Are there any issues to expect? Are there recommended ways to achieve what we need?
N.B. I don't believe that an idea of adopting another build system will be accepted nicely, unless it's SUPER-smooth. We are a small company of 4 developers running full-steam ahead, and any additional overhead or learning curve will not appreciated :)
thanks a lot in advance!
I would not recommend putting things that are generated in an external tool into version control. My favorite phrase for this tactic is "version the recipe, not the cake". Instead, you should use a third party tool like your script to manipulate Eclipse appropriately to generate these files from your sources, and then compile them. This avoids the risk of having one of these automatically generated files be out of sync with your root sources.
I'm not sure what your threshold for "super-smooth" is, but you might want to take a look at Maven2, which has a plugin for Eclipse projects to do just this.
I know that this is a big problem (I had exactly the same; in addition: maintaining a build-workspace in svn is a real pain!)
Problems I see:
You will get into problems as soon as somebody adds or changes project settings files but doesn't trigger a new build for all possible platforms! (makefiles aren't updated).
There is no overall make file so you can not easily use the build order of your projects that Eclipse had calculated
BTW: I wrote an Eclipse plugin that builds up a workspace from a given (textual) list of projects and then triggers the build. That's possible but also not an easy task.
Unfortunately I can't post the plugin somewhere because I wrote it for my former employer...