|
The compiler adds the underscore at the beginning of function names in object files.
|
|
|
|
|
Some things that might have gone wrong:
1. You did not link the object file containing the implementation to your program.
Check your build options to make sure it's there.
2. The declaration in your header does not match your implementation.
Make sure there is no typo, the argument type and number matches, and ...
3. ... that it's compiled as C code. You mentioned a cpp file: if your compiler deducts how to compile a file by it's suffix, it may have compiled a C++ instead of a C function! In that case the linker won't find it. You could check your compiler's documentation for an option to force compilation as C. Alternately, just to find out you're on the right track, try removing 'extern "C"' in your header to find out whether that's actually the cause.
P.S.: Here's a good site pointing out all the details you need to watch out for when mixing C++ and C:
How to mix C and C++[^]
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)
|
|
|
|
|
"2. The declaration in your header does not match your implementation.
Make sure there is no typo, the argument type and number matches, and ..."
That was the problem. Thank you all of you !
|
|
|
|
|
What could be the cause where a pdb files is not generated ? It is a warning generated by a VS2008 compiler used in command line mode ... Why others .pdb files is generated and this one (utils.pdb) are not ?
warning LNK4099: PDB 'utils.pdb' was not found with '.\..\..\retail\some.lib' or at 'D:\.....\retail\utils.pdb'; linking object as if no debug info
How can I understand this message ?
modified 27-Aug-19 4:24am.
|
|
|
|
|
You should look at your project settings, and build logs. You appear to have a somewhat complex directory setup and it is possible the PDB file could not be written for some reason.
|
|
|
|
|
The warning from above I had taken from build logs, but I don't know where I could find the project settings, I use compiler in command line mode ... I don't have any GUI for this environment ... hmm ..
|
|
|
|
|
Sorry, but we have no idea what your setup looks like so it is impossible to guess how things have been set up. If you use the Visual Studio IDE then project settings will be in a file called <project_name>.vcxproj or some similar extension. You need to provide some more details of how your project is setup and what commands you run to build it.
See also: Linker Tools Warning LNK4099 | Microsoft Docs[^].
|
|
|
|
|
#include <stdio.h>
#include <stdlib.h>
int main() {
int a,b,i,c;
b=0;
scanf("%d",&a);
i=a;
while(i<0){
i=a;
b=0;
b=b*10+i%2;
printf("%d",b);
c=i%2;
switch(c){
case '0':
i=i/2;
case '1':
i=(i-1)/2;
}
}
printf("%d",b);
return 0;
}
|
|
|
|
|
You have already posted this homework in QA:
Convert decimal number to binary[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Okay so my laptop has about 2.5 years of accumulated debris on it: VS2008, VS2015, VS Code (gone now). I have a project that contains multiple activeX controls for Windows Embedded Compact 7. I need to modify these for an update I need to get out. Go to control A - view resources - it expands to show me: Bitmap, Dialog, Icon, ... etc. Go to control B - view resources - burps with the error:
"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\ce\atlmfc\incdue\winres.h(33)
fatal error RC1015: cannot open include file 'winresrc.h"
Now here's the weird part - they compile fine. So VS2008 can find it when it wants too.
If I compare the two project files, I can see no differences (other than the filenames). I do have the files it is looking for, so it isn't that. In a fit of inspiration, I fired up a Windows 10 VM I have that is "newer" than the base iron. VS2008 running from there opens the resource views fine - same project files accessed over a shared folder.
I'm at a complete loss. Any ideas? Most of my google fu points me to defunct microsoft forums, but most of the hits have to do with compile time issues.
Charlie Gilley
<italic>Stuck in a dysfunctional matrix from which I must escape...
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|
|
Take a look at Project Properties -> General -> Windows SDK Version. It may be that your project needs to be re-targeted to a specific version as shown in the drop down in the right pane (yes Microsoft, a right pain).
|
|
|
|
|
Either I'm blind or it's not there. Perhaps because the project targets a smart device?
Hmm, created a dummy mfc desktop app, I don't see it there either...
Charlie Gilley
<italic>Stuck in a dysfunctional matrix from which I must escape...
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|
|
Yes, it was a shot in the dark but has worked for me.
|
|
|
|
|
Likely you have you include directories fixed to a specific directory
Property Pages -> VC++ Directories -> Include Directories
Set it back to Inherit from parent or project defaults
In vino veritas
|
|
|
|
|
I checked this, I'll dig a little more. I'm not sure why I would need to change that when the project compiles fine. Wondering if there isn't some registry setting somewhere (grasping in the dark).
This is just getting weirder. Now my VM cannot expand the project resource tree.
Charlie Gilley
<italic>Stuck in a dysfunctional matrix from which I must escape...
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|
|
Delete all the project files and do a create project from existing source .. usually faster once the problem goes to far.
In vino veritas
|
|
|
|
|
charlieg wrote: "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\ce\atlmfc\incdue\winres.h(33) Are you absolutely sure that you have a folder named incdue?
Ouyay ouldshay ytray angingchay atthay otay includeway
Best Wishes,
-David Delaune, Oink
|
|
|
|
|
propeller head you are I could not cut and paste it, just a typo on my part.
Tomorrow it's supposed to rain here, I'll keep digging.
Charlie Gilley
<italic>Stuck in a dysfunctional matrix from which I must escape...
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|
|
charlieg wrote: I could not cut and paste it, just a typo on my part.
Do you mean the Ctrl+C / Ctrl+V doesn't work in your environment? 
|
|
|
|
|
Many of the error dialogs that Microsoft will post do not allow you to cut/paste the text...
Charlie Gilley
<italic>Stuck in a dysfunctional matrix from which I must escape...
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|
|
So true, so annoying, and quite how they do it is a mystery.
|
|
|
|
|
I'll just throw this out there from my own experience.
You might try creating a 'test' user profile to see if it fixes it.
I had a problem with VS2005 a couple of years ago that I could not figure out.
I looked and looked and even tried reinstalling VS and couldn't fix it.
I have two user profiles on my system and just by chance I logged onto my admin
profile and opened VS and the problem was not there.
So I created a new user profile that corrected the problem.
Have no idea why.
|
|
|
|
|
A good idea, sadly it did not work...
i'll keep digging.
Charlie Gilley
<italic>Stuck in a dysfunctional matrix from which I must escape...
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|
|
winresrc.h??
Quote: The final clue came when I looked at the file trying to include winresrc.h and saw that the include was enclosed in ...
The Master said, 'Am I indeed possessed of knowledge? I am not knowing. But if a mean person, who appears quite empty-like, ask anything of me, I set it forth from one end to the other, and exhaust it.'
― Confucian Analects
|
|
|
|
|
I'll double check that - found that post, but did not apply - could be my error.
Charlie Gilley
<italic>Stuck in a dysfunctional matrix from which I must escape...
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|