Page 1 of 1

Unable to compile the simplest hello world project

Posted: Tue Feb 27, 2018 3:51 pm
by bleriot13
Hi!

I just installed CodeLite and I guess that I'm falling in the most stupid of errors because I can't generate the classic Hello World C++ program.

I'm working on Windows 10. My compiler is MS Visual C++ 2015. CodeLite seems to have identified it correctly.

I first create a C++ workspace. Then, I create a project inside this workspace: name: hello_world; template: console / Simple executable MVC; create separate folder (hello_world, inside the workspace's folder); compiler: Visual C++ 14 (x64), debugger: GDB, build system: default.

The project shows up under the umbrella of the workspace. It contains two folders, src and include. Right click on src, then "Add a new file...". I select "C++ Source File (.cpp), and call the new file "main.cpp". It is located in the project's folder. It shows up under the "src" folder included in the project.

The main.cpp file contains the classic hello world stuff, cout'ing something to the screen.

I build the project (F7). This is the output written to the console:

Code: Select all

C:\Windows\system32\cmd.exe /C ""C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/vcvarsall.bat" x64 > nul -e -f  "hello_world.mk"  MakeIntermediateDirs && "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/vcvarsall.bat" x64 > nul -e -f  "hello_world.mk"  Debug/main.cpp.obj"
----------Building project:[ hello_world - Debug ] (Single File Build)----------
====0 errors, 0 warnings====
I run via Ctrl + F5. A console shows up but nothing is printed there (the only text is "Press any key to continue"). There are no intermediate directories in the project folder (as Debug or Release). I can't find the .exe file! Furthermore, it does not matter how many errors I type in the main.cpp file, I always get 0 errors, 0 warnings. Even when I compile explicitly main.cpp via right click on the file and selecting "Compile".

Obviously, there's something I'm missing. Could you tell me what's wrong? I fell really stupid...

Regards,

Bleriot.

Re: Unable to compile the simplest hello world project

Posted: Tue Feb 27, 2018 7:34 pm
by eranif
If you don't really need Visual Studio's compiler, I really recommend you to work with g++
CodeLite was mainly tested with GCC (MinGW-w64 project for Windows) and Clang (and is built with g++ on Windows/Linux and clang on MacOSX)

I have little experience with VC on Windows (last time I used it heavily with VC7.1)

Re: Unable to compile the simplest hello world project

Posted: Wed Feb 28, 2018 10:51 am
by bleriot13
eranif wrote:If you don't really need Visual Studio's compiler, I really recommend you to work with g++
CodeLite was mainly tested with GCC (MinGW-w64 project for Windows) and Clang (and is built with g++ on Windows/Linux and clang on MacOSX)

I have little experience with VC on Windows (last time I used it heavily with VC7.1)
I don't fully understand your answer. I don't know whether you just tell me that since you have little experience with VC you can't help me to ascertain what's happeining...or that VC is not tested with Codelite, so it's normal that I have problems using it.

Thanks!

Re: Unable to compile the simplest hello world project

Posted: Wed Feb 28, 2018 2:50 pm
by eranif
I am saying: CodeLite is not often used with CodeLite (at least not by me), so I can help you if you use MinGW.

Re: Unable to compile the simplest hello world project

Posted: Wed Feb 28, 2018 5:32 pm
by bleriot13
Thanks! I'll consider using MinGW.

Regards.

Re: Unable to compile the simplest hello world project

Posted: Fri Mar 02, 2018 4:54 pm
by bleriot13
Weird thing.

I installed MinGW (64 bit) and, yes, I could build a project using this compiler. The weird thing I talked about in the line above is that this made the VC2015 setup work immediately. I mean, making no other changes to the setup. Now I can build projects using the Microsoft compiler as well as MinGW.

Just for your information.

Regards,

Bleriot.

Re: Unable to compile the simplest hello world project

Posted: Sat Mar 03, 2018 4:47 am
by eranif
This means that your setup was configured to use GCC.
From: project settings->general->Makefile generator