Author Topic: [Resolved] Using OpenWatcom compiler in C::B  (Read 17273 times)

Eric75000

  • Guest
[Resolved] Using OpenWatcom compiler in C::B
« on: September 25, 2007, 08:54:10 pm »
Hello everybody !

First of all, excuse me for my bad english, I'm a little frenchy  :lol:

I'm using C::B 1.0rc2 with OpenWatcom 1.7 compiler (last version)

I'm trying to create a user template on C::B who allows me to use a 32bits program in a DOS extender like DOS4GW. (Yes, I know it's a old method, but it's to learn... :wink: )
I start with the "Console Application" initial template (Files/New Project...) and modify it to use Open Watcom compiler. (Right click on "Console application" in my workspace, Targets, Target's build options, Selected compiler, OpenWatcom (W32) Compiler)

But when i try a Ctrl+F9, it's not the good version of Open Watcom compiler who starts (wcc386.exe instead of wcl386.exe)

Where can I modify this parameters ? (Obtain in Selected compiler something like "OpenWatcom (DOS - 32 bits) Compiler" as OpenWatcom can normaly do)

Can anyone help me, please ?
Thanks in advance !

Bests Regards,
Eric.
« Last Edit: November 07, 2007, 10:31:20 am by Eric75000 »

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: Using OpenWatcom compiler in C::B
« Reply #1 on: September 25, 2007, 09:00:36 pm »
RC2 is pretty old. Please download a latest nightly from the following link.

Quote
http://forums.codeblocks.org/index.php/board,20.0.html

I'm afraid that even if you change the compiler executable to wcl386.exe it may not work well with RC2. Lately the support of newer OpenWatcom compilers has been enhanced in recent nightlies.

BTW, please note that the Console Wizard will create the Project for Win32 executables (console). In case you want to create a DOS executable, you've to change the appropriate command line option (-bt=dos) in Project > Build options.
Be a part of the solution, not a part of the problem.

Eric75000

  • Guest
Re: Using OpenWatcom compiler in C::B
« Reply #2 on: September 26, 2007, 04:58:39 pm »
Thanks Biplab for your answer ! :D

I'll install the latest nightly this evening like you recommand... (I stayed at RC2 version because in France, in some forums like this one, they do not recommand to use nightly builds... so like I'm a beginner...:mrgreen:)

BTW, please note that the Console Wizard will create the Project for Win32 executables (console). In case you want to create a DOS executable, you've to change the appropriate command line option (-bt=dos) in Project > Build options.

I'm not sure that the comman line option (-bt=dos) works because in the prog is inserted some ASM instructions (witch use DOS interruptions)
And the prog to work properly must use DOS4GW, and if you use another compiler executable instead of wcl386.exe, it will compile but not work...

I'll try it this evening and tell you...

C U soon,
Eric

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: Using OpenWatcom compiler in C::B
« Reply #3 on: September 26, 2007, 06:13:54 pm »
I'm not sure that the comman line option (-bt=dos) works because in the prog is inserted some ASM instructions (witch use DOS interruptions)
And the prog to work properly must use DOS4GW, and if you use another compiler executable instead of wcl386.exe, it will compile but not work...

I just gave you an example. I wanted to say that in case you want to develop programs for DOS, you'll need to change certain parameters. :)

I hope you'll get a better experience with C::B nightlies as opposed to other forums say. ;)
Be a part of the solution, not a part of the problem.

Eric75000

  • Guest
Re: Using OpenWatcom compiler in C::B
« Reply #4 on: September 28, 2007, 12:18:23 pm »
Hi !

=> Now I'm using C::B Nightly build SVN4491 : what the difference compared to RC2 !!!!  :P
So I've found where I can transmit the "-l=dos4g" command line (Thanks Biplab) to the compiler...
But the prog still doesn't work ! :(

Where can I config more verbose build logs in C::B please ? (only 5 lines in SVN4491 instead of many many lines in RC2)

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Using OpenWatcom compiler in C::B
« Reply #5 on: September 28, 2007, 12:58:16 pm »
=> Now I'm using C::B Nightly build SVN4491 : what the difference compared to RC2 !!!!  :P
Basically, everything.

Quote
Where can I config more verbose build logs in C::B please ? (only 5 lines in SVN4491 instead of many many lines in RC2)
Compiler settings, rightmost tab, select "full command line".
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Eric75000

  • Guest
