What's the difference between SciTE4AutoIt3's Build and Compile options? - build

In SciTE4AutoIt3's Tools menu I can choose Build or Compile.
What's the difference? They both create an .exe file.

A build is series of steps which usually include:
Compilation
Updating of Version information
Inclusion of resources and manifest information.
For AutoIt, using the SciTE editor, Compile and Build are almost the same. The only difference is that Compile presents you with a GUI where you can alter compile settings, such as which packages to include. Build will just run Compile with default settings.

Related

Understanding how to compile C++ project

I'm new to coding and Visual Studio. I know and understand how to create, save and compile a new C++ project in Visual Studio. I understand that a new VS project creates a solution file in the directory which then I can use to open the project, etc.
What I don't understand is how to compile a C++ project which doesn't have a VS solution file. I mean, do I have to manually create a project and import files and then build it?
Please take this GitHub project as an example. Under information, it clearly states the following:
Building
To build a static library (./lib/ompeval.a) on Unix systems, use make.
To enable -msse4.1 switch, use make SSE4=1. Run tests with ./test. For
Windows there's currently no build files, so you will have to compile
everything manually. The code has been tested with MSVC2013, TDM-GCC
5.1.0 and MinGW64 6.1, Clang 3.8.1 on Cygwin, and g++ 4.8 on Debian.
Now, what I don't understand is how do I build this project in my VS software so that I can successfully run it? Any help would be appreciated. Thank you.
As you said it, create a new project in Visual Studio and just import the source and header files. Looking at the makefile, there doesn't seem to be any pre or post build events so you can import the files and compile them right away (as long as the code is platform compatible ofc).
You may have to create multiple projects. One for the static library and one for the test files, since Visual Studio projects usually have one output type only. Mostly one of the presets: dynamic library (dll), static library (lib) or executable (exe).

Compiling GRPC 0.15 with MSVC 2015 for usage with Qt 5.6 on Windows

The process is extremely non obvious and error prone so I think a place where a proper procedure is described is required.
I will answer my own question below, but it is more or less a hack and slash solution as Visual Studio is mostly Terra Incognita for me and I just stumbled on a combination that works after a lot of trial and error, sometimes not even understanding what I am doing. If it looks horrible - sorry about that. There was simply no proper guide for me to use.
Steps:
Download GRPC and Protobuf3 from their respective github repositories.
It is better to use GRPC from repository than from zip package because this way you will be able to populate "third_party" folder via git.
Download CMake/CMake-gui and feed protobuf\cmake folder to it. This will generate your visual stuido projects
Compile All_Build.vcxproj as is in release mode. This will generate protoc.exe file which you must store somewhere.
Here comes the trickery:
By default, Release protobuf/grpc projects are compiled as /MT.
Chances are - qtcreator is compiling your projects as /MD.
If you try to use the library generated by MSVC as is - you will get a library format conflict.
So first step is to edit libprotobuf subproject:
C/C++->Code Generation->Runtime Library to Multi-threaded DLL (/MD)
Next problem: default project will generate a .lib file, that even with /MD I have been unable to succesfully attach.
If anyone knows how to avoid a lot of "undefined reference" errors while trying to use it, feel free to comment below.
// these are only necessary if you can't link statically as I do
Configuration Properties->General->Target extension : .dll
Configuration Properties->General->Configuration Type : Dynamic Library
We also have to add a bunch of defines:
Configuration Properties->C/C++->Preprocessor : add PROTOBUF_USE_DLLS;LIBPROTOBUF_EXPORTS
Now you can compile protobuf. Do this and store libprotobuf.lib and libprotobuf.dll somewhere
Onwards to grpc.
Open grpc.sln
As I am not using MSVC for my work routinely these later steps were non-obvious.
You will need Nuget installed in Visual Studio before anything else.
Nuget will, on compilation, pull a bunch of dependencies into your grpc\vsprojects\packages folder.You will need .dll's from there later if you plan to deploy your app.
Once it's installed go and switch /MT /MTd to /MD /MDd depending on the mode you plan to use, the same as for protobuf.
/MD corresponds to Release build (for me) while /MDd is for Debug
Also, you need to remove "z" and "borinssl" subprojects as they are broken on windows and won't let you compile properly.
Compile the project. It will produce grpc.lib grpc_unsecure.lib grpc++.lib grpc++_unsecure.lib which you will need to store somewhere accessible to qtcreator while it builds your project (same with libprotobuf.lib and libprotobuf.dll)
Open grpc_protoc_plugins.sln
Add a folder that has libprotobuf.lib to Library Directories in project configuration.
Compile grpc_cpp_plugin. It will produce grpc_cpp_plugin.exe which you need to store with protoc.exe
If you plan to deploy your app you will need to copy a bunch of dependencies nuget collected for you from packages folders:
libeay32.dll
ssleay32.dll
zlib.dll

Eclipse CDT Kepler Importing Makefile project

