cl Compiler throws errors for external header file












1















I am working on a project where I need to control some hardware through an API provided by the manufacturer of the device. There are code-examples given, which should compile fine. Some of the functionality is defined in .h-header files provided with the API. When I copy and paste one of the programming examples into my .c-file (including the referenced .h-Headers in the same folder) the cl compiler I access through my VS 2017 Native Tools Command Prompt throws excpetions/errors, mostly C2059 and C2061 errors. For example:



Microsoft (R) C/C++ Optimizing Compiler Version 19.10.25019 for x64
Copyright (C) Microsoft Corporation. All rights reserved.

pco_controller.c
c:usersoptical microscopedesktopvinzenzpco.edge 5.5pco_controllersc2_SDKS
tructures.h(155): error C2061: syntax error: identifier 'SHORT'
c:usersoptical microscopedesktopvinzenzpco.edge 5.5pco_controllersc2_SDKS
tructures.h(156): error C2061: syntax error: identifier 'ZZwAlignDummy'
c:usersoptical microscopedesktopvinzenzpco.edge 5.5pco_controllersc2_SDKS
tructures.h(156): error C2059: syntax error: ';'
c:usersoptical microscopedesktopvinzenzpco.edge 5.5pco_controllersc2_SDKS
tructures.h(157): error C2061: syntax error: identifier 'dwStatusDll'
c:usersoptical microscopedesktopvinzenzpco.edge 5.5pco_controllersc2_SDKS
tructures.h(157): error C2059: syntax error: ';'
c:usersoptical microscopedesktopvinzenzpco.edge 5.5pco_controllersc2_SDKS
tructures.h(158): error C2061: syntax error: identifier 'dwStatusDrv'
c:usersoptical microscopedesktopvinzenzpco.edge 5.5pco_controllersc2_SDKS
tructures.h(158): error C2059: syntax error: ';'
c:usersoptical microscopedesktopvinzenzpco.edge 5.5pco_controllersc2_SDKS
tructures.h(159): error C2059: syntax error: '}'


When we take a look into the sc2_SDKStructures.h file, we find:



typedef struct                         // Buffer list structure for  PCO_WaitforBuffer
{
SHORT sBufNr;
WORD ZZwAlignDummy;
DWORD dwStatusDll;
DWORD dwStatusDrv; // 12
} PCO_Buflist;


As I am totally new to C-programming I dont understand the errors and given the fact that the headers were provided by the manufacturer of the hardware, I dont see why their code should be wrong.










share|improve this question


















  • 3





    SHORT is defined in yet another header file. find that one and include it in sdkstructures.h. it's probably windows.h

    – Serve Laurijssen
    Nov 13 '18 at 12:48








  • 1





    The same holds true, of course, for WORD and DWORD, which are probably declared in the same file.

    – Mawg
    Nov 13 '18 at 12:55











  • Can I also include it in my actual source code or do I need to include them in every Header file (as I use some of them and there are multiple errors for every included header file)

    – Zi1mann
    Nov 13 '18 at 12:55


















1















I am working on a project where I need to control some hardware through an API provided by the manufacturer of the device. There are code-examples given, which should compile fine. Some of the functionality is defined in .h-header files provided with the API. When I copy and paste one of the programming examples into my .c-file (including the referenced .h-Headers in the same folder) the cl compiler I access through my VS 2017 Native Tools Command Prompt throws excpetions/errors, mostly C2059 and C2061 errors. For example:



Microsoft (R) C/C++ Optimizing Compiler Version 19.10.25019 for x64
Copyright (C) Microsoft Corporation. All rights reserved.

pco_controller.c
c:usersoptical microscopedesktopvinzenzpco.edge 5.5pco_controllersc2_SDKS
tructures.h(155): error C2061: syntax error: identifier 'SHORT'
c:usersoptical microscopedesktopvinzenzpco.edge 5.5pco_controllersc2_SDKS
tructures.h(156): error C2061: syntax error: identifier 'ZZwAlignDummy'
c:usersoptical microscopedesktopvinzenzpco.edge 5.5pco_controllersc2_SDKS
tructures.h(156): error C2059: syntax error: ';'
c:usersoptical microscopedesktopvinzenzpco.edge 5.5pco_controllersc2_SDKS
tructures.h(157): error C2061: syntax error: identifier 'dwStatusDll'
c:usersoptical microscopedesktopvinzenzpco.edge 5.5pco_controllersc2_SDKS
tructures.h(157): error C2059: syntax error: ';'
c:usersoptical microscopedesktopvinzenzpco.edge 5.5pco_controllersc2_SDKS
tructures.h(158): error C2061: syntax error: identifier 'dwStatusDrv'
c:usersoptical microscopedesktopvinzenzpco.edge 5.5pco_controllersc2_SDKS
tructures.h(158): error C2059: syntax error: ';'
c:usersoptical microscopedesktopvinzenzpco.edge 5.5pco_controllersc2_SDKS
tructures.h(159): error C2059: syntax error: '}'


