Strange vc++ complier error

This is a discussion on Strange vc++ complier error within the Windows Programming forums, part of the Platform Specific Boards category; Im trying to compile one of my projects and im getting an error from msvc++ 6. error... --------------------Configuration: test - ...

  1. #1
    Unregistered
    Guest

    Question Strange vc++ complier error

    Im trying to compile one of my projects and im getting an error from msvc++ 6.


    error...
    --------------------Configuration: test - Win32 Debug--------------------
    Compiling...
    get.cpp
    test.cpp
    C:\dev\test\test.cpp(14) : warning C4518: 'char ' : storage-class or type specifier(s) unexpected here; ignored
    C:\dev\test\test.cpp(14) : error C2146: syntax error : missing ';' before identifier 'winsock'
    C:\dev\pws\test.cpp(14) : fatal error C1004: unexpected end of file found
    qwickload.cpp
    Error executing cl.exe.
    code...(test.cpp)


    #include <windows.h>

    #include "qwickload.h"

    #define xmem(n) (char*)LocalAlloc(LMEM_FIXED | MEM_ZEROINIT , n)
    #define xfree(n) LocalFree( n )

    char winsock[] = "Winsock dll"; //


    I can't see anything striking and can't seem to get past this error... it doesn't happen with other projects on the same compiler, similar stuff.

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    Firstly...dont know why this is happening.......maybe something in qwickload.h that's trhowing the preprocessor off

    Secondly...MEM_ZEROINIT should be LMEM_ZEROINIT........(maybe his is the problem and what I said above is confusing the error reporting part of VC++

    Thirdly......Dump LocalAlloc()....its old........Heaps arent global or local anymore.....they are based in the running process

    Fourthly....try not to use #defines like that....they may be easy to use but they can make debugging and error finding an absolute hell as they dont support type safety

  3. #3
    Unregistered
    Guest

    ahhh...

    the MEM_ZEROINIT thing was just a typo its LMEM_ZEROINIT in the actual code. I though I checked qwikload.h but I forget a ";" on the last prototype. Any Ideas on memory allocation ? Use HeapAlloc instead ?

  4. #4
    Unregistered
    Guest
    hmmm, sorry to double post, but does anyone know how to stop getting the error "unresolved external chkstk", I only want to link to kernel32 and not use any other libraries( ie msvcrt.lib ), I found a page on the msdn site but when I used "/Gs" there was no change [ msvc++ 6 ], the error still occoured.

    Thanks for any help

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. An error is driving me nuts!
    By ulillillia in forum C Programming
    Replies: 5
    Last Post: 04-04-2009, 09:15 PM
  2. Testing some code, lots of errors...
    By Sparrowhawk in forum C Programming
    Replies: 48
    Last Post: 12-15-2008, 03:09 AM
  3. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 04:45 PM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  5. Stupid compiler errors
    By ChrisEacrett in forum C++ Programming
    Replies: 9
    Last Post: 11-30-2003, 04:44 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21