Author Topic: Problem configuring Digital Mars as default compiler  (Read 33741 times)

Israel

  • Guest
Problem configuring Digital Mars as default compiler
« on: October 31, 2005, 08:04:48 pm »
Hi guys,

New user, 1RC2, Build Oct 24, 2005 23:49:28 - wx2.6.1(Windows, ANSI)

I just installed Codeblocks and I want to use Digital Mars compiler as my default.  I set the default and I tried (as best I could) to set up the paths, etc.  (When Codeblocks started it found GCC and Watcom but nothing else.)

I created a console application and when I clicked on Build it invoked MINGW!  (I can't remember for sure, but I think the as-shipped defaults for Digital Mars are wrong, it wants to use MINGW's MAKE instead of DMC.)  I got past this by fixing the programs to point to DMC stuff.

My problem now is that even though the DMC compiler is invoked, it is trying to pull all the includes (<IOSTREAM>, for example) from the WATCOM directories!  I can't see how this is happening, I have the correct INCLUDE library specified under the Digital Mars compiler set.

Any ideas? 

Thanks!

Israel

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Problem configuring Digital Mars as default compiler
« Reply #1 on: October 31, 2005, 09:28:24 pm »
Any ideas? 
Are there directories setup under: Settings -> Compiler -> Directories?
Could you post the full compiler log for a single file, please? (Settings -> Compiler -> Other ->Compiler logging = "Full command line")

Morten.

(Ps.: Did you check you system environment variables?)
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: Problem configuring Digital Mars as default compiler
« Reply #2 on: October 31, 2005, 09:55:24 pm »
There is a bug in the new project creation. You need to change the project's compiler after having created the project.

Anyway, having solved that, remember that the "default" directories are copied from the compiler's settings to the project's build settings. You need to check that these are good.

Israel

  • Guest
Re: Problem configuring Digital Mars as default compiler
« Reply #3 on: October 31, 2005, 10:05:39 pm »
Hi guys,

> From rickg22
> There is a bug in the new project creation. You need to change the project's compiler after having created the project.

Yes, I saw that also, it was very bizarre!  Thanks.  That part I think is ok now.

Now, in reverse order:

> From MortenMacFly
> (Ps.: Did you check you system environment variables?)

I think this could be the problem, but I don't know how to fix it, since, presumably, OpenWatcom will bomb if I change the path.  Any suggestions?

