Via Windows command line, how can we compile a Netbeans C/C++ application? - c++

Let's take this simple C/C++ application Netbeans project folder.
In Netbeans IDE, we just hit build button on the toolbar to build the application.
I want to do that automatically via Windows command line, how can I do that?
I did google, and found some related posts though not very helpful for me except telling me to call ant dist - though I don't have the build.xml in my Netbeans 8 project.
p.s. I have hundreds of student submissions and need to verify which one is compilable.
I also post on Netbeans forum here.

I want to do that automatically via Windows command line, how can I do that?
NetBeans uses Makefile-based projects as default for C/C++ projects, so you can use make to build your project:
cd <Project dir>
make
It's also possible to build other make-targets (eg. make all or make test (builds / runs tests)).
Note: The Cygwin bin dir (CYGWIN_HOME\bin) must be in system PATH - same applies to other environments (MinGW, Gcc etc).

Related

eclipse C++ remote compilation using cmake

Till now we are compiling our C++ project in CentOS using cmake files. Everything is working fine, now instead of putty we are looking for an IDE which will do the job from windows.
I tried with eclipse but not getting step by step documents which will do. I tried in eclipse neon and eclipse for C++ development. All works fine for local but when I say build should happen on Centos nothing works.
Using ssh remote system explorer able to view all the files.
selected the folder in system explorer and "Create remote project".
Able to see the project in the project explorer and all my files/folders are present and .project files also present.
in the .project file apart from name rest other tags are empty.
All the source folder has CMakeList.txt but how to use that in eclipse is question?
When I say build on eclipse it should build the src code on Centos.
Not sure which version of eclipse and additional tools needs to be installed.
If anyone have done already do let me know the execution steps.
Thanks
Vj

Building wxWidgets Hello world

The wxWidgets hello world example does not provide sufficient information to build wxWidgets in any one particular environment.
The Code::Blocks wxWidgets hello world example does provide sufficient information, but it does not seem likely that a newbie, or even a quite sophisticated user, could figure out all the necessary steps on their own, because there are arcane magic words required.
The Code Yarns example uses CMake, thus could run in many particular environments, but seems to assume that you have already set up wxWidgets and compiled it for your particular environment, and there does not seem to be a CMakeLists.txt file to compile wxWidgets for your particular environment.
wxWidgets is supposed to be cross platform and cross environment, and I am trying to set up a project to compile in several environments: on Windows10 Visual Studio, Windows 10 TDM-GCC, Windows 10 Code::Blocks, Ubuntu Code::Blocks, and Ubuntu 10 gcc.
And apart from the Code::Blocks environments, having trouble. Apart from Code::Blocks, I cannot find "Hello World" examples that actually set up wxWidgets on the target so that the Hello World will actually compile and run.
The wxWidgets samples directory is not particularly useful, since the samples assume an environment, and do not describe setting up that environment and the actions that will cause the sample to build and run.
Installation guide
I know this is a old question but I struggled really hard to find a guide for an installation on wxwidgets. You can use the vckpg importer by Microsoft. Make sure you have git installed before you follow this routine. I will write this for Windows with Visual Studio 2017:
Clone the following repository to a directory of your choice:
git clone https://www.github.com/Microsoft/vcpkg
Then open up powershell (ps) (run it as admin) and navigate to the cloned vcpkg folder
Now in ps, while you are in the vcpkg folder run the following command \.vcpkg integrate install so we have a user-wide integration of the vcpkg paket manager and can #include libraries in our c++ projects
Now to install wxwidgets 32-Bit run \.vcpkg install wxwidgets --triplet x86-windows. For the 64-Bit Version run \.vcpkg install wxwidgets --triplet x64-windows
Now open up the properties of your project in Visual Studio.
For the integration of the 64-Bit wxwidgets version choose all configurations and as plattform x64. Then go to C/C++ -> General -> Additional Include Directories and add the following folderpath YOUR_FOLDER_PATH\vcpkg\packages\wxwidgets_x64-windows\include;YOUR_FOLDER_PATH\vcpkg\packages\wxwidgets_x64-windows\lib. Do the same for the x86 configuration but with the wxwidgets_x86-windows folderpath instead.
As a last step go to in the properties under C/C++ -> Preprocessor and under the point Preprocessordefinition add the following as extra point WXUSINGDLL=1 (do it for the x64 and for the x86 plattform configuration if you want to use both)
Now you should be able to use the library and run the hello world project.
To build an app, first you need to have the library compiled. To achieve that you can get precompiled binaries or the sources (see Downloads) and compile them yourself (see Building).
Instructions might still not be perfect for everyone, and you are welcome to improve them - even call it your first contribution ;)
The installation instructions that I was looking for are to be found in wxWidgets/docs/install.txt
There are multiple ways to setup wxWidgets on Windows and use it in a project.
If your project is going to use CMake there are 2 main options (other than compiling stuff yourself some other way):
Use vcpkg - which, in theory, is the easiest, but I couldn't get it to work (in time). Here is some info on that: https://www.wxwidgets.org/blog/2019/01/wxwidgets-and-vcpkg/
The problem is find_package couldn't find the package, so then I just went to 2:
Download the lastest compiled headers, libs & bins from the wxwidgets and put them in a folder like c:/wxwidgets. Then, in your Cmake file, before the call to find_package, do:
SET(wxWidgets_ROOT_DIR "c:/wxwidgets/")
SET(wxWidgets_LIB_DIR "c:/wxwidgets/lib/vc14x_x64_dll")
SET(wxWidgets_CONFIGURATION "mswd")
The LIB_DIR is using VS2019 x64 in my case.
mswd just means build this for Debug
Finally, when adding the executable, do not forget the WIn32:
add_executable(membot WIN32 ${project_SRCS})
P.S.: Remember to extract the headers include folder near the lib.