When we take a look into the sc2_SDKStructures.h file, we find:



typedef struct                         // Buffer list structure for  PCO_WaitforBuffer
{
SHORT sBufNr;
WORD ZZwAlignDummy;
DWORD dwStatusDll;
DWORD dwStatusDrv; // 12
} PCO_Buflist;


As I am totally new to C-programming I dont understand the errors and given the fact that the headers were provided by the manufacturer of the hardware, I dont see why their code should be wrong.










share|improve this question


















  • 3





    SHORT is defined in yet another header file. find that one and include it in sdkstructures.h. it's probably windows.h

    – Serve Laurijssen
    Nov 13 '18 at 12:48








  • 1





    The same holds true, of course, for WORD and DWORD, which are probably declared in the same file.

    – Mawg
    Nov 13 '18 at 12:55











  • Can I also include it in my actual source code or do I need to include them in every Header file (as I use some of them and there are multiple errors for every included header file)

    – Zi1mann
    Nov 13 '18 at 12:55
















1












1








1








I am working on a project where I need to control some hardware through an API provided by the manufacturer of the device. There are code-examples given, which should compile fine. Some of the functionality is defined in .h-header files provided with the API. When I copy and paste one of the programming examples into my .c-file (including the referenced .h-Headers in the same folder) the cl compiler I access through my VS 2017 Native Tools Command Prompt throws excpetions/errors, mostly C2059 and C2061 errors. For example:



Microsoft (R) C/C++ Optimizing Compiler Version 19.10.25019 for x64
Copyright (C) Microsoft Corporation. All rights reserved.

pco_controller.c
c:usersoptical microscopedesktopvinzenzpco.edge 5.5pco_controllersc2_SDKS
tructures.h(155): error C2061: syntax error: identifier 'SHORT'
c:usersoptical microscopedesktopvinzenzpco.edge 5.5pco_controllersc2_SDKS
tructures.h(156): error C2061: syntax error: identifier 'ZZwAlignDummy'
c:usersoptical microscopedesktopvinzenzpco.edge 5.5pco_controllersc2_SDKS
tructures.h(156): error C2059: syntax error: ';'
c:usersoptical microscopedesktopvinzenzpco.edge 5.5pco_controllersc2_SDKS
tructures.h(157): error C2061: syntax error: identifier 'dwStatusDll'
c:usersoptical microscopedesktopvinzenzpco.edge 5.5pco_controllersc2_SDKS
tructures.h(157): error C2059: syntax error: ';'
c:usersoptical microscopedesktopvinzenzpco.edge 5.5pco_controllersc2_SDKS
tructures.h(158): error C2061: syntax error: identifier 'dwStatusDrv'
c:usersoptical microscopedesktopvinzenzpco.edge 5.5pco_controllersc2_SDKS
tructures.h(158): error C2059: syntax error: ';'
c:usersoptical microscopedesktopvinzenzpco.edge 5.5pco_controllersc2_SDKS
tructures.h(159): error C2059: syntax error: '}'


When we take a look into the sc2_SDKStructures.h file, we find:



typedef struct                         // Buffer list structure for  PCO_WaitforBuffer
{
SHORT sBufNr;
WORD ZZwAlignDummy;
DWORD dwStatusDll;
DWORD dwStatusDrv; // 12
} PCO_Buflist;


As I am totally new to C-programming I dont understand the errors and given the fact that the headers were provided by the manufacturer of the hardware, I dont see why their code should be wrong.










share|improve this question














I am working on a project where I need to control some hardware through an API provided by the manufacturer of the device. There are code-examples given, which should compile fine. Some of the functionality is defined in .h-header files provided with the API. When I copy and paste one of the programming examples into my .c-file (including the referenced .h-Headers in the same folder) the cl compiler I access through my VS 2017 Native Tools Command Prompt throws excpetions/errors, mostly C2059 and C2061 errors. For example:



