Thread: Problems with compiling code in cygwin

  1. #1
    Engineer in research :(
    Join Date
    May 2007
    Location
    Calgary
    Posts
    56

    Problems with compiling code in cygwin

    Hi, I am having problems with compiling a code in cygwin specifically. This code is written in c++ on Linux platform. It was originally made by my boss, so I can't disclose the code, only the error can be shown, sorry for the inconvenience. The code compiled perfectly within ubuntu and fedora, but for some reason the code got a compilation error in cygwin as shown below:
    Code:
    > $ make
    
    > c++ -c  -mwindows -DWIN32 -I. -g -pg -DOBJ_CLASS -DNOMINMAX DrawingObj.cc
    
    > In file included from Quaternion.h:8,
    
    >                  from Fl_Gl_Tb_Window.h:12,
    
    >                  from drawgl.h:8,
    
    >                  from DrawingObjects.h:10,
    
    >                  from DrawingObj.cc:1:
    
    > Global.h:49:1: warning: "ERROR" redefined
    
    > In file included from
    
    > /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32a
    
    > pi/windows.h:52,
    
    >                  from /usr/include/FL/gl.h:38,
    
    >                  from drawgl.h:5,
    
    >                  from DrawingObjects.h:10,
    
    >                  from DrawingObj.cc:1:
    
    > /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/wingdi.h:313:1:
    
    > war
    
    > ning: this is the location of the previous definition
    
    > DrawingObj.cc: In member function `SurfaceElement*
    
    > VolElement::planecut(char*, G
    
    > Lfloat*, Interpolator<DATA_TYPE>*&, int, const int (*)[2], int)':
    
    > DrawingObj.cc:286: error: `Polygon' is not a type
    
    > make: *** [DrawingObj.o] Error 1
    
    >
    The reason that I have to use cygwin is because the client that I have to present to has a Windows XP environment with cygwin installed, so there is no choice other than figuring out what was going on. Also, i have compiled "hello world" in both c and c++ in cygwin for testing and both worked.

    Please help me solve this problem!

    Thanks!
    Firyace
    Undergraduate Research
    Electrical and Biomedical Engineering Department
    University of Calgary

    My Comp:
    |Core 2 Duo 6420 4mb cache| Corsair 2*1Gb memory pc5400|
    |500Gb and 80Gb Sata2| HIS 1950pro Turbo OC 256mb ViVo|
    |X-Cube2 red micro atx case| 3in1 Tiger Game port|
    |ASUS P5B-LD2 Rev2.0-VM| WindowsXP Pro SP2| Fedora 8|
    |Windows XP Pro 64|

    My Store
    Real estate 43

  2. #2
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    The problem is your "boss" chose to use a preprocessor symbol called ERROR. This is highly likely to conflict with another symbol called ERROR in the platform-specific headers.

    Rename the symbol to something else. Don't steal common names from the system. ERROR is a terrible choice of symbol name.

    And telling us you can't post the code because it is proprietary is lame. Suppose you post the 10 lines around the error. Do you seriously think I'm sitting here going "Wow, 10 lines! All I have to do is write the remaining 12,551 lines and I'll have stolen this guy's valuable program!" Silly.

  3. #3
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    This ERROR macro in wingdi.h seems to be important: http://source.winehq.org/ident?i=ERROR

    You could try #undefing the macro, but it might not work. It would be best to just change the ERROR macro in your program.

    And telling us you can't post the code because it is proprietary is lame. Suppose you post the 10 lines around the error. Do you seriously think I'm sitting here going "Wow, 10 lines! All I have to do is write the remaining 12,551 lines and I'll have stolen this guy's valuable program!" Silly.
    Posting even a single line of source code is against most proprietory software license agreements.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  4. #4
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by dwks View Post
    Posting even a single line of source code is against most proprietory software license agreements.
    If there's an agreement then obviously he should respect that. But if his boss indeed wrote this code, surely he could just ASK if it's okay. Doesn't sound like he's working at some megacorp where you don't even know who to ask.

  5. #5
    Engineer in research :(
    Join Date
    May 2007
    Location
    Calgary
    Posts
    56
    Well, yeah anyways my boss fixed it yesterday, so its alright.

    And of course I am not working at a megacorp, at least ur right about that

    The reason that I can't post it because this program is referenced in alot of biomedical articles and it is not right to expose even a single line of it. I hoe you all understand my concern.

    Plus, the problem found is not because of the code being wrong or anything, its just the fltk library of cygwin being a bit different from the original linux one.
    Firyace
    Undergraduate Research
    Electrical and Biomedical Engineering Department
    University of Calgary

    My Comp:
    |Core 2 Duo 6420 4mb cache| Corsair 2*1Gb memory pc5400|
    |500Gb and 80Gb Sata2| HIS 1950pro Turbo OC 256mb ViVo|
    |X-Cube2 red micro atx case| 3in1 Tiger Game port|
    |ASUS P5B-LD2 Rev2.0-VM| WindowsXP Pro SP2| Fedora 8|
    |Windows XP Pro 64|

    My Store
    Real estate 43

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help with Code! Having problems.
    By Invertalon in forum C Programming
    Replies: 4
    Last Post: 03-05-2008, 06:17 AM
  2. compiling C code at visual C++ 6.0
    By hattusili in forum C Programming
    Replies: 7
    Last Post: 02-10-2008, 01:26 PM
  3. Code problems.....once again
    By NicAuf in forum C++ Programming
    Replies: 1
    Last Post: 10-31-2007, 02:55 PM
  4. loop and compiling inside a code
    By MtJ in forum C Programming
    Replies: 3
    Last Post: 03-05-2006, 12:50 PM
  5. problem compiling code and EOF
    By maxthecat in forum C Programming
    Replies: 4
    Last Post: 03-12-2002, 05:22 AM