Build (compile) a basic standalone .exe application using Qt-creator on Windows 8

I have installed Qt-5.7 on windows 8 because I couldn't build my released .exe from Linux (my favorite) in order to be used on Windows OS even after searching a lot on internet (Where there have to be cross-compilation...). After the installation, I just want to make sure that I can build/run a first application (one of the examples provided by default by Qt-creator "filesystembrows") and I have follow the official guide in order to build Qt as shared libraries, but the issue is that when I type the first command line I get: 'nmake' is not recognized as an internal or external command' Also it still show the same message even though a update the variable environment of the system with C:\Qt\Qt5.7.0\5.7\mingw53_32\bin which one is the default path set-up when installing Qt on windows. Any help just to make a stand alone .exe for Windows (as shared libraries ) please
Why not build your project by using qtcreator ?
Did you test your build environnement by making a test application with qtcreator ?
P.S.: If you want, I can explain how to build application using Visual Studio as a compiler and QtCreator as an IDE.
nmake is a build tool provided with Visual Studio and with Windows SDK. You don't have it, apparently.
It seems you're using a mingw build of Qt; it comes with a bundled copy of mingw. There, the build tool is simply called make.

How to integrate chromium browser project in Qt Creator in Ubuntu

I have managed to understand the structure of chromium browser and now I would like to use an IDE in order to make some changes for a personal project on a Ubuntu Trusty machine ( 14.04 ).
It is already compiled and I just want to use an IDE to make my life easier.
I have tried to add chromium to Qt Creator by using the option open project but without any luck.
Could you please guide me to have this achieved ? Some steps would be really helpful. More, it would be possible to compile / build chromium from Qt Creator ? ( avoid typting in console ninja -C out/Debug chrome chrome_sandbox and out/Debug/chrome every time)
If you guys can suggest me another IDE that you're used to, please, guide me and I will change the title of the post.
//UPDATE 1
I tried to make those configurations for Build / Run as it follows:
Build:
Run
I get the following error:
:-1: error: No rule to make targetall'. Stop.`
//UPDATE 2:
The error from Compile output section
You can edit any code project in Qt creator, but you can't use Open project, when it isn't a Qt project. Instead use Import project -> Import existing project in the New project dialog.
When you have an existing project, you can define new build steps in the Projects tab. Under Build steps just choose Add Build step -> Custom Process step.
Here you can fill in your command using the fields Command, Arguments and Working Directory.
In your case, you would for example fill in ninja, -C out/Debug chrome chrome_sandbox and %{buildDir} for the first command.
Similarely, you can click on Run (on the top of this tab) to change how the your project is executed after successful compilation.
Just run in src folder:
gn gen out/Default --ide=qtcreator
And open in QtCreator src/out/Default/qtcreator_project/all.creator

How to correctly configure netbeans 6.7 and c++ on windows?

I have installed and configured NetBeans 6.7 for c++ according to the official manual:
http://www.netbeans.org/community/releases/67/cpp-setup-instructions.html#mingw
Configuration window looks like this:
Unfortunately, at 'compile' command following line is displayed:
/usr/bin/make -f nbproject/Makefile-Debug.mk SUBPROJECTS= .build-conf
BUILD SUCCESSFUL (total time: 642ms)
Since i'm on windows and it's no /usr/bin/make, no executable is compiled :(. How to correctly configure NetBeans so it will use make from it's config, not from /usr/bin?
Updated
Problem is only with mingw/msys toolchain. It works OK with cygwin (same /usr/bin/make message is displayed, but executable IS created). So the question can be changed to: Can Netbeans 6.7 work with mingw on Windows, or i'm limited to cygwin?
I had problems getting Netbeans 6.7.1/C++/MinGW working too. I don't know if this will help but I thought I'd describe my experience anyway.
I was having successful builds but Netbeans was unable to launch my executable. I was able to verify that the executable was being built and I could run it from an external command prompt. I was also unable to open the properties on my project.
After a day of searching the net, I found a tidbit of info that lead to the solution.
Basically, it all boiled down to not having the path to my build tools set in the windows environment path. After I set the path environment variable, I cleared all the Netbeans configuration so I could be sure about setting things up from scratch. You can do this by deleting the .netbeans folder in your user directory in c:/Documents and Settings.
That should all be done with Netbeans closed of course. Afterwards, start it up and setup your build configuration before you create any projects or load existing projects. Go to Tools/Options/C++ and point it at the build tools directory you added to your environment path (c:/MinGW/bin and c:/msys/1.0/bin) and the individual tools as required.
I have my msys stuff in the same directory as the MinGW stuff. As an extra precaution, you may want to make sure there are no same named programs in both bin directories that may cause grief.
I seem to have a C++ development environment now that I'm quite pleased with as I can use it in Windows and Linux. Hope something in there helps.
Can you check on the "project options" on your picture and look if the default platform is windows ?
Have installed netbeans on both linux and windows machines and it's strange that it didn't work "straight out of the box" after following the instructions..
You did double check everything right? As it seems that path variable isn't setup correctly in your environment.
The picture also says that the debugger is missing/invalid.. Did you follow these 16 steps (step 14 for installing debugger) or did you use something else?
Last but not least, your "error" message says that the build was successful. Where did you look for the .exe ? It should be under
dist/<Configuration>/<ToolChain>/