Microsoft (R) C/C++ Optimizing Compiler Version 19.10.25019 for x64
Copyright (C) Microsoft Corporation. All rights reserved.

pco_controller.c
c:usersoptical microscopedesktopvinzenzpco.edge 5.5pco_controllersc2_SDKS
tructures.h(155): error C2061: syntax error: identifier 'SHORT'
c:usersoptical microscopedesktopvinzenzpco.edge 5.5pco_controllersc2_SDKS
tructures.h(156): error C2061: syntax error: identifier 'ZZwAlignDummy'
c:usersoptical microscopedesktopvinzenzpco.edge 5.5pco_controllersc2_SDKS
tructures.h(156): error C2059: syntax error: ';'
c:usersoptical microscopedesktopvinzenzpco.edge 5.5pco_controllersc2_SDKS
tructures.h(157): error C2061: syntax error: identifier 'dwStatusDll'
c:usersoptical microscopedesktopvinzenzpco.edge 5.5pco_controllersc2_SDKS
tructures.h(157): error C2059: syntax error: ';'
c:usersoptical microscopedesktopvinzenzpco.edge 5.5pco_controllersc2_SDKS
tructures.h(158): error C2061: syntax error: identifier 'dwStatusDrv'
c:usersoptical microscopedesktopvinzenzpco.edge 5.5pco_controllersc2_SDKS
tructures.h(158): error C2059: syntax error: ';'
c:usersoptical microscopedesktopvinzenzpco.edge 5.5pco_controllersc2_SDKS
tructures.h(159): error C2059: syntax error: '}'


When we take a look into the sc2_SDKStructures.h file, we find:



typedef struct                         // Buffer list structure for  PCO_WaitforBuffer
{
SHORT sBufNr;
WORD ZZwAlignDummy;
DWORD dwStatusDll;
DWORD dwStatusDrv; // 12
} PCO_Buflist;


As I am totally new to C-programming I dont understand the errors and given the fact that the headers were provided by the manufacturer of the hardware, I dont see why their code should be wrong.







c hardware






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 13 '18 at 12:45









Zi1mannZi1mann

103111




103111








  • 3





    SHORT is defined in yet another header file. find that one and include it in sdkstructures.h. it's probably windows.h

    – Serve Laurijssen
    Nov 13 '18 at 12:48








  • 1





    The same holds true, of course, for WORD and DWORD, which are probably declared in the same file.

    – Mawg
    Nov 13 '18 at 12:55











  • Can I also include it in my actual source code or do I need to include them in every Header file (as I use some of them and there are multiple errors for every included header file)

    – Zi1mann
    Nov 13 '18 at 12:55
















  • 3





    SHORT is defined in yet another header file. find that one and include it in sdkstructures.h. it's probably windows.h

    – Serve Laurijssen
    Nov 13 '18 at 12:48








  • 1





    The same holds true, of course, for WORD and DWORD, which are probably declared in the same file.

    – Mawg
    Nov 13 '18 at 12:55











  • Can I also include it in my actual source code or do I need to include them in every Header file (as I use some of them and there are multiple errors for every included header file)

    – Zi1mann
    Nov 13 '18 at 12:55










3




3





SHORT is defined in yet another header file. find that one and include it in sdkstructures.h. it's probably windows.h

– Serve Laurijssen
Nov 13 '18 at 12:48







SHORT is defined in yet another header file. find that one and include it in sdkstructures.h. it's probably windows.h

– Serve Laurijssen
Nov 13 '18 at 12:48






1




1





The same holds true, of course, for WORD and DWORD, which are probably declared in the same file.

– Mawg
Nov 13 '18 at 12:55





The same holds true, of course, for WORD and DWORD, which are probably declared in the same file.

– Mawg
Nov 13 '18 at 12:55













Can I also include it in my actual source code or do I need to include them in every Header file (as I use some of them and there are multiple errors for every included header file)

– Zi1mann
Nov 13 '18 at 12:55







Can I also include it in my actual source code or do I need to include them in every Header file (as I use some of them and there are multiple errors for every included header file)

– Zi1mann
Nov 13 '18 at 12:55














0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53281307%2fcl-compiler-throws-errors-for-external-header-file%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53281307%2fcl-compiler-throws-errors-for-external-header-file%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Florida Star v. B. J. F.

Danny Elfman

Lugert, Oklahoma