Re: Using OpenWatcom compiler in C::B
« Reply #6 on: September 28, 2007, 10:17:44 pm »
Thanks Thomas for your answer !

Build logs are a little more verbose but not enough :? : although none compiler flag is set, when I build my prog, I can see in build log "wcl386.exe -q -c..." and after "wlink.exe option quiet..."

=> This is why I can't see all of the logs : -q flag = operate quietly for compiler, and option quiet = quiet (!) for the linker.

Somebody knows please where can I unset this flag ? I search in Settings/Compiler and debugger and in my project properties but I've found nothing !

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: Using OpenWatcom compiler in C::B
« Reply #7 on: September 29, 2007, 05:35:05 am »
Build logs are a little more verbose but not enough :? : although none compiler flag is set, when I build my prog, I can see in build log "wcl386.exe -q -c..." and after "wlink.exe option quiet..."

=> This is why I can't see all of the logs : -q flag = operate quietly for compiler, and option quiet = quiet (!) for the linker.

Somebody knows please where can I unset this flag ? I search in Settings/Compiler and debugger and in my project properties but I've found nothing !

Don't worry about that difference. That's hard-coded. It won't affect your project.

Unfortunately the command line options of wlink.exe is not same as of other tools, such as wcl386.exe. So option quiet may seem odd to you but it is the option which wlink.exe uses.
Be a part of the solution, not a part of the problem.

Eric75000

  • Guest
Re: Using OpenWatcom compiler in C::B
« Reply #8 on: October 03, 2007, 04:12:31 pm »
Hi !

Sorry for my late answer, I was in holidays...

Quote
It won't affect your project.
I know, I know !!! :wink:

Quote
That's hard-coded.
Argh ! It's too bad that you can't set or unset by yourself this flag ! I know this flag ins't very very important, but I was accustomed at the logs of RC2 version :oops:

So, I have another problem : when I want to compile my prog in OpenWatcom with inline command, I must type in a DOS window :
Code
wcl386 /l=dos4g my_starfield.c
I would like to do the same in C::B, so in the build options of my projet, I set the flag "link for the specified OS (define TARGET_OS in custom variables) [-l=[TARGET_OS])" and click "Add" button in the "Custom variables" tabs and type "$(TARGET_OS)" for the key, and "dos4g" for the value...
But, when I build my prog, (F11) I can see in the logs : wcl386.exe -q -c -l= 

