Page 1 of 1

No Output from Hello World program

Posted: Wed May 28, 2014 3:18 pm
by colin_t
Hallo all,

Running CodeLite 5.4 on a Windows 7 laptop, and trying to get back into C programming after a break of 15-ish years, and I'm getting no output from the sample 'Hello World' program. Here is a step-by-step account of what I've done, which is followed by the Build Log:-

1. Create New WorkSpace (Test2) in C:\Temp: create workspace under separate directory ticked;
2. Right-click Test2, in the workspace view pane, and select Create New Project (Test2) under default project path (C:\Temp\Test2): compiler – clang: create workspace under separate not directory ticked;
3. Expand Test2 project in WorkSpace View pane to reveal ‘src’ directory containing ‘main.c’ file;
4. Build=>Compile Current File = fail: 'clang' is not recognized as an internal or external command, operable program or batch file;
5. Search hard drive = clang doesn’t exist, it has been renamed to ‘codelite-clang’, in ProgramFiles(x86);
6. Settings=>Build Settings – change all ‘clang’ references to ‘codelite-clang’ and try again = No Errors Found;
7. Build=>Build Project =fail: mingw32-make.exe[1]: *** Access is denied.
8. Current directory in WorkSpace View pane = C:\Temp\Test2, presumably it can’t find mingw32-make.exe, so Settings=>Build Settings alter Make from ‘mingw32-make.exe -j 2’ to ‘C:\MinGW-4.8.1\bin\mingw32-make.exe -j 2’ and try again = No Errors Found;
9. Run the program
10. CodeLite Output View windows displays:
Current working directory: C:\Temp\Test2\Debug
Running program: le_exec.exe ./Test2
Program exited with return code: 0
But output window, titled ./Test2, only displays “Press any key to continue” e.g. no Hello World
11. So, try and debug it: GDB=>Start / Continue debugger – respond yes to “Would you like to build the project before debugging it?” = fail: “Debugger exited with following error string: “No executable specified, use’target exec’.””
12. Right click on project, in workspace view pane, and click ‘Set As Active’ then ‘Run Active Project’ from tool bar makes no difference (see comments at step 10)

Build Log

C:\Windows\system32\cmd.exe /c "C:/MinGW-4.8.1/bin/mingw32-make.exe -j 2 -e -f Makefile"
"----------Building project:[ Test2 - Debug ]----------"
mingw32-make.exe[1]: Entering directory 'C:/Temp/Test2'
codelite-clang -c "C:/Temp/Test2/main.c" -g -O0 -Wall -o ./Debug/main.o -I. -I.
Usage: -g {parse|parse-macros|code-complete} <file> [output-folder] <compiler options>
parse <source-file> <output-folder> <compiler-agruments> and compile it into an AST
parse-macros <source-file> <output-folder> <compiler-arguments> parse if needed and print all macros found into stdout
code-complete <source-file> <AST-file> <line:col>
codelite-clang -o ./Debug/Test2 @"Test2.txt" -L.
Usage: @Test2.txt {parse|parse-macros|code-complete} <file> [output-folder] <compiler options>
parse <source-file> <output-folder> <compiler-agruments> and compile it into an AST
parse-macros <source-file> <output-folder> <compiler-arguments> parse if needed and print all macros found into stdout
code-complete <source-file> <AST-file> <line:col>
mingw32-make.exe[1]: Leaving directory 'C:/Temp/Test2'
0 errors, 0 warnings

So I think it's built okay - all comments on where I've gone wrong e.g. why I get no output, and more particularly on how to fix it would be appreciated PLUS should I be able to use GDB to debug C code?

Thanks in advance,

Colin T.

Re: No Output from Hello World program

Posted: Wed May 28, 2014 3:23 pm
by eranif
colin_t wrote: Build=>Compile Current File = fail: 'clang' is not recognized as an internal or external command, operable program or batch file;
You need to install clang
colin_t wrote:5. Search hard drive = clang doesn’t exist, it has been renamed to ‘codelite-clang’, in ProgramFiles(x86);
Not its not. This is a different program

In short, if you want to work with clang, you need to install it.
However, clang is not ready for prime time on Windows - the produced executable crashes whenever your code is referencing anything from the STL library

If you insist (or you plan on coding with C only, no C++) then install it from here:
http://llvm.org/releases/download.html#3.4

Eran

Re: No Output from Hello World program

Posted: Wed May 28, 2014 4:23 pm
by colin_t
Hi Eran,

Many thanks for educating me - every day's a school day as they say. clang now downloaded, installed and all works.

Colin T