• Advertisement
Sign in to follow this  

Visual Studio 2008 [solved and not worth reading]

This topic is 3034 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

error C2601: local function definitions are illegal All my headers' functions have that I didn't have this with VC++6.0. Thanks in advance! [Edited by - szecs on October 31, 2009 2:34:14 PM]

Share this post


Link to post
Share on other sites
Advertisement
The error message pretty much means what it says on the tin.. could you post one of these headers?

Share this post


Link to post
Share on other sites
It usually happens when you forget a closing brace, '}'

But yeah, you'll have to post some code for us to really know what's going on...

Share this post


Link to post
Share on other sites
I found that solution on other forums, BUT:
I loaded exactly the same project with 2008 that worked perfectly with VC++6.0.
No change at all. (I didn't do anything with the files).
BTW is there way to find that possible '}'? The code is at least 10000 lines of code. (It's the demo in my signature)

Share this post


Link to post
Share on other sites
Quote:
Original post by szecs
I found that solution on other forums, BUT:
I loaded exactly the same project with 2008 that worked perfectly with VC++6.0.
No change at all. (I didn't do anything with the files).


VC 2008 (indeed anything past VC 6) is stricter on standards (this is a good thing), so you needn't have changed a file for this to start happening.

Quote:
BTW is there way to find that possible '}'? The code is at least 10000 lines of code. (It's the demo in my signature)


Look at where the error is occuring, and work upwards.

Share this post


Link to post
Share on other sites
83 errors so far, probably all of my functions, defined in headers.
I commented out the headers one by one.
Is there a feature in VS 2008 to find the matching '{' '}' ?

Do I have to declare all of them at the beginning of the main file in VS 2008?
Meaning:
void Function();
....
all stuff..
..
void Function()
{...
}
(I don't even know the proper terms)
I know it's the way to do it, but I was lazy, and it worked so far...

Share this post


Link to post
Share on other sites
They're called function prototypes, and you would be getting a different error message if that was the case.

You can match a given brace by putting your caret beside it, and pressing CTRL+}.

You could also try pressing CTRL+M, CTRL+L to toggle all folds.. you might be able to better see how the functions are being parsed then.

Share this post


Link to post
Share on other sites
Take the first error, and post the exact error message and the code around where the error occurs so we can see. We're just guessing if you don't post code :)

Share this post


Link to post
Share on other sites
Just as an aside, I just tried missing a '}' and got:


1>blah.cpp(17) : error C2601: 'fn' : local function definitions are illegal
1> blah.cpp(9): this line contains a '{' which has not yet been matched


So before you go off on a wild goose chase for a missing }, consider the fact that you're not getting that extra line (I hope..) and that you haven't changed any files. It's more likely to be something else instead.

Share this post


Link to post
Share on other sites
Yes I got that message, but there wasn't any '{' there. I re-saved the file that it worked.

Now I get 777 warnings.

Thanks for your efforts guys!

Share this post


Link to post
Share on other sites
Quote:
Original post by szecs
Ok solved, now I get 777 warnings.

Welcome to a proper C++ compiler ;)
Quote:
I didn't do anything. I works anyway.

Hmm? Did it magically start working or something? :)
Ahh, ok.

Share this post


Link to post
Share on other sites
Ok no 777 warnings: double float conversion thing #pragmated out!

So I was a noob again!

But: the .exe is now 521 Mb instead of 380 Mb

Thanks anyway!

Share this post


Link to post
Share on other sites
Are you sure that you are not comparing a Debug build (in VS 2008) with a release build (in VS 6)? That would explain the massive file size difference.

Share this post


Link to post
Share on other sites
OK, I don't know how to build as release.
Error 12 error LNK2019: unresolved external symbol __imp__glEndList@0 referenced in function "void __cdecl Build2Dlists(void)" (?Build2Dlists@@YAXXZ) tankos.obj tankos
78 times.
Anyway, if the debug isn't slower than the release .exe, then I don't care. I do it for hobby.

And I'm a noob, as I mentioned a few times already in this forum. 521 kB of course.

Thanks anyway!

Share this post


Link to post
Share on other sites
Quote:
Original post by szecs
Anyway, if the debug isn't slower than the release .exe, then I don't care. I do it for hobby.

1. Debug will probably be slower than release.
2. You can't really distribute debug builds to other people.
3. For the linking errors (are the errors for release, debug, or both?) you probably need to set up the project again for the release build. Settings generally only effect one build when you change them. So you need to reference libraries again in the release build configuration.

Hope this helps.

Share this post


Link to post
Share on other sites
Er..
Happens with release only.
How to link/reference those libraries?

OK maybe I should figure out myself.
Thanks anyway!

Share this post


Link to post
Share on other sites
OK this one fucks me up.

Add New Reference?
This is where I have to put the libraries names?
But I have no idea of their paths, Windows can't find those files, but it works in debug build. Why the hell it is different in release build?

I mean it was so easy in VC++6.0
I added: opengl32.lib glu32.lib glut32.lib modules in project/settings and Voila!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement