Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: killerbot on December 05, 2005, 08:26:01 pm

Title: Anyone with OpenWatcom experience ?
Post by: killerbot on December 05, 2005, 08:26:01 pm
I downloaded and installed OpenWatcom 1.3, I did not set the environment. Don't want the environment to be poluted with the include from open watcom, etc ...

Since I want to have most of my code, for that code that is platform independent, to compile with a whole bunch of compilers (all of them should be error/warning free), I added the open watcom.

Created a new project with cb (hello world), changed the compiler to open watcom, but oh boy, a whole lot of errors.

Anyone out there who can help me on this ??

Muchos gracias,
Lieven
Title: Re: Anyone with OpenWatcom experience ?
Post by: PerryWerneck on December 06, 2005, 11:49:53 am
   Hi,

   First of all: Sorry for my bad english.  :)

   Well, I'm an open watcom user but, right now, my use of codeblocks is just for editing; for compiling I use my own Makefiles but I can try to help you. With kind of errors are you getting?

   By the way: My first idea about the problem is the environmental variables. The watcom installer creates a "setvar.bat" file. You can read it to get some glues about how to set the environment under codeblocks (problably the includes path is missiing).

Title: Re: Anyone with OpenWatcom experience ?
Post by: killerbot on December 06, 2005, 12:45:13 pm
I think the includes are ok.

C:\watcom\H;
C:\watcom\H\NT

This is the code :

//#include <iostream>

int main()
{
   //std::cout << "Hello world!" << std::endl;
   return 0;
}

There are the errors on it :
Project   : Rev1447NewProject
Compiler  : GNU GCC Compiler (called directly)
Directory : C:\Documents and Settings\ldc\My Documents\CodeBlocks\Rev1447NewProject\
--------------------------------------------------------------------------------
Switching to target: default
Linking console executable: Rev1447NewProject.exe
Open Watcom C/C++32 Compile and Link Utility Version 1.3
Portions Copyright (c) 1988-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.
       wcc386 .objs\main.o
Open Watcom C32 Optimizing Compiler Version 1.3
Portions Copyright (c) 1984-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.
.objs\main.o(1): Error! E1061: Expecting data or function declaration, but found ' '
.objs\main.o(1): Warning! W132: No storage class or type specified
.objs\main.o(1): Error! E1009: Expecting ';' but found ''
.objs\main.o(1): Error! E1061: Expecting data or function declaration, but found ' '
.objs\main.o(1): Warning! W132: No storage class or type specified
.objs\main.o(1): Error! E1009: Expecting ';' but found ':'
.objs\main.o(1): Error! E1061: Expecting data or function declaration, but found ':'
.objs\main.o(1): Error! E1026: Invalid declarator
.objs\main.o(1): Error! E1009: Expecting ';' but found '\'
.objs\main.o(1): Error! E1061: Expecting data or function declaration, but found ' '
.objs\main.o(1): Error! E1022: Missing or misspelled data type near 'Documents'
.objs\main.o(1): Error! E1022: Missing or misspelled data type near 'and'
.objs\main.o(1): Warning! W132: No storage class or type specified
.objs\main.o(1): Error! E1009: Expecting ';' but found '\'
.objs\main.o(1): Error! E1061: Expecting data or function declaration, but found ' '
.objs\main.o(1): Warning! W132: No storage class or type specified
.objs\main.o(1): Error! E1009: Expecting ';' but found '\'
.objs\main.o(1): Error! E1061: Expecting data or function declaration, but found ' '
.objs\main.o(1): Error! E1022: Missing or misspelled data type near 'My'
.objs\main.o(1): Warning! W132: No storage class or type specified
.objs\main.o(1): Error! E1009: Expecting ';' but found '\'
.objs\main.o(1): Error! E1061: Expecting data or function declaration, but found ' '
.objs\main.o(1): Warning! W132: No storage class or type specified
.objs\main.o(1): Error! E1009: Expecting ';' but found '\'
.objs\main.o(1): Error! E1061: Expecting data or function declaration, but found ' '
.objs\main.o(1): Warning! W132: No storage class or type specified
.objs\main.o(1): Error! E1009: Expecting ';' but found '\'
.objs\main.o(1): Error! E1147: Too many errors: compilation aborted
Error: Compiler returned a bad status compiling '.objs\main.o'
Process terminated with status 1 (0 minutes, 0 seconds)
21 errors, 7 warnings
 
Any idea ?
Lieven
Title: Re: Anyone with OpenWatcom experience ?
Post by: MortenMacFly on December 06, 2005, 01:04:11 pm
.objs\main.o(1): Error! E1022: Missing or misspelled data type near 'Documents'
.objs\main.o(1): Error! E1022: Missing or misspelled data type near 'and'
Seems the compiler has issues with the spaces in your path name. Try creating/compiling the project in a pth that does NOT contain spaces.

Morten.
Title: Re: Anyone with OpenWatcom experience ?
Post by: killerbot on December 07, 2005, 04:57:53 pm
Ok, I think I have have found the cause of the problem.

The jury finds guilty :
 1)Open Watcom for some stupid error
 2)CodeBlocks for a minor bug

My environment :
- Windows XP
- watcom installed at E:\watcom
- NO setvars run, and I did not let the installer add those stuff automatically to the environment (no polution please)

As described above building 'the hello world' from CB fails.
The project resides in a subdir of "My Documents", so lots of spaces in the path (seems that this is NOT the problem).

