Author Topic: Compiler error  (Read 1533 times)

Offline planodan

  • Single posting newcomer
  • *
  • Posts: 9
Compiler error
« on: June 16, 2015, 05:24:27 pm »
Using CB 13.12, mingw32-gcc version 4.7.1 on win8.1 & winXP.  Simple C program that use to compile clean with CB how compiles with 1 "error: expected specifier-qualifier-list before 'static' ".  The line it references is "static  short sp2func".  If I remove the static qualifier then msg changes to "error: expected...before 'main' ".  I have never gotten this error before and I did find where other have but their solutions didn't work for my situation.  I don't understand the msg, but it appears to have to do with order of structs.  Checked the order of what few typedef structs are used and all declarations of the structs using typedefs come after the typedef definitions.  Thanks!

PS - neither CB nor mingw were updated from when the programs compiled clean

BTW, the build log wasn't attached because it only contained one line, the above error msg.  So my text contained everything.  The real question was the meaning of the error msg, not a review of my code.  Having it would not have revealed the cause of the problem.

Resolution - still not sure exactly what the error msg means other than what I derived from the context of other posts on the internet.  Anyway, I resolved the problem in that the header file "included" immediately before the line of code referenced in the error, i.e. "static short sp2func", contained some extraneous text I hadn't noticed that was entered by the tool that generated the header file.
« Last Edit: June 16, 2015, 10:14:54 pm by dseverns »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6661
    • My Best Post
Re: Compiler error
« Reply #1 on: June 16, 2015, 05:48:18 pm »
Step0: Read this site rules and FAQs
http://forums.codeblocks.org/index.php/topic,9996.0.html
http://wiki.codeblocks.org/index.php?title=FAQ
Step1: Learn the name and version of your Compiler Done in your case.
Step2: Learn how to cut and paste the Compiler Full Build log
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F
Remember to use code tags.     
       http://cboard.cprogramming.com/cplusplus-programming/announcement-posting-code-read-first.html
Step3: Post your code and the Full Build log on a site that supports
       your compiler and/or C/C++ programming.
       Example site: http://cboard.cprogramming.com/forum.php


Tim S.

« Last Edit: June 16, 2015, 05:50:38 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org