Thread: 'DC_BRUSH' was not declared...

  1. #1
    Registered User
    Join Date
    Nov 2015
    Posts
    119

    'DC_BRUSH' was not declared...

    Best time of day for everyone!
    All the necessary includes seem to be there, but errors fall in a pile. Can you tell me what else is wrong?


    error: 'DC_BRUSH' was not declared in this scope|
    error: 'SetDCBrushColor' was not declared in this scope|
    error: 'DC_PEN' was not declared in this scope|
    'SetDCPenColor' was not declared in this scope|
    ||=== Build failed: 4 error(s), 1 warning(s) (0 minute(s), 4 second(s)) ===|


    Code:
    #include<stdio.h>
    #include<windows.h>
    #include<stdlib.h>
    #include<time.h>
    #include<wingdi.h>

  2. #2
    Registered User
    Join Date
    Dec 2017
    Posts
    1,629
    Try adding #include <wingdi.h>
    windows.h should include this but try adding it separately to see what happens.
    EDIT: Okay, I'm blind. Apparently you already added that. I don't see why you would get those errors.
    Last edited by john.c; 12-06-2021 at 05:20 PM.
    A little inaccuracy saves tons of explanation. - H.H. Munro

  3. #3
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    Code:
    #include<stdio.h>
    #include<stdlib.h>
    #include<time.h>
    #include<wingdi.h>
    #include<windows.h>
    I would try this order of includes; but, I expect it to still fail.

    Tim S.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

  4. #4
    Registered User
    Join Date
    Dec 2017
    Posts
    1,629
    Looking at the wingdi.h source code (not necessarily your version, but perhaps representative), it looks like if NOGDI is defined then pretty much none of it is included. If you are using an IDE, look in the settings and make sure NOGDI is not being defined (presumably on the command line that invokes the compiler). It's possible that there's a checkbox that you check if you want to use GDI.
    A little inaccuracy saves tons of explanation. - H.H. Munro

  5. #5
    Registered User
    Join Date
    Nov 2015
    Posts
    119
    I followed your advice, namely, I changed the order of inclusion of includes

    What I saw is even more amazing, and I confess I don't understand anything at all.


    Code:
    ||=== Build: Debug in risuj (compiler: GNU GCC Compiler) ===|
    C:\CodeBlocks\MinGW\include\wingdi.h|1340|error: 'UINT' does not name a type|
    C:\CodeBlocks\MinGW\include\wingdi.h|1344|error: 'FLOAT' does not name a type|
    C:\CodeBlocks\MinGW\include\wingdi.h|1345|error: 'FLOAT' does not name a type|
    C:\CodeBlocks\MinGW\include\wingdi.h|1346|error: 'FLOAT' does not name a type|
    C:\CodeBlocks\MinGW\include\wingdi.h|1349|error: 'LONG' does not name a type|
    C:\CodeBlocks\MinGW\include\wingdi.h|1350|error: 'LONG' does not name a type|
    C:\CodeBlocks\MinGW\include\wingdi.h|1351|error: 'LONG' does not name a type|
    C:\CodeBlocks\MinGW\include\wingdi.h|1352|error: 'LONG' does not name a type|
    C:\CodeBlocks\MinGW\include\wingdi.h|1353|error: 'WORD' does not name a type|
    C:\CodeBlocks\MinGW\include\wingdi.h|1354|error: 'WORD' does not name a type|
    C:\CodeBlocks\MinGW\include\wingdi.h|1355|error: 'LPVOID' does not name a type|
    C:\CodeBlocks\MinGW\include\wingdi.h|1358|error: 'DWORD' does not name a type|
    C:\CodeBlocks\MinGW\include\wingdi.h|1359|error: 'WORD' does not name a type|
    C:\CodeBlocks\MinGW\include\wingdi.h|1360|error: 'WORD' does not name a type|
    C:\CodeBlocks\MinGW\include\wingdi.h|1361|error: 'WORD' does not name a type|
    C:\CodeBlocks\MinGW\include\wingdi.h|1362|error: 'WORD' does not name a type|
    C:\CodeBlocks\MinGW\include\wingdi.h|1366|error: 'BYTE' does not name a type|
    C:\CodeBlocks\MinGW\include\wingdi.h|1367|error: 'BYTE' does not name a type|
    C:\CodeBlocks\MinGW\include\wingdi.h|1368|error: 'BYTE' does not name a type|
    C:\CodeBlocks\MinGW\include\wingdi.h|1373|error: 'WORD' does not name a type|
    C:\CodeBlocks\MinGW\include\wingdi.h|1374|error: 'DWORD' does not name a type|
    C:\CodeBlocks\MinGW\include\wingdi.h|1375|error: 'WORD' does not name a type|
    C:\CodeBlocks\MinGW\include\wingdi.h|1376|error: 'WORD' does not name a type|
    C:\CodeBlocks\MinGW\include\wingdi.h|1377|error: 'DWORD' does not name a type|
    C:\CodeBlocks\MinGW\include\wingdi.h|1385|error: 'DWORD' does not name a type|
    C:\CodeBlocks\MinGW\include\wingdi.h|1386|error: 'LONG' does not name a type|
    C:\CodeBlocks\MinGW\include\wingdi.h|1387|error: 'LONG' does not name a type|
    C:\CodeBlocks\MinGW\include\wingdi.h|1388|error: 'WORD' does not name a type|
    C:\CodeBlocks\MinGW\include\wingdi.h|1389|error: 'WORD' does not name a type|
    C:\CodeBlocks\MinGW\include\wingdi.h|1390|error: 'DWORD' does not name a type|
    C:\CodeBlocks\MinGW\include\wingdi.h|1391|error: 'DWORD' does not name a type|
    C:\CodeBlocks\MinGW\include\wingdi.h|1392|error: 'LONG' does not name a type|
    C:\CodeBlocks\MinGW\include\wingdi.h|1393|error: 'LONG' does not name a type|
    C:\CodeBlocks\MinGW\include\wingdi.h|1394|error: 'DWORD' does not name a type|
    C:\CodeBlocks\MinGW\include\wingdi.h|1395|error: 'DWORD' does not name a type|
    C:\CodeBlocks\MinGW\include\wingdi.h|1398|error: 'BYTE' does not name a type|
    C:\CodeBlocks\MinGW\include\wingdi.h|1399|error: 'BYTE' does not name a type|
    C:\CodeBlocks\MinGW\include\wingdi.h|1400|error: 'BYTE' does not name a type|
    C:\CodeBlocks\MinGW\include\wingdi.h|1401|error: 'BYTE' does not name a type|
    C:\CodeBlocks\MinGW\include\wingdi.h|1420|error: 'DWORD' does not name a type|
    C:\CodeBlocks\MinGW\include\wingdi.h|1421|error: 'LONG' does not name a type|
    C:\CodeBlocks\MinGW\include\wingdi.h|1422|error: 'LONG' does not name a type|
    C:\CodeBlocks\MinGW\include\wingdi.h|1423|error: 'WORD' does not name a type|
    C:\CodeBlocks\MinGW\include\wingdi.h|1424|error: 'WORD' does not name a type|
    C:\CodeBlocks\MinGW\include\wingdi.h|1425|error: 'DWORD' does not name a type|
    C:\CodeBlocks\MinGW\include\wingdi.h|1426|error: 'DWORD' does not name a type|
    C:\CodeBlocks\MinGW\include\wingdi.h|1427|error: 'LONG' does not name a type|
    C:\CodeBlocks\MinGW\include\wingdi.h|1428|error: 'LONG' does not name a type|
    C:\CodeBlocks\MinGW\include\wingdi.h|1429|error: 'DWORD' does not name a type|
    C:\CodeBlocks\MinGW\include\wingdi.h|1430|error: 'DWORD' does not name a type|
    ||More errors follow but not being shown.|
    ||Edit the max errors limit in compiler options...|
    ||=== Build failed: 50 error(s), 0 warning(s) (0 minute(s), 3 second(s)) ===|
    However, no, it's understandable, on the contrary, it's understandable. The order of inclusion cannot be changed.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Method are not declared
    By SuchtyTV in forum C Programming
    Replies: 2
    Last Post: 02-22-2019, 03:25 PM
  2. Not declared in this scope
    By Taka in forum C++ Programming
    Replies: 45
    Last Post: 03-13-2009, 05:36 AM
  3. Where can & can't variables be declared in C?
    By cpjust in forum C Programming
    Replies: 5
    Last Post: 11-17-2007, 06:42 PM
  4. File I/O: ios has not been declared?
    By g4j31a5 in forum C++ Programming
    Replies: 1
    Last Post: 11-30-2006, 09:12 PM
  5. Replies: 3
    Last Post: 10-12-2006, 06:58 AM

Tags for this Thread