Linker gremlins

The root of the problem is probably a newbie screwup, but the linker on my old version of VC++ seems to act irrationally. I'm playing with Win32 in a project workspace. The header and implementations files of a class I have written have been added to the project. An object from this class is instantiated in the WinMain.cpp file. The project compiled without error, but the linker returned an unresolved-external error that seems to involve the constructor of the class based on the gibberish in the error. The header of the class is included in the WinMain file.

In desperation I finally just cut-and-pasted the entire implementation file into the WinMain file. The unresolved-external linker errors disappeared. However, some independent functions in the implementation file were now flagged as being declared twice. If the project is recognizing these functions, why can't it find the constructor in the class object file? I added some #ifndef protection around the functions drawing the errors. They still draw errors every other linker attempt. If I hit build twice, the errors disappear on the second attempt, and I can run the program. WTF? Perhaps I'm unclear on what adding a file to a project does for you. Including the implementation file instead of the header in the WinMain file does the trick also without the cut and paste.
[1380 byte] By [S. Barwick] at [2007-11-19 2:45:25]
# 1 Re: Linker gremlins
old version of VC++ seems to act irrationallyWht version?

In desperation I finally just cut-and-pasted the entire implementation file into the WinMain file. The unresolved-external linker errors disappeared.Have you included implementation file in a project Source folder? This folder contains file that are compiled.

What is the exact error message from a linker? Only unresolved external?
JohnCz at 2007-11-11 0:46:09 >
# 2 Re: Linker gremlins
"Have you included implementation file in a project Source folder? This folder contains file that are compiled.

What is the exact error message from a linker? Only unresolved external?"

The files are stored in a different folder. However, I have used the "Insert files in project" menu to add the header and implementation files to the project. In the file view pane of the project the implementation file is listed with the Main.cpp file and the header file is listed in the "Dependencies" folder. In the class view pane of the project the class in question and all its members are listed also. I assume when I build all those files are compiled. The build is recognizing independent functions in that implementation file.

The exact error is LNK2001 unresolved external symbol. The constructor is listed with some other nonsensical seemingly random characters.
S. Barwick at 2007-11-11 0:47:06 >
# 3 Re: Linker gremlins
Have you included the CPP files in Source Files folder? Adding CPP into Header Files folder, wont let it compile and compiler wont be able to find the implementation of class.
Ajay Vijay at 2007-11-11 0:48:18 >
# 4 Re: Linker gremlins
The exact error is LNK2001 unresolved external symbol. The constructor is listed with some other nonsensical seemingly random characters.
These 'nonsensical seemingly random characters' are most-likely the complete decorated name of your constructor.

Is it possible that you can post your project (excluding the debug/release folders)?
Andreas Masur at 2007-11-11 0:49:18 >
# 5 Re: Linker gremlins
"Have you included implementation file in a project Source folder? This folder contains file that are compiled.
What I meant (and Ajay Vijay clarified) you should insert implementation files in a Source folder visible in a File View tab of your workspace (or equivalent). I do not remember equivalent of this in earlier version of VS.
I think that folder structure in a workspace window started with VS 5.0 but I am not sure. VS 4.2 probably had different structure while in version 2.2 it was a workbench not workspace. That is why I have asked about version.

In addition Andreas Masur post you can also omit .ncb, .opt, and *.aps.
JohnCz at 2007-11-11 0:50:16 >
# 6 Re: Linker gremlins
What I meant (and Ajay Vijay clarified) you should insert implementation files in a Source folder visible in a File View tab of your workspace (or equivalent). I do not remember equivalent of this in earlier version of VS.
I think that folder structure in a workspace window started with VS 5.0 but I am not sure. VS 4.2 probably had different structure while in version 2.2 it was a workbench not workspace. That is why I have asked about version.

In addition Andreas Masur post you can also omit .ncb, .opt, and *.aps.

I'm using version 4.0. I believe I have done the equivalent of adding the implementation to a "source folder". When I open the workspace on my version, one window displays files to edit and another window has three tabs that allow me to select a class view, a file view, and a resource view of the project. The class in question is listed in the class view along with the Win32 functions like the procedures, and the.h and .cpp files are listed in the file view. I have some functions that take magnitudes of complex numbers that are listed in the implementation file that get flagged for being declared twice if I include the cpp file in the main.cpp file. Thus, I assume they have been compiled and added to the project. That file includes the .h file for the class and has all the implementation for the class. I don't understand how the compiler could "see" those functions and not "see" the class implementation. Sorry, I'm a little light on the proper lingo.

I'll have to work on posting the project. The internet and VC++ are on different computers. This one doesn't have VC++. Thanks for the help.
S. Barwick at 2007-11-11 0:51:18 >