> Could you post the full compiler log for a single file, please? (Settings -> Compiler -> Other ->Compiler logging = "Full command
> line")

Yes, of course.  This is from the "hello world" skeleton generated when I selected console app:


Project   : Console application
Compiler  : Digital Mars Compiler (called directly)
Directory : C:\Utilities\WXP\Dev\C++\console1\
--------------------------------------------------------------------------------
Switching to target: default
dmc.exe -mn -c       -I"C:\Program Files\dm845c\dm\include" -o.objs\main.obj main.cpp
  #pragma read_only_file;
                       ^
C:\watcom\H\iostream(35) : Warning 17: unrecognized pragma
  #pragma read_only_file;
                       ^
C:\watcom\H\_comdef.h(31) : Warning 17: unrecognized pragma
  #pragma read_only_file;
                       ^
C:\watcom\H\ios(35) : Warning 17: unrecognized pragma
#pragma pack( __push, 1 )
                   ^
C:\watcom\H\ios(105) : Preprocessor error: ')' expected
#pragma pack( __push, 1 )
                    ^
C:\watcom\H\ios(105) : Warning 17: unrecognized pragma
#pragma pack( __pop )
                  ^
C:\watcom\H\ios(237) : Preprocessor error: ')' expected
#pragma pack( __pop )
                    ^
C:\watcom\H\ios(237) : Warning 17: unrecognized pragma
  #pragma read_only_file;
                       ^
C:\watcom\H\streambu(34) : Warning 17: unrecognized pragma
#pragma pack( __push, 1 )
                   ^
C:\watcom\H\streambu(77) : Preprocessor error: ')' expected
#pragma pack( __push, 1 )
                    ^
C:\watcom\H\streambu(77) : Warning 17: unrecognized pragma
#pragma pack( __pop )
                  ^
C:\watcom\H\streambu(153) : Preprocessor error: ')' expected
#pragma pack( __pop )
                    ^
C:\watcom\H\streambu(153) : Warning 17: unrecognized pragma
  #pragma read_only_file;
                       ^
C:\watcom\H\istream(36) : Warning 17: unrecognized pragma
  #pragma read_only_file;
                       ^
C:\watcom\H\ostream(36) : Warning 17: unrecognized pragma
#pragma pack( __push, 1 )
                   ^
C:\watcom\H\ostream(56) : Preprocessor error: ')' expected
Fatal error: too many errors
--- errorlevel 1
Process terminated with status 1 (0 minutes, 0 seconds)
16 errors, 0 warnings
 
> Are there directories setup under: Settings -> Compiler -> Directories?

Yes, for Compiler, I have C:\Program Files\dm845c\dm\include
and  for Linker,     I have C:\Program Files\dm845c\dm\lib

Thanks very much, guys!

Israel

takeshimiya

  • Guest
Re: Problem configuring Digital Mars as default compiler
« Reply #4 on: October 31, 2005, 10:59:55 pm »
You'll have to remove all the environment variables of openwatcom.
I had MinGW includes in PATH, and then the includes of MinGW chocked with the ones from DMars.

If you are using C::B you don't need the environment variables as you could set up variables inside C::B.
It is a bad idea to use the PATH when using more than one compiler.

Also, a note about DMars, you have to include the stlport first:
dm\stlport\stlport
dm\include

Of course, that is if you are using the STL.
« Last Edit: October 31, 2005, 11:01:39 pm by takeshimiya »

Israel

  • Guest
Re: Problem configuring Digital Mars as default compiler
« Reply #5 on: November 01, 2005, 12:17:37 pm »
takeshimiya-san,

Thanks for the info.  I don't know what to do because I want to continue to run OpenWatcom as-is (I know, the IDE is wretched, but there are some other things I like about it).  If I remove it from the path then I'll break OpenWatcom?

> It is a bad idea to use the PATH when using more than one compiler.

"Can't we all just get along?"

Isn't there some way to have all this stuff (Codeblocks, OpenWatcom, Dev-CPP, etc.) coexist without using only one IDE?  Can I fix OpenWatcom not to need the PATH?

Also, thanks for the note about STLPORT- I hadn't figured out how I was supposed to  INCLUDE it.

Thanks to all you guys for the help, suggestions, etc.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Problem configuring Digital Mars as default compiler
« Reply #6 on: November 01, 2005, 01:11:43 pm »
> It is a bad idea to use the PATH when using more than one compiler.
Isn't there some way to have all this stuff (Codeblocks, OpenWatcom, Dev-CPP, etc.) coexist without using only one IDE?  Can I fix OpenWatcom not to need the PATH?
This is quite hard. I had the same problem some time ago when I was working on a project and had to use a QNX IDE. This conflicts with a Cygwin installation (because it relies on a specific version of the Cygwin DLL) and the other way round because QNX is required to have the PATH set (where the modified Cygwin DLL is found). I basically found out two ways that both have it's pros and cons. In both cases one is required to removed all PATH entries and other variables that may conflict from the "default" system. Then they are applied for the specific tools individually. Here is how it goes.

First way: Export the registry keys:
[HKEY_CURRENT_USER\Environment] and [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment] into a REG-file.
They include the PATH and other environment variables. Modify the file as required for the tool you want to use. You may create one REG-file for Codeblocks, one for DMC one for... Then, before using a specific tool just imports the required REG-file. In properties of your wokspace (workplace?!) of Windows open the dialog to access the environment variables and just press OK to close it again. This is required because only then Windows applies the new settings globally. Please note that running applications will still operate on the old environment so you can have several environments running in parallel.
The con: It's kind of annoying to always import the REG-files and have Windows to apply them. You may even forget it often... :lol:

Second way: Create batch-files that first sets the PATH (and other environment) variables and then runs the desigren application. Make sure you really set the PATH completely new, so do not use e.g. "PATH=%PATH%;D:\NewPath".
The con: You have to have for each tool a single batch-file. A REG-configuration may work well for several applications.

Please note that applications started via batch file (other than the REG approach) normally inherit their environment settings to tools that they are going to run (e.g. a compiler lauched by an IDE). This is OK in most cases but sometimes you may get strange effects.

Morten.
« Last Edit: November 01, 2005, 02:01:18 pm by MortenMacFly »
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Israel

  • Guest
Re: Problem configuring Digital Mars as default compiler
« Reply #7 on: November 01, 2005, 04:33:37 pm »
Thanks, Morten.  I guess someone at OpenWatcom needs a slap upside the head for not sharing the sandbox properly.  CodeBlocks doesn't seem to be the one with the issue.

I'll have to think about this for a while.

Regards,

Israel

Israel

  • Guest
Re: Problem configuring Digital Mars as default compiler
« Reply #8 on: November 01, 2005, 05:42:30 pm »
This is very strange.

I decided to remove the INCLUDE system variable to see what happened.  Then I rebooted.

I opened OpenWatcom and CodeBlocks IDEs and opened a Hello World project in each one.  I made sure to change the source so the build would actually get invoked.

Without INCLUDE, OpenWatcom found IOSTREAM (I didn't think of it until now, I hope he found the right one), built the exe, and I was able to execute the .exe fine.

In CodeBlocks, the compile now runs (thanks to takeshimiya-san's comment about putting STLPORT ahead of INCLUDE) cleanly but I'm getting a link error from OPTLINK (DigitalMars).  I think the output path is bad- but, stupidly, I don't know how to fix it.

The message log looks like this:

Project   : Console application
Compiler  : Digital Mars Compiler (called directly)
Directory : C:\Utilities\WXP\Dev\C++\console1\
--------------------------------------------------------------------------------
Switching to target: default
dmc.exe -mn -c       -I"C:\Program Files\dm845c\dm\stlport\stlport" -I"C:\Program Files\dm845c\dm\include" -o.objs\main.obj main.cpp
link.exe /NOLOGO    .objs\main.obj , "C:\Utilities\WXP\Dev\C++\console1\console.exe", ,   
OPTLINK (R) for Win32  Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved
   
OPTLINK : Error 3: Cannot Create File \console1\console.exe
Process terminated with status 1 (0 minutes, 4 seconds)
0 errors, 0 warnings
 

I'm guessing the problem is OPTLINK : Error 3: Cannot Create File \console1\console.exe

What do I have to do to get this to create the executable in the folder in which the project is defined?  From the link command,
link.exe /NOLOGO    .objs\main.obj , "C:\Utilities\WXP\Dev\C++\console1\console.exe", ,    it does look like the output path was specified.

Or maybe it's because of .objs\main.obj not having the full path specified; .objs is the name of the folder which contains the object file...

I'm sorry, I looked at the DMC doc for the linker and I still can't figure it out.

Thanks guys,

Israel

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Problem configuring Digital Mars as default compiler
« Reply #9 on: November 01, 2005, 07:50:59 pm »
This is very strange.
I no, this might be no help for you, but:
I just installed DMC on my machine to give it a try. I downloaded the two ZIP archives (http://ftp.digitalmars.com/Digital_Mars_C++/Patch/dm845c.zip and http://ftp.digitalmars.com/Digital_Mars_C++/STL/stlport.zip) and extracted it into a folder. Then I run Code::Blocks and created a new console project. I setup the DMC environment under Settings->Compiler as follows: Changed the path to the include and lib folder accordiung to my installation; added the path to [DMC]\stlport\stlport to the compiler includes and setup the path to the binaries (tab "Programs") accordingly. Nothing else. Then I switched back to the console project. In it's project options now I chose the DMC compiler. Code::Blocks gave me a warning that I should better fully recompile the project due to this (very cool!!!). So I did and it just worked from scratch.
The compiler output was:
Code
Switching to target: default
dmc.exe -mn -c       -I"D:\Devel\DMC\stlport\stlport" -I"D:\Devel\DMC\include" -o.objs\main.o main.cpp
link.exe /NOLOGO    .objs\main.o , "D:\RemoveMe\console.exe", ,   
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings

No I have another idea for you to try: The compiler seems to work for you. That's fine. So in my opinion the only bad thing can be the linker "link.exe". Are you sure that the one from the DMC installation is called? Could you please verify this? I recommend to use "filemon" by SysInternals for that (http://www.sysinternals.com/Utilities/Filemon.html). Does this help?

Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Problem configuring Digital Mars as default compiler
« Reply #10 on: November 01, 2005, 07:54:35 pm »
Code
link.exe /NOLOGO    .objs\main.o , "D:\RemoveMe\console.exe", ,   
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings

After writing this: Did you notice that the message from "my" link.exe is different to yours? Why?
Where does this:
Code
OPTLINK (R) for Win32  Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved
come from in your case???

Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Israel

  • Guest
Re: Problem configuring Digital Mars as default compiler
« Reply #11 on: November 01, 2005, 08:16:11 pm »
Morten, OPTLINK is the DMC linker.  I'm surprised that you're not getting the message!  Maybe GCC is linking your program ;-)

What do I do now?!

P.S.  Does your executable really exist, and can you run it?
« Last Edit: November 01, 2005, 08:35:31 pm by Israel »

Israel

  • Guest
Re: Problem configuring Digital Mars as default compiler
« Reply #12 on: November 01, 2005, 08:26:10 pm »
Ok, maybe I should tell you what I have in my Programs tab to compare with yours:

C Compiler:                    dmc.exe
C++ Compiler:                dmc.exe
Linker for dynamic libs:     link.exe [from dm/bin]
Linker for static libs:         link.exe [from dm/bin]
Debugger:
Resource compiler:          rcc [from where, I have no idea]
Make program:                make.exe [from dm/bin]

How do these match up?  I don't remember the defaults...

takeshimiya

  • Guest
Re: Problem configuring Digital Mars as default compiler
« Reply #13 on: November 01, 2005, 08:34:42 pm »
I'm using mingw32-make (from MinGW) as Make program for DMars, dunno if it's related.

Try to put DMars in a path without spaces (ie. C:\dm). Some compilers doesn't like spaces in the path (dunno if its the case with DMars).

Israel

  • Guest
Re: Problem configuring Digital Mars as default compiler
« Reply #14 on: November 01, 2005, 08:52:22 pm »
I'm not clear that MAKE is being invoked- from my (and Morten's) logs, it looks like link.exe is being invoked.

I don't have any spaces in the path of the project file.  But DMC is installed in Program Files...I don't think that's the issue.

Thanks again,

Israel

P.S.  I posted to the DMC boards also since we're now at the point of getting an error message from DMC.

http://www.digitalmars.com/drn-bin/wwwnews?c%2B%2B.command-line/629