The compiler take well the flag but not the custom variable $(TARGET_OS) :(
Where I made a mistake ???

(I hope you understand my very very bad english :oops:)

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: Using OpenWatcom compiler in C::B
« Reply #9 on: October 03, 2007, 04:59:23 pm »
Quote
That's hard-coded.
Argh ! It's too bad that you can't set or unset by yourself this flag ! I know this flag ins't very very important, but I was accustomed at the logs of RC2 version :oops:

Ok, I'll change this.

So, I have another problem : when I want to compile my prog in OpenWatcom with inline command, I must type in a DOS window :
Code
wcl386 /l=dos4g my_starfield.c
I would like to do the same in C::B, so in the build options of my projet, I set the flag "link for the specified OS (define TARGET_OS in custom variables) [-l=[TARGET_OS])" and click "Add" button in the "Custom variables" tabs and type "$(TARGET_OS)" for the key, and "dos4g" for the value...
But, when I build my prog, (F11) I can see in the logs : wcl386.exe -q -c -l= 

The compiler take well the flag but not the custom variable $(TARGET_OS) :(
Where I made a mistake ???

(I hope you understand my very very bad english :oops:)

This is a bug. Actually not all linker options are mapped to their equivalent wlink.exe command. It needs to be fixed.
Be a part of the solution, not a part of the problem.

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: Using OpenWatcom compiler in C::B
« Reply #10 on: October 04, 2007, 08:02:16 am »
I've fixed the bug (Not expanding the Custom variables). It's in revision 4505.

Regarding changing the option quiet you can do this. Go to Settings > Compiler & debugger > Other settings. Now click on the Advanced button. There you can change the linker command by editing that line and removing option quiet from that.

If you find any other bugs, please feel free to report it.
Be a part of the solution, not a part of the problem.

Eric75000

  • Guest
Re: Using OpenWatcom compiler in C::B
« Reply #11 on: October 09, 2007, 07:06:56 pm »
Hello everybody !

Biplab : many many thanks to take your precious time to help a little frenchy like me by changing C::B code to allow modifying logs flags in Openwatcom compiler & linker : it's so cool :P
=> I'm now in 4515 revision and, for this, it works like I want !!!! :mrgreen: :mrgreen: :mrgreen:

But for the "custom variables", I must do a mistake (but I don't know where) because it doesn't work :( instead of you've fixed the bug !
It's like exactly the same that previously :
Quote
in the build options of my projet, I set the flag "link for the specified OS (define TARGET_OS in custom variables) [-l=[TARGET_OS])" and click "Add" button in the "Custom variables" tabs and type "$(TARGET_OS)" for the key, and "dos4g" for the value...
But, when I build my prog, (F11) I can see in the logs : wcl386.exe -q -c -l=

 :cry: :cry: :cry:

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: Using OpenWatcom compiler in C::B
« Reply #12 on: October 09, 2007, 08:01:24 pm »
But for the "custom variables", I must do a mistake (but I don't know where) because it doesn't work :( instead of you've fixed the bug !
It's like exactly the same that previously :
Quote
in the build options of my projet, I set the flag "link for the specified OS (define TARGET_OS in custom variables) [-l=[TARGET_OS])" and click "Add" button in the "Custom variables" tabs and type "$(TARGET_OS)" for the key, and "dos4g" for the value...
But, when I build my prog, (F11) I can see in the logs : wcl386.exe -q -c -l=

 :cry: :cry: :cry:

I guess you're making some mistakes. This is what happens in my PC. I've used -l=$(TARGET_OS) compiler options and a custom variable TARGET_OS with value nt_win for the project. :)

Quote
-------------- Build: Debug in Test ---------------
[ 50.0%] wcl386.exe -q -c -l=nt_win -xs -wx  -d2    -iC:\watcom\h -iC:\watcom\h\nt  -fo=obj\Debug\main.obj main.cpp
[100.0%] wlink.exe option quiet system nt_win debug watcom all  LIBP  C:\watcom\lib386;C:\watcom\lib386\nt file obj\Debug\main.obj name bin\Debug\Test.exe 
Output size is 67.58 KB
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings

You may upload your project file as a zip file so that we may have a look at it.
Be a part of the solution, not a part of the problem.

Eric75000

  • Guest
Re: Using OpenWatcom compiler in C::B
« Reply #13 on: October 09, 2007, 09:11:54 pm »
Quote
You may upload your project file as a zip file so that we may have a look at it.
Really, you could do that for me ? :D

=> Here are all my [little] projet... (it's to learn how using 13h video mode like old PC 80's demo)

Thanks in advance for your precious help !!!


[attachment deleted by admin]

Eric75000

  • Guest
Re: Using OpenWatcom compiler in C::B
« Reply #14 on: October 18, 2007, 07:30:04 am »
:cry: No answer :cry:

=> Nobody is interrested more by my prog ???

Biplab ? Sorry but, can U help me please ? :oops:

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: Using OpenWatcom compiler in C::B
« Reply #15 on: October 18, 2007, 10:22:02 am »
It works as expected.

Quote
-------------- Build: Debug in my_starfield ---------------
[ 50.0%] wcl386.exe -q -c -l=dos4g -wx  -d2    -iC:\watcom\h -iC:\watcom\h\nt  -fo=obj\Debug\main.obj main.c
[100.0%] wlink.exe option quiet system dos4g debug watcom all  LIBP  C:\watcom\lib386;C:\watcom\lib386\nt file obj\Debug\main.obj name bin\Debug\my_starfield.exe

In your attached project file there is no instance of the required Custom variable for this operation.

I'm attaching the modified project.



[attachment deleted by admin]
Be a part of the solution, not a part of the problem.

Eric75000

  • Guest
Re: Using OpenWatcom compiler in C::B
« Reply #16 on: October 21, 2007, 10:40:18 am »
Hi Biplab (and all) !

And thanks to you for your answer !!! :P
I was near the truth : in fact, I wrote $(TARGET_OS) instead of TARGET_OS because it's written like this in the "Custom variables" windows... :oops: sorry !!!

So now, effectively, it works as expected... for the flags, but not for my prog ! :cry: :cry: :cry:

I'm searching why I have all this errors (while it works correctly when I compile it manually) : may be I'll need your help once again...

 :wink:
 

Eric75000

  • Guest
Re: Using OpenWatcom compiler in C::B
« Reply #17 on: October 28, 2007, 03:21:06 pm »
Hi !

It's me again... :mrgreen:

So, instead of trying to search where I made mistakes, I still need your help : I don't understand why, when I compile my prog in Openwatcom directly by command line it works perfectly with no error, and when I use C::B to do the same (same prog, same flag to compile, etc) I always have lots of errors, even whith latest version of C::B (SVN4564) :

Code
-------------- Build: Debug in my_starfield ---------------
wcl386.exe -q -c -l=dos4g -wx  -d2    -iC:\watcom\h -iC:\watcom\h\nt  -fo=obj\Debug\main.obj main.c
wlink.exe system dos4g debug watcom all  LIBP  C:\watcom\lib386;C:\watcom\lib386\nt file obj\Debug\main.obj name bin\Debug\my_starfield.exe 
Open Watcom Linker Version 1.7
Portions Copyright (c) 1985-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.
loading object files
searching libraries
Error! E2028: _PeekConsoleInputA@16 is an undefined reference
Error! E2028: _ReadConsoleInputA@16 is an undefined reference
Error! E2028: _WriteFile@20 is an undefined reference
Error! E2028: _GetEnvironmentStrings@0 is an undefined reference
Error! E2028: _GetVersion@0 is an undefined reference
Error! E2028: _GetModuleFileNameA@12 is an undefined reference
Error! E2028: _GetCommandLineA@0 is an undefined reference
Error! E2028: _GetCommandLineW@0 is an undefined reference
Error! E2028: _FreeEnvironmentStringsA@4 is an undefined reference
Error! E2028: _GetModuleHandleA@4 is an undefined reference
Error! E2028: _ExitProcess@4 is an undefined reference
Error! E2028: _CreateFileA@28 is an undefined reference
Error! E2028: _SetStdHandle@8 is an undefined reference
Error! E2028: _CreateEventA@16 is an undefined reference
Error! E2028: _GetStdHandle@4 is an undefined reference
Error! E2028: _CloseHandle@4 is an undefined reference
Error! E2028: _GetModuleFileNameW@12 is an undefined reference
Error! E2028: _MultiByteToWideChar@24 is an undefined reference
Error! E2028: _LoadLibraryA@4 is an undefined reference
Error! E2028: _GetProcAddress@8 is an undefined reference
Error! E2028: _SetUnhandledExceptionFilter@4 is an undefined reference
Error! E2028: _UnhandledExceptionFilter@4 is an undefined reference
Error! E2028: _VirtualQuery@12 is an undefined reference
Error! E2028: _VirtualAlloc@16 is an undefined reference
Error! E2028: _GetCurrentThreadId@0 is an undefined reference
Error! E2028: _SetConsoleCtrlHandler@8 is an undefined reference
Error! E2028: _VirtualFree@12 is an undefined reference
Error! E2028: _GetFileType@4 is an undefined reference
Error! E2028: _SetEnvironmentVariableA@8 is an undefined reference
Error! E2028: _CharUpperA@4 is an undefined reference
Error! E2028: _SetEnvironmentVariableW@8 is an undefined reference
Error! E2028: _GetACP@0 is an undefined reference
Error! E2028: _GetOEMCP@0 is an undefined reference
Error! E2028: _GetCPInfo@8 is an undefined reference
Error! E2028: _WideCharToMultiByte@32 is an undefined reference
creating a DOS/4G executable
file clib3r.lib(kbhitwnt): undefined symbol _PeekConsoleInputA@16
file clib3r.lib(kbhitwnt): undefined symbol _ReadConsoleInputA@16
file clib3r.lib(xmsgwnt): undefined symbol _WriteFile@20
file clib3r.lib(mainwnt): undefined symbol _GetEnvironmentStrings@0
file clib3r.lib(mainwnt): undefined symbol _GetVersion@0
file clib3r.lib(mainwnt): undefined symbol _GetModuleFileNameA@12
file clib3r.lib(mainwnt): undefined symbol _GetCommandLineA@0
file clib3r.lib(mainwnt): undefined symbol _GetCommandLineW@0
file clib3r.lib(mainwnt): undefined symbol _FreeEnvironmentStringsA@4
file clib3r.lib(mainwnt): undefined symbol _GetModuleHandleA@4
file clib3r.lib(mainwnt): undefined symbol _ExitProcess@4
file clib3r.lib(conutwnt): undefined symbol _CreateFileA@28
file clib3r.lib(hdlman): undefined symbol _SetStdHandle@8
file clib3r.lib(hdlman): undefined symbol _CreateEventA@16
file clib3r.lib(hdlman): undefined symbol _GetStdHandle@4
file clib3r.lib(hdlman): undefined symbol _CloseHandle@4
file clib3r.lib(getmodfn): undefined symbol _GetVersion@0
file clib3r.lib(getmodfn): undefined symbol _GetModuleFileNameW@12
file clib3r.lib(getmodfn): undefined symbol _GetModuleFileNameA@12
file clib3r.lib(getmodfn): undefined symbol _MultiByteToWideChar@24
file clib3r.lib(excptwnt): undefined symbol _LoadLibraryA@4
file clib3r.lib(excptwnt): undefined symbol _GetProcAddress@8
file clib3r.lib(excptwnt): undefined symbol _WriteFile@20
file clib3r.lib(excptwnt): undefined symbol _SetUnhandledExceptionFilter@4
file clib3r.lib(excptwnt): undefined symbol _UnhandledExceptionFilter@4
file clib3r.lib(excptwnt): undefined symbol _ExitProcess@4
file clib3r.lib(stklmwnt): undefined symbol _VirtualQuery@12
file clib3r.lib(grownear): undefined symbol _VirtualAlloc@16
file clib3r.lib(mthrdini): undefined symbol _GetCurrentThreadId@0
file clib3r.lib(signlwnt): undefined symbol _SetConsoleCtrlHandler@8
file clib3r.lib(nheapmin): undefined symbol _VirtualFree@12
file clib3r.lib(isattwnt): undefined symbol _GetFileType@4
file clib3r.lib(putenv): undefined symbol _SetEnvironmentVariableA@8
file clib3r.lib(mbcupper): undefined symbol _CharUpperA@4
file clib3r.lib(mbtowc): undefined symbol _MultiByteToWideChar@24
file clib3r.lib(setenvar): undefined symbol _SetEnvironmentVariableA@8
file clib3r.lib(setenvar): undefined symbol _SetEnvironmentVariableW@8
file clib3r.lib(mbinit): undefined symbol _GetACP@0
file clib3r.lib(mbinit): undefined symbol _GetOEMCP@0
file clib3r.lib(mbinit): undefined symbol _GetCPInfo@8
file clib3r.lib(wctomb): undefined symbol _WideCharToMultiByte@32
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings

After many searchs, I've found in a french forum an old post (2003) who explain that this kind of problem appears in Openwatcom when path is uncorrectly notified... But my path is:
Code
PATH=C:\WATCOM\BINNT;C:\WATCOM\BINW

So, where is my error ???

Eric75000

  • Guest
Re: Using OpenWatcom compiler in C::B
« Reply #18 on: October 30, 2007, 10:43:10 am »
I'm not sure, but I think it's not an error... but a bug !

In the logs, we can see that the LIBP flag for the linker correctly notices the good library path :
Code
wlink.exe system dos4g debug watcom all  LIBP  C:\watcom\lib386;C:\watcom\lib386\nt file obj\Debug\main.obj name bin\Debug\my_starfield.exe

And the "clib3r.lib" file (that apparently makes problem) exists in C:\WATCOM\lib386\nt !

So, I don't think that this time I made a mistake...
Someone can confirm my thought ?

Eric75000

  • Guest
Re: Using OpenWatcom compiler in C::B
« Reply #19 on: November 04, 2007, 03:13:33 pm »
=> There's no one who can help me ??? :(

May be Biplab... again ?

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: Using OpenWatcom compiler in C::B
« Reply #20 on: November 04, 2007, 03:31:23 pm »
Remove C:\watcom\lib386\nt from library search path. Then add C:\WATCOM\lib386\dos to the library search path. That should solve the problem. :)
Be a part of the solution, not a part of the problem.

Eric75000

  • Guest
Re: Using OpenWatcom compiler in C::B
« Reply #21 on: November 07, 2007, 10:30:21 am »
 :)  :mrgreen:  8)  :mrgreen:  :)  :mrgreen:  8)  :mrgreen:  :)  :mrgreen:  8)  :mrgreen:  :)

Marvelous !!!! Wonderful !!!! Incredible !!!!
 :arrow: Now It works !!!!!!!!!!!!

Thanks so much Biplab your precious help !!!!

"T'es génial !" like we say in France !

 :wink:

@+ Bye !