|
I fully agree with you all. Point however is that I need to find-out where my code is using it anbd even more: when I simply introduce a global variable _VERSION, I would no longer expect an "unresolved external" for _VERSION.
|
|
|
|
|
...that's partially true... did the _VERSION name have name mangling (or decoration), if so, you must match the name exactly, including the mangling (in case its actually a structure name or such)...
|
|
|
|
|
Well you do have a point there. The linker complains about a straight _VERSION. As far as I know, it would complain about something including the name mangling normally. It does however mean that - if I introduce a variable named _VERSION - that will probably be called differently internally. I have been looking into a way to remove the name mangling from a particular variable, but have not yet found anything.
|
|
|
|
|
the extern C removes name mangling... so there may be some definition that you need to wrap with that somewhere in your source... you just have to find it (on a related note, wish linkers gave better error information, lol)
|
|
|
|
|
I didn't realise from the original post that the name _VERSION was the name given by the linker, and is mangled.
The unmangled name is VERSION, so that's what we're looking for here. Also, see my other post.
|
|
|
|
|
Good point, did you try:
char* VERSION = "1.0"
Or else, if above does not work:
extern "C" char* VERSION = "1.0"
Also, before you do this you really ought to use the search in files function to find out where VERSION (without the underscore) is being used and for what.
|
|
|
|
|
William Engberts wrote: ...I need to find-out where my code is using it...
Doesn't the linker tell you this?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
Can't remember off the top of my head, but I don't think it does... remember that the linker works with the compiler output... so it doesn't necessarily have an association between an unfound object and where it was referenced in source (although it may, this is more of a linker design feature).
|
|
|
|
|
What is the exact message that the Linker produces?
The best things in life are not things.
|
|
|
|
|
This is the exact message: "error LNK2001: unresolved external symbol _VERSION"
|
|
|
|
|
This means that you have a statement of the form:
extern "C" <some type> VERSION;
and a reference to the variable VERSION somewhere in your final program. However, if this is not anywhere in your source modules it could possibly be in an associated library, so you may need to check what external libraries are being added to your program.
You could also try the /MAP and/or /VERBOSE linker options to see if you can narrow it down to the actual module where it occurs.
The best things in life are not things.
|
|
|
|
|
good tip about the linker options to play with...
|
|
|
|
|
One of the most common questions I ask myself is: "What tools can I use to help me find this bug in my code?"
The best things in life are not things.
|
|
|
|
|
Hi all,
I have made a Dialog box on which i have made a Static control. My problem is when text displayed in static control is long then it is not displayed.
I want, text to come in next line if static box length is short.
Can anybody help me in this.
Thanks in advance
|
|
|
|
|
IIRC, there's a 256 character limit, if you're loading the text from the resource file. (MSDN)[^]
have you tried setting the text from code?
|
|
|
|
|
The first thing to do is go and read the MSDN documentation for the control you are interested in; that would lead you to this page[^]. Scroll down until you reach the table entry for SS_EDITCONTROL , and you have a potential solution.
The best things in life are not things.
|
|
|
|
|
If you call Create() directly there's usually options for clipping and/or going to the next line. Usually if you have too long of a line it gets clipped automatically but it should still display something.
|
|
|
|
|
Also, make sure you actually have set the hight of the static control correctly, as there is no automatic expansion of its borders, or flow layout using HTML speak, if the text does not fit vertically.
|
|
|
|
|
Good point, this is the only way I can see that absolutely nothing would get displayed.
|
|
|
|
|
Hello group.
i have a very large c program with several hundreds of structures. is there is a tool which could detect bad structure padding.
Thanks & Regards
Prasun
|
|
|
|
|
Member 4686590 wrote: Hello group. i have a very large c program with several hundreds of
structures. is there is a tool which could detect bad structure
padding. Thanks & Regards Prasun
I think No.
Which editor are you using to code your C program? I'm using Visual Studio 2008 IDE. In that I've to select the block I want to format(by pressing SHIFT+ARROWKEY or using mouse),and then press CTRL+F to format.
|
|
|
|
|
He was not talking about indentation, but about this[^]
|
|
|
|
|
I don't know, but Lint[^] comes to mind when dealing with static code analyses. Don't know if it can handle inefficient member alignment though. There is also a code analyzer in VS2010 if you have Ultimate edition.
You might end up in trouble trying to optimize for space like this, if the order of the members is used in any way in the program. Some C (and C++) programmers tend to take shortcuts once in awhile.
Just a word of warning.
|
|
|
|
|
|
What do you mean by "bad"?
|
|
|
|