Thread: failure to import external C libraries in C++ project

  1. #1
    Registered User
    Join Date
    Dec 2007
    Posts
    19

    failure to import external C libraries in C++ project

    Hi,
    i use Visual Studio 2005 and i am trying to import some C libs statically in C++ code. In my StdAfx.h, i include the following:
    Code:
    ...
    extern "C"{
    
    #include <ok.h>
    
    #include <scardcl.h>
    
    }
    ...

    As soon as i try to compile, i get the following errors. Does anyone suspect what is going on?
    Code:
    ....
    
    StdAfx.cpp
    
    WINVER not defined. Defaulting to 0x0502 (Windows Server 2003)
    
    C:\Omnikey\Include\ok.h(345) : warning C4005: 'FAR' : macro redefinition
    
    C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\windef.h(145) : see previous definition of 'FAR'
    
    C:\Omnikey\Include\ok.h(346) : warning C4005: 'NEAR' : macro redefinition
    
    C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\windef.h(146) : see previous definition of 'NEAR'
    
    C:\Omnikey\Include\ok.h(359) : warning C4005: 'PASCAL' : macro redefinition
    
    C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\windef.h(127) : see previous definition of 'PASCAL'
    
    C:\Omnikey\Include\ok.h(437) : error C2371: 'LONG64' : redefinition; different basic types
    
    C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\basetsd.h(418) : see declaration of 'LONG64'
    
    C:\Omnikey\Include\ok.h(514) : error C2371: 'ULONG64' : redefinition; different basic types
    
    C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\basetsd.h(425) : see declaration of 'ULONG64'
    
    C:\Omnikey\Include\ok.h(585) : error C2143: syntax error : missing ';' before '*'
    
    C:\Omnikey\Include\ok.h(585) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    
    C:\Omnikey\Include\ok.h(588) : error C2143: syntax error : missing ';' before '*'
    
    C:\Omnikey\Include\ok.h(588) : error C2371: '_far' : redefinition; different basic types
    
    C:\Omnikey\Include\ok.h(585) : see declaration of '_far'
    
    C:\Omnikey\Include\ok.h(588) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    
    C:\Omnikey\Include\ok.h(676) : error C2143: syntax error : missing ';' before '*'
    
    C:\Omnikey\Include\ok.h(676) : error C2373: '_far' : redefinition; different type modifiers
    
    C:\Omnikey\Include\ok.h(585) : see declaration of '_far'
    
    C:\Omnikey\Include\ok.h(676) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    
    C:\Omnikey\Include\ok.h(676) : error C2377: 'PLONG64' : redefinition; typedef cannot be overloaded with any other symbol
    
    C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\basetsd.h(418) : see declaration of 'PLONG64'
    
    C:\Omnikey\Include\ok.h(679) : error C2143: syntax error : missing ';' before '*'
    
    C:\Omnikey\Include\ok.h(679) : error C2373: '_far' : redefinition; different type modifiers
    
    C:\Omnikey\Include\ok.h(585) : see declaration of '_far'
    
    C:\Omnikey\Include\ok.h(679) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    
    C:\Omnikey\Include\ok.h(679) : error C2377: 'PULONG64' : redefinition; typedef cannot be overloaded with any other symbol
    
    C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\basetsd.h(425) : see declaration of 'PULONG64'
    
    C:\Omnikey\Include\ok.h(689) : error C2143: syntax error : missing ';' before '*'
    
    C:\Omnikey\Include\ok.h(689) : error C2373: '_far' : redefinition; different type modifiers
    
    C:\Omnikey\Include\ok.h(585) : see declaration of '_far'
    
    C:\Omnikey\Include\ok.h(689) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    
    C:\Omnikey\Include\ok.h(692) : error C2143: syntax error : missing ';' before '*'
    
    C:\Omnikey\Include\ok.h(692) : error C2373: '_far' : redefinition; different type modifiers
    
    C:\Omnikey\Include\ok.h(585) : see declaration of '_far'
    
    C:\Omnikey\Include\ok.h(692) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    
    C:\Omnikey\Include\ok.h(696) : error C2143: syntax error : missing ';' before '*'
    
    C:\Omnikey\Include\ok.h(696) : error C2373: '_far' : redefinition; different type modifiers
    
    C:\Omnikey\Include\ok.h(585) : see declaration of '_far'
    
    C:\Omnikey\Include\ok.h(696) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    
    C:\Omnikey\Include\ok.h(698) : error C2143: syntax error : missing ';' before '*'
    
    C:\Omnikey\Include\ok.h(698) : error C2373: '_far' : redefinition; different type modifiers
    
    C:\Omnikey\Include\ok.h(585) : see declaration of '_far'
    
    C:\Omnikey\Include\ok.h(698) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    
    C:\Omnikey\Include\ok.h(700) : error C2143: syntax error : missing ';' before '*'
    
    C:\Omnikey\Include\ok.h(700) : error C2373: '_far' : redefinition; different type modifiers
    
    C:\Omnikey\Include\ok.h(585) : see declaration of '_far'
    
    C:\Omnikey\Include\ok.h(700) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    
    C:\Omnikey\Include\ok.h(942) : error C2143: syntax error : missing ';' before '*'
    
    C:\Omnikey\Include\ok.h(942) : error C2373: '_far' : redefinition; different type modifiers
    
    C:\Omnikey\Include\ok.h(585) : see declaration of '_far'
    
    C:\Omnikey\Include\ok.h(942) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    
    C:\Omnikey\Include\ok.h(943) : error C2143: syntax error : missing ';' before '*'
    
    C:\Omnikey\Include\ok.h(943) : error C2373: '_far' : redefinition; different type modifiers
    
    C:\Omnikey\Include\ok.h(585) : see declaration of '_far'
    
    C:\Omnikey\Include\ok.h(943) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    
    C:\Omnikey\Include\ok.h(944) : error C2143: syntax error : missing ';' before '*'
    
    C:\Omnikey\Include\ok.h(944) : error C2373: '_far' : redefinition; different type modifiers
    
    C:\Omnikey\Include\ok.h(585) : see declaration of '_far'
    
    C:\Omnikey\Include\ok.h(944) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    
    C:\Omnikey\Include\ok.h(961) : error C2143: syntax error : missing ';' before '*'
    
    C:\Omnikey\Include\ok.h(961) : error C2373: '_far' : redefinition; different type modifiers
    
    C:\Omnikey\Include\ok.h(585) : see declaration of '_far'
    
    C:\Omnikey\Include\ok.h(961) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    
    C:\Omnikey\Include\ok.h(962) : error C2143: syntax error : missing ';' before '*'
    
    C:\Omnikey\Include\ok.h(962) : error C2373: '_far' : redefinition; different type modifiers
    
    C:\Omnikey\Include\ok.h(585) : see declaration of '_far'
    
    C:\Omnikey\Include\ok.h(962) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    
    C:\Omnikey\Include\ok.h(963) : error C2143: syntax error : missing ';' before '*'
    
    C:\Omnikey\Include\ok.h(963) : error C2373: '_far' : redefinition; different type modifiers
    
    C:\Omnikey\Include\ok.h(585) : see declaration of '_far'
    
    C:\Omnikey\Include\ok.h(963) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    
    C:\Omnikey\Include\ok.h(1208) : error C2143: syntax error : missing ';' before '*'
    
    C:\Omnikey\Include\ok.h(1208) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    
    C:\Omnikey\Include\ok.h(1209) : error C2143: syntax error : missing ';' before '*'
    
    C:\Omnikey\Include\ok.h(1209) : error C2371: '_far' : redefinition; different basic types
    
    C:\Omnikey\Include\ok.h(585) : see declaration of '_far'
    
    C:\Omnikey\Include\ok.h(1209) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    
    C:\Omnikey\Include\ok.h(1210) : error C2143: syntax error : missing ';' before '*'
    
    C:\Omnikey\Include\ok.h(1210) : error C2373: '_far' : redefinition; different type modifiers
    
    C:\Omnikey\Include\ok.h(585) : see declaration of '_far'
    
    C:\Omnikey\Include\ok.h(1210) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    
    C:\Omnikey\Include\ok.h(1211) : error C2143: syntax error : missing ';' before '*'
    
    C:\Omnikey\Include\ok.h(1211) : error C2373: '_far' : redefinition; different type modifiers
    
    C:\Omnikey\Include\ok.h(585) : see declaration of '_far'
    
    C:\Omnikey\Include\ok.h(1211) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    
    C:\Omnikey\Include\ok.h(1212) : error C2143: syntax error : missing ';' before '*'
    
    C:\Omnikey\Include\ok.h(1212) : error C2373: '_far' : redefinition; different type modifiers
    
    C:\Omnikey\Include\ok.h(585) : see declaration of '_far'
    
    C:\Omnikey\Include\ok.h(1212) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    
    C:\Omnikey\Include\ok.h(1213) : error C2143: syntax error : missing ';' before '*'
    
    C:\Omnikey\Include\ok.h(1213) : error C2373: '_far' : redefinition; different type modifiers
    
    C:\Omnikey\Include\ok.h(585) : see declaration of '_far'
    
    C:\Omnikey\Include\ok.h(1213) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    
    C:\Omnikey\Include\ok.h(1214) : error C2143: syntax error : missing ';' before '*'
    
    C:\Omnikey\Include\ok.h(1214) : error C2373: '_far' : redefinition; different type modifiers
    
    C:\Omnikey\Include\ok.h(585) : see declaration of '_far'
    
    C:\Omnikey\Include\ok.h(1214) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    
    C:\Omnikey\Include\ok.h(1215) : error C2143: syntax error : missing ';' before '*'
    
    C:\Omnikey\Include\ok.h(1215) : error C2373: '_far' : redefinition; different type modifiers
    
    C:\Omnikey\Include\ok.h(585) : see declaration of '_far'
    
    C:\Omnikey\Include\ok.h(1215) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    
    C:\Omnikey\Include\ok.h(1216) : error C2143: syntax error : missing ';' before '*'
    
    C:\Omnikey\Include\ok.h(1216) : error C2373: '_far' : redefinition; different type modifiers
    
    C:\Omnikey\Include\ok.h(585) : see declaration of '_far'
    
    C:\Omnikey\Include\ok.h(1216) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    
    C:\Omnikey\Include\ok.h(1217) : error C2143: syntax error : missing ';' before '*'
    
    C:\Omnikey\Include\ok.h(1217) : error C2373: '_far' : redefinition; different type modifiers
    
    C:\Omnikey\Include\ok.h(585) : see declaration of '_far'
    
    C:\Omnikey\Include\ok.h(1217) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    
    C:\Omnikey\Include\ok.h(1218) : error C2143: syntax error : missing ';' before '*'
    
    C:\Omnikey\Include\ok.h(1218) : error C2373: '_far' : redefinition; different type modifiers
    
    C:\Omnikey\Include\ok.h(585) : see declaration of '_far'
    
    C:\Omnikey\Include\ok.h(1218) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    
    C:\Omnikey\Include\ok.h(1219) : error C2143: syntax error : missing ';' before '*'
    
    C:\Omnikey\Include\ok.h(1219) : error C2373: '_far' : redefinition; different type modifiers
    
    C:\Omnikey\Include\ok.h(585) : see declaration of '_far'
    
    C:\Omnikey\Include\ok.h(1219) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    
    C:\Omnikey\Include\ok.h(1220) : error C2143: syntax error : missing ';' before '*'
    
    C:\Omnikey\Include\ok.h(1220) : error C2373: '_far' : redefinition; different type modifiers
    
    C:\Omnikey\Include\ok.h(585) : see declaration of '_far'
    
    C:\Omnikey\Include\ok.h(1220) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    
    C:\Omnikey\Include\ok.h(1223) : error C2143: syntax error : missing ';' before '*'
    
    C:\Omnikey\Include\ok.h(1223) : error C2373: '_far' : redefinition; different type modifiers
    
    C:\Omnikey\Include\ok.h(585) : see declaration of '_far'
    
    C:\Omnikey\Include\ok.h(1223) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    
    C:\Omnikey\Include\ok.h(1225) : error C2143: syntax error : missing ';' before '*'
    
    C:\Omnikey\Include\ok.h(1225) : error C2373: '_far' : redefinition; different type modifiers
    
    C:\Omnikey\Include\ok.h(585) : see declaration of '_far'
    
    C:\Omnikey\Include\ok.h(1225) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    
    C:\Omnikey\Include\ok.h(1226) : error C2143: syntax error : missing ';' before '*'
    
    C:\Omnikey\Include\ok.h(1226) : error C2373: '_far' : redefinition; different type modifiers
    
    C:\Omnikey\Include\ok.h(585) : see declaration of '_far'
    
    C:\Omnikey\Include\ok.h(1226) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    
    C:\Omnikey\Include\ok.h(1227) : error C2143: syntax error : missing ';' before '*'
    
    C:\Omnikey\Include\ok.h(1227) : error C2373: '_far' : redefinition; different type modifiers
    
    C:\Omnikey\Include\ok.h(585) : see declaration of '_far'
    
    C:\Omnikey\Include\ok.h(1227) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    
    C:\Omnikey\Include\ok.h(1230) : error C2143: syntax error : missing ';' before '*'
    
    C:\Omnikey\Include\ok.h(1230) : error C2373: '_far' : redefinition; different type modifiers
    
    C:\Omnikey\Include\ok.h(585) : see declaration of '_far'
    
    C:\Omnikey\Include\ok.h(1230) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    
    C:\Omnikey\Include\ok.h(1231) : error C2143: syntax error : missing ';' before '*'
    
    C:\Omnikey\Include\ok.h(1231) : error C2373: '_far' : redefinition; different type modifiers
    
    C:\Omnikey\Include\ok.h(585) : see declaration of '_far'
    
    C:\Omnikey\Include\ok.h(1231) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    
    C:\Omnikey\Include\ok.h(1232) : error C2143: syntax error : missing ';' before '*'
    
    C:\Omnikey\Include\ok.h(1232) : error C2373: '_far' : redefinition; different type modifiers
    
    C:\Omnikey\Include\ok.h(585) : see declaration of '_far'
    
    C:\Omnikey\Include\ok.h(1232) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    
    C:\Omnikey\Include\ok.h(1233) : error C2143: syntax error : missing ';' before '*'
    
    ...
    
    C:\Omnikey\Include\ok.h(1241) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    
    C:\Omnikey\Include\ok.h(1243) : error C2143: syntax error : missing ';' before '*'
    
    C:\Omnikey\Include\ok.h(1243) : error C2373: '_far' : redefinition; different type modifiers
    
    C:\Omnikey\Include\ok.h(585) : see declaration of '_far'
    
    C:\Omnikey\Include\ok.h(1243) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    
    C:\Omnikey\Include\ok.h(1244) : error C2143: syntax error : missing ';' before '*'
    
    C:\Omnikey\Include\ok.h(1244) : error C2373: '_far' : redefinition; different type modifiers
    
    C:\Omnikey\Include\ok.h(585) : see declaration of '_far'
    ....
    
    C:\Omnikey\Include\ok.h(1247) : error C2373: '_far' : redefinition; different type modifiers
    
    C:\Omnikey\Include\ok.h(585) : see declaration of '_far'
    
    C:\Omnikey\Include\ok.h(1247) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    
    C:\Omnikey\Include\ok.h(1261) : error C2143: syntax error : missing ';' before '*'
    
    C:\Omnikey\Include\ok.h(1261) : error C2373: '_far' : redefinition; different type modifiers
    
    C:\Omnikey\Include\ok.h(585) : see declaration of '_far'
    
    C:\Omnikey\Include\ok.h(1261) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    
    C:\Omnikey\Include\ok.h(1263) : error C2143: syntax error : missing ';' before '*'
    
    C:\Omnikey\Include\ok.h(1263) : error C2373: '_far' : redefinition; different type modifiers
    
    C:\Omnikey\Include\ok.h(585) : see declaration of '_far'
    
    C:\Omnikey\Include\ok.h(1263) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    
    C:\Omnikey\Include\ok.h(1268) : error C2143: syntax error : missing ';' before '*'
    
    C:\Omnikey\Include\ok.h(1268) : error C2373: '_far' : redefinition; different type modifiers
    
    C:\Omnikey\Include\ok.h(585) : see declaration of '_far'
    
    C:\Omnikey\Include\ok.h(1268) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    
    C:\Omnikey\Include\ok.h(1284) : error C2143: syntax error : missing ';' before '*'
    
    C:\Omnikey\Include\ok.h(1284) : error C2373: '_far' : redefinition; different type modifiers
    
    C:\Omnikey\Include\ok.h(585) : see declaration of '_far'
    
    C:\Omnikey\Include\ok.h(1284) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    
    C:\Omnikey\Include\ok.h(1294) : error C2143: syntax error : missing ';' before '*'
    
    C:\Omnikey\Include\ok.h(1294) : error C2373: '_far' : redefinition; different type modifiers
    
    C:\Omnikey\Include\ok.h(585) : see declaration of '_far'
    
    C:\Omnikey\Include\ok.h(1294) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    
    C:\Omnikey\Include\ok.h(1296) : error C2143: syntax error : missing ';' before '*'
    
    C:\Omnikey\Include\ok.h(1296) : error C2373: '_far' : redefinition; different type modifiers
    
    C:\Omnikey\Include\ok.h(585) : see declaration of '_far'
    
    C:\Omnikey\Include\ok.h(1296) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    
    C:\Omnikey\Include\scardcl.h(46) : error C2146: syntax error : missing ';' before identifier '_pascal'
    
    C:\Omnikey\Include\scardcl.h(46) : error C2377: '_far' : redefinition; typedef cannot be overloaded with any other symbol
    
    C:\Omnikey\Include\ok.h(585) : see declaration of '_far'
    
    C:\Omnikey\Include\scardcl.h(46) : error C2146: syntax error : missing ';' before identifier '_loadds'
    
    C:\Omnikey\Include\scardcl.h(46) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    
    C:\Omnikey\Include\scardcl.h(46) : error C2146: syntax error : missing ';' before identifier 'SCardCLWriteMifareKeyToReader'
    
    C:\Omnikey\Include\scardcl.h(46) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    
    C:\Omnikey\Include\scardcl.h(54) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    
    C:\Omnikey\Include\scardcl.h(57) : error C2146: syntax error : missing ';' before identifier '_pascal'
    
    C:\Omnikey\Include\scardcl.h(57) : fatal error C1003: error count exceeds 100; stopping compilation
    
    Main.cpp
    
    WINVER not defined. Defaulting to 0x0502 (Windows Server 2003)
    
    ....

  2. #2
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Didn't the repetitious nature of those errors clue you in that you possibly didn't have to post ALL that crap?

  3. #3
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    No, we have no idea because you've supplied no code to tell us what you're doing.

  4. #4
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    The first few are obvious. ok.h is doing #define BLAH, but BLAH was already #defined...
    For the others, just search for the error code. The MSDN usually tells you what caused it and how to fix it.
    Ex. C4430:
    http://msdn2.microsoft.com/en-us/lib...96(VS.80).aspx

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. QT and external libraries
    By Quacker in forum Linux Programming
    Replies: 1
    Last Post: 04-08-2003, 07:02 AM
  2. Unresolved external symbols in OGL
    By Shadow12345 in forum Game Programming
    Replies: 4
    Last Post: 08-04-2002, 09:46 PM
  3. error LNK2001: unresolved external symbol
    By Unregistered in forum C Programming
    Replies: 12
    Last Post: 07-12-2002, 08:45 PM
  4. DJGPP project problems
    By VirtualAce in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 06-08-2002, 07:16 PM
  5. Replies: 2
    Last Post: 01-01-2002, 09:03 AM