Unable to compile the simplest hello world project

General questions regarding the usage of CodeLite
bleriot13
CodeLite Curious
Posts: 4
Joined: Tue Feb 27, 2018 3:05 pm
Genuine User: Yes
IDE Question: C++
Contact:

Unable to compile the simplest hello world project

Post by bleriot13 » Tue Feb 27, 2018 3:51 pm

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.

User avatar
eranif
CodeLite Plugin
Posts: 6120
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Unable to compile the simplest hello world project

Post by eranif » Tue Feb 27, 2018 7:34 pm

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)
Make sure you have read the HOW TO POST thread

bleriot13
CodeLite Curious
Posts: 4
Joined: Tue Feb 27, 2018 3:05 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Unable to compile the simplest hello world project

Post by bleriot13 » Wed Feb 28, 2018 10:51 am

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!

User avatar
eranif
CodeLite Plugin
Posts: 6120
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Unable to compile the simplest hello world project

Post by eranif » Wed Feb 28, 2018 2:50 pm

I am saying: CodeLite is not often used with CodeLite (at least not by me), so I can help you if you use MinGW.
Make sure you have read the HOW TO POST thread

bleriot13
CodeLite Curious
Posts: 4
Joined: Tue Feb 27, 2018 3:05 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Unable to compile the simplest hello world project

Post by bleriot13 » Wed Feb 28, 2018 5:32 pm

Thanks! I'll consider using MinGW.

Regards.

bleriot13
CodeLite Curious
Posts: 4
Joined: Tue Feb 27, 2018 3:05 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Unable to compile the simplest hello world project

Post by bleriot13 » Fri Mar 02, 2018 4:54 pm

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.

User avatar
eranif
CodeLite Plugin
Posts: 6120
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Unable to compile the simplest hello world project

Post by eranif » Sat Mar 03, 2018 4:47 am

This means that your setup was configured to use GCC.
From: project settings->general->Makefile generator
Make sure you have read the HOW TO POST thread

Post Reply