Below I will describe 4 build scenarios, 2 of them work, 2 of them don't.

I opened a console in the directory where the cbp file and the main.cpp is, and .objs subdir already exists.
PreSteps :
extend the path environment variable (just in this console) with E:\watcom\binnt;E:\watcom\binw
add the environment variable :  WATCOM=E:\watcom


Scenario 1 :
type in :
wcl386 -c -iE:\watcom\h -iE:\watcom\h\nt -fo=main.obj main.cpp
   (note the -fo part can be omitted in this case)
 --> compiles ok, time to link
wcl386 -LE:\watcom\lib main.obj -fe=test.exe
 --> links ok, and the program even does what it is suppose to do ;-)

Scenario 2 :
wcl386 -c -iE:\watcom\h -iE:\watcom\h\nt -fo=main.o main.cpp
 --> compiles ok, time to link
wcl386 -LE:\watcom\lib main.o -fe=test.exe
=============================> ALL THOSE ERRORS !!!!
seems it does not like the .o extension ??

Scenario 3 :
wcl386 -c -iE:\watcom\h -iE:\watcom\h\nt -fo=.objs\main.obj main.cpp
 --> compiles ok, time to link
wcl386 -LE:\watcom\lib .objs\main.obj -fe=test.exe
 --> links ok, and the program even does what it is suppose to do ;-)

Scenario 4 : (the way CodeBlocks does it)
wcl386 -c -iE:\watcom\h -iE:\watcom\h\nt -fo=.objs\main.o main.cpp
 --> compiles ok, time to link
wcl386 -LE:\watcom\lib .objs\main.o -fe=test.exe
=============================> ALL THOSE ERRORS !!!!
seems it does not like the .o extension ??


Conclusion :
It does not like those .o extension, don't ask me why, I have no idea. But that's why we find open Watcom guilty as charged.

Now onto the CB bug :
Well let's have CB use the extension .obj for this compiler and not .o .
What might be a good place to look : Compiler Settings : OpenWatcom : Other-> Advanced options (not for sissies !!) -> Others, well well look at that :
it is already specified to use obj !!!!!!
But Cb does not use that extension, so that's the Cb bug.
Yiannis, could you please fix this one ?

Cheers,
Lieven
Title: Re: Anyone with OpenWatcom experience ?
Post by: takeshimiya on December 07, 2005, 05:02:46 pm
I must note that I forgot to say that the last week I noticed the exactly same problem (.o and .obj) with Code::Blocks but with a different compiler: DMars.
Title: Re: Anyone with OpenWatcom experience ?
Post by: tiwag on December 07, 2005, 05:10:15 pm
thers is another bug too in these compilersets since the config was changed from registry to xml file default.conf

you can't delete en entry, it gets always restored to the default value when CB restarts
Title: Re: Anyone with OpenWatcom experience ?
Post by: killerbot on December 08, 2005, 07:43:53 am
while debugging codeblocks, I suddenly noticed that the 'debugged Cb' now showed the following command line :
wcl386.exe -c   -fo=.objs\main.o main.cpp
 --> even worse : the include paths were no longer hand over.

Ok, I already see where's the problem : if you do rebuild (or build), then you get :
wcl386.exe -c  -iE:\watcom\h -iE:\watcom\h\nt  -fo=.objs\main.o main.cpp

If you do compile file you get :
wcl386.exe -c   -fo=.objs\main.o main.cpp


More bugs :-(


Lieven
Title: Re: Anyone with OpenWatcom experience ?
Post by: mandrav on December 08, 2005, 10:40:42 am
while debugging codeblocks, I suddenly noticed that the 'debugged Cb' now showed the following command line :
wcl386.exe -c   -fo=.objs\main.o main.cpp
 --> even worse : the include paths were no longer hand over.

Ok, I already see where's the problem : if you do rebuild (or build), then you get :
wcl386.exe -c  -iE:\watcom\h -iE:\watcom\h\nt  -fo=.objs\main.o main.cpp

If you do compile file you get :
wcl386.exe -c   -fo=.objs\main.o main.cpp


More bugs :-(


Lieven

Thanks for pointing it out. Fixed.
Title: Re: Anyone with OpenWatcom experience ?
Post by: killerbot on December 11, 2005, 10:56:25 pm
As explained a little higher (http://forums.codeblocks.org/index.php?topic=1556.msg11219#msg11219), Codeblocks has a bug. It does not take into accound the objects extension set in the compiler switches. You always get file.o, and for example for OpenWatcom where .obj is specified, you don't get file.obj.

I have found the offending lins of code, or the lack of code that's needed.


file : Projectfile.cpp
method : void pfDetails::Update(ProjectBuildTarget* target, ProjectFile* pf)

In this method we retrieve the objectname from the projectfile. This name is with the .o extension (default extension).
But then we should check the current target to see what compiler it is using, and if needed adjust accordingly the extension.

So the code :

Code
    tmp = pf->GetObjName();

should become :
Code
    tmp = pf->GetObjName();
    Compiler* compiler = CompilerFactory::Compilers[target->GetCompilerIndex()];
    const CompilerSwitches& switches = compiler->GetSwitches();
    tmp.SetExt(switches.objectExtension);


With this applied, I am able to build the hello world test program with pen Watcom, and !!! it even runs fine.
Yiannis, could you update the mentioned file with this fix ?


kind regards,
Lieven