ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
My program was written in c99 style.
make complained that i should turn on c99 flag.
But i only know: "gcc -std=c99 ...."
How 2 modify the makefile to compile in c99 style.
I don't know the kernel make files well enough to give you an answer (the makefile fragment you posted doesn't make sense to me since it seems incomplete), but there most likely is a var like CC_FLAGS which is being passed to CC which is gcc.
The makefile is pretty standard for 2.6.x modules. The reason they went to that is so module maintainers wouldn't have to write different makefiles for different kernel releases. The lines causing the warnings or errors are important to post because nearly every C99 warning can be fixed without using C99, especially since modules don't use libc functions.
ta0kira
Hi,
it still doesn't work. Though i added export EXTRA_CFLAGS += -std=c99
i tried the makefile osor(#9) showed above. Failed to work.
In my optimistic opinion:
Maybe in the near future, with version updating, this problem will be fixed automatically.
I'm not planning to spent any more time on this annoying issue any more.
That's not a very serious problem, i think, not worthy too much time.
Tku all very much.
Anymore, any advice that would help is still welcome. ^_^
Yes, please see my other post. You need to declare int i; outside of the for structure. That's what is causing the error and it's such a minor thing that you're better off changing it than trying to force C99 to work. Additionally, other things might stop working because the change in standard changes the macros that are defined, which sometimes changes the structure of the code.
ta0kira
PS From the make infopage:
Code:
To pass down, or "export", a variable, `make' adds the variable
and its value to the environment for running each command. The
sub-`make', in turn, uses the environment to initialize its table
of variable values. ...
Except by explicit request, `make' exports a variable only if it
is either defined in the environment initially or set on the
command line, and if its name consists only of letters, numbers,
and underscores. ...
If you want to export specific variables to a sub-`make', use the
`export' directive ...
(that’s a capital ‘V’) it will output the intermediate steps taken by the Makefile.
I tried a slightly modified version of the Makefile I provided in post 9 (I changed c99 to gnu99 since the kernel makes use of GNU C features) with the sourcecode you provided. It works as expected (I highlighted the command-line option “std=gnu99” in red, but you might have to scroll to see it):
Unfortunately, it still doesn't work on my machine.
Ok, Just ignore it. i have no patience with this weird, troublesome but not very important problem now.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.