I would love to import a Makefile project from Eclipse, and have all the different includes path that the compiler uses to create correctly my Eclipse project.
Unfortunately, those path, specified on the command line by a "-I" don't show up in Project Explorer and I have to add them by hand.
I am currently importing the project using the standard "Import project from Makefile" built in Eclipse.
If I'm not wrong there was an autodiscovery option in older versions of Eclipse, but it's not there anymore.
How do you do for having all your include paths set up without too much hassle?
The trick is NOT to use
File->New->Makefile Project with Existing Code
but to use
File->New->C++ Project
and then to select
Makefile project->Empty project.
After you set up such a dummy project, you simply copy your existing source to that project directory, hit F5 (i.e. Refresh) and change the build command to use your Makefile.
I was able to get this to work using Luna. I imported using File->New->C++->Makefile Project with Existing Code.
Prior to launching eclipse, you have to be sure to source any files that set required environment variables.
I did have some build options which were not the standard all and clean, so I had to add those configurations individually.
source files to setup your environment.
Launch Eclipse
Import C++ Makefile project
Setup Build options.
Click the hammer.

Build project has encountered a problemm Eclipse C++.

Details are saying I have two different tools of the same compiler. I'm not sure where to go from here to fix this so I can build my project. Any ideas?
This is the detailed message:
Errors occurred during the build.
Errors running builder 'CDT Builder' on project '263_Hw'.
Internal error building project 263_Hw configuration Debug
Generated resource conflict:
two resources of the same name: /263_Hw/Debug/main.o
generated by different tools
tool1: GCC C++ Compiler
tool2: GCC C++ Compiler
Generated resource conflict:
two resources of the same name: /263_Hw/Debug/main.o
generated by different tools
tool1: GCC C++ Compiler
tool2: GCC C++ Compiler
Internal error building project 263_Hw configuration Debug
Generated resource conflict:
two resources of the same name: /263_Hw/Debug/main.o
generated by different tools
tool1: GCC C++ Compiler
tool2: GCC C++ Compiler
Generated resource conflict:
two resources of the same name: /263_Hw/Debug/main.o
generated by different tools
tool1: GCC C++ Compiler
tool2: GCC C++ Compiler
The most likely situation: you have two source files with the same name but different file extensions. In your case, that would likely indicate you have something like
main.c
main.cpp
in your project tree. Could be tricky to see, especially if you have a lot of nested folders. I'd go to your source root and do a search for main.*
In Ecplise, right Click on project -> Properties -> C\C++ Build -> Tool Chain Editor. In the 'Current Builder' select box, select 'Gnu make builder' -> Apply (or Ok).
Try building the project again.
If you've exhausted all other options try using the gcc make tool directly:
1) Open the command line
2) cd to the folder containing the Make files (i.e. # cd 'C:\Path\To\MakeFile')
3) Assuming you have a typical MINGW windows install, run the command # C:\MinGW\bin\mingw32-make.exe all
4) the above command can be shorter if you have the MinGW folder set as a path variable.
5) The output binaries should be found in the bin folder in the same location.
Hope this helps anyone.
I have seen this same problem before but i don't remember what i did about it! For starters one way to try to solve it is by checking if you have more than one MinGW folder installed on your computer (I am assuming you use MinGW)! Also Check your project properties->c/c++ General->Paths and symbols->Includes and making sure that there are links to only one minGW folder! (It may look something like this (except for you they may start with "c:/mingw/...":
My solution was to delete the project (not the source code, just remove the project from Eclipse) and recreate it from scratch and setting up the include paths and linker paths again. Then it compiled properly.
This happened to me after I deleted a project from the workspace. I reimported the project with the same name to the same workspace, and when I tried to rebuild I got this error.
What I did was to delete the project from the workspace again, and then check my local directory where the workspace folder is. Voila, the deleted project is still in the workspace folder. So I deleted that project folder, then reimported the project again. It worked for me this way ;)

Eclipse CDT build/run on file basis

In my scenario I have a C++ project in CDT Eclipse. This projects however is rather a collection of individual (helper) programs than one complex application. Consequently I want to be able to build and run them individually.
My project structure is very simple and looks like:
src/app1.cpp
src/app2.cpp
src/...
Note that I do not have common header files or libraries. However I want to be able to add programs to this project just by creating e.g. src/appx.cpp
Ideally I want to have shortcuts for
"Build currently opened .cpp"
"Run binary of currently opened .cpp"
Any suggestions on how to achieve this behaviour, if possible without additional plugins?
The straightforward way to succeed what you aim is to create a Makefile project with CDT and add a new target rule for each of your applications inside your Makefile. You can even use SCons or other build systems with a CDT Makefile project and obtain the same effect.
You can also trick the managed build to create executables instead of object files. Remove -c option from Other flags of C++ compiler settings inside project properties. This will produce a separate application file for each of your source files.
Application files which are created inside the build directory will have the object file extension and they will not be executable. To solve this, you can add a post build script in your project directory such as:
postbuild.sh for Linux:
chmod +x *.o
rename -v 's/\.o$//' *.o
or postbuild.bat for Windows:
rename *.o *.exe
After adding ../postbuild.sh or ../postbuild.bat as a post build command in your build settings, you applications will be ready to run. Right click on any of these executable files and choose Debug As or Run As and a new Run configuration will be created.
Also you will have to stop the linker of the managed build to prevent errors. This can be achieved with changing the linker command to true (Linux) or true.exe (Windows, msys).