Page 1 of 3

Recognizing Compiler

Posted: Thu Dec 12, 2013 9:53 pm
by 91458
I am a newbie to this, but I have not found much on the web to understand my problem.
I hope this is not an RTFM.

I installed the Digital Mars C/C++ compiler on my Windows 7 64 bit Home Premium laptop. I also previously installed Codelight.
As I was working through one of these "Teach Yourself C++" books, I essentially copied a piece of code from the book and tried
to compile it.

I made the requisite edits as was mentioned on the Forum help. I saw that the Mars compiler was not in the list of Build options.
So I made a new entry for it. As it asked for the assembler name, I left it blank as there was no "as" or similar executable in the bin directory.
I made sure I added a path so CL could find its way to the necessary executables. I did not specify any compiler flags (separate window).
In essence a vanilla C++ compiler.

The Build menu still had the compile option greyed out. Thinking CL updates only upon rebooting, I quit the program and restarted. Still
no ability to compile a program, though all my settings for the Mars compiler were there. I tried to directly compile the program in a command window.
Since the compiler did not locate the io library, there were a lot of errors in the program. Not surprising, but it at least showed me that the compiler
was working.

So the question is, how do I get the program to recognize and USE the Digital Mars compiler within CL?
Thanks for any help you can send my way.

Re: Recognizing Compiler

Posted: Thu Dec 12, 2013 10:12 pm
by eranif
You need to create a project.
When you first start codelite, you have a "Welcome" page, there is a big button on it with the title "New - Start a New Project" click it.
Select a "Console -> Simple executable (g++)"
Fill in the blanks (project name + location) click OK

Next, right click on the project icon and select "Settings"
In the "General" page, change the compiler to use your newly defined compiler

Then the build menu will not be disabled
http://codelite.org/LiteEditor/HelloWorld

Note: I encourage you to use g++ or clang if you are not bind to use Digital Mars compiler
Eran

Re: Recognizing Compiler

Posted: Fri Dec 13, 2013 8:27 pm
by 91458
I hate being so clueless.

I went and tried to run the HelloWorld program in the tutorial section.
I used the simple g++ as mentioned.

However, when I go to build the program I get the error:
"No rule to make target 'Debug\main.o', needed by Debug\HelloWorld2"

I opened the Makefile in notepad:

.PHONY: clean All

All:
@echo "----------Building project:[ HelloWorld2 - Debug ]----------"
@$(MAKE) -f "HelloWorld2.mk"
clean:
@echo "----------Cleaning project:[ HelloWorld2 - Debug ]----------"
@$(MAKE) -f "HelloWorld2.mk" clean

I do not see a HelloWorld2.mk file in the project directory. The Debug directory is empty.
I'm not sure why I cannot follow simple directions. But obviously I am doing something wrong.

Re: Recognizing Compiler

Posted: Fri Dec 13, 2013 10:38 pm
by eranif
Can you please the full build log?
Also, please read this HOW TO POST thread

Eran

Re: Recognizing Compiler

Posted: Fri Dec 13, 2013 11:07 pm
by 91458
I am using COdeLite v 5.3
It is running on Windows 7 so it is a pre-compiled version
I am using g++ which comes with CodeLite

I cannot build Hello World. Below are the full contents of the Builder Window:

C:\Windows\system32\cmd.exe /c "mingw32-make.exe -j 2 -e -f Makefile"
"----------Building project:[ HelloWorld2 - Debug ]----------"
mingw32-make.exe[1]: Entering directory `C:/Users/Mark/CPP_Project1/HelloWorld2'
mingw32-make.exe[1]: *** No rule to make target `Debug/main.o', needed by `Debug/HelloWorld2'. Stop.
mingw32-make.exe[1]: *** Waiting for unfinished jobs....
mingw32-make.exe: *** [All] Error 2
mingw32-make.exe[1]: Leaving directory `C:/Users/Mark/CPP_Project1/HelloWorld2'
Makefile:4: recipe for target `All' failed
0 errors, 0 warnings

Re: Recognizing Compiler

Posted: Fri Dec 13, 2013 11:46 pm
by eranif
Do you have another installation of MinGW (or MSYS)?

Eran

Re: Recognizing Compiler

Posted: Sat Dec 14, 2013 12:20 am
by 91458
I have Cygwin installed which has MinGW v 4.7.1 and gnuplot has a version of MinGW as well.

Re: Recognizing Compiler

Posted: Sat Dec 14, 2013 12:43 am
by eranif
This is probably the culprit of the error: there is a conflict with the versions installed on your machine
Try setting this environment variable within codelite (settings -> environment variables) and see if it helps:

Code: Select all

SHELL=CMD.EXE
Eran

Re: Recognizing Compiler

Posted: Sat Dec 14, 2013 2:47 am
by 91458
Now I receive a new error message:

C:\Windows\system32\cmd.exe /c "mingw32-make.exe -j 2 -e -f Makefile"
"----------Building project:[ HelloWorld2 - Debug ]----------"
HelloWorld2.mk:66: *** multiple target patterns. Stop.
mingw32-make.exe: *** [All] Error 2
mingw32-make.exe[1]: Entering directory `C:/Users/Mark/CPP_Project1/HelloWorld2'
mingw32-make.exe[1]: Leaving directory `C:/Users/Mark/CPP_Project1/HelloWorld2'
Makefile:4: recipe for target `All' failed
0 errors, 0 warnings

Re: Recognizing Compiler

Posted: Sat Dec 14, 2013 3:02 am
by Gibbon1
eranif wrote:This is probably the culprit of the error: there is a conflict with the versions installed on your machine
Try setting this environment variable within codelite (settings -> environment variables) and see if it helps:

Code: Select all

SHELL=CMD.EXE
Eran
Just an aside, I had to use

mingw32-make SHELL=CMD.EXE -j 4

Far as I can tell mingw32-make.exe first looks for 'sh' in the path, it it finds it, it _ignores_ the environment variable and calls sh.exe instead of CMD.EXE If you add SHELL=CMD.exe to the command line, then it respects it.