473,396 Members | 2,102 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Linking error in VC++ 6

sb
Hello. I have three files in a VC++6 project - a header file called
Schedule.h, an implementation class called Schedule.cpp and a test class
with main called TestSchedule1.cpp. It compiles fine in VC++ and in Unix,
but when I run it in VC++ 6, I get several linking errors (55 to be exact).
Can anyone tell me how to resolve this? Funny thing is, someone showed me
how to resolve this like a year ago and it was pretty simple, but I've
completely forgotten!! Also, in runs fine when compiling with g++.

I'm going to include how the files are laid from from a preprocessor/header
perspective as I believe that's where the problem is...

Schedule.h:
#include <iostream>
#include <string>
#include <fstream>

using namespace std;

Schedule.cpp:
#include "Schedule.h"

TestSchedule1.cpp:
#include "Schedule.cpp"

This is really frustrating and would greatly appreciate some help. Thanks in
advance!


Jul 22 '05 #1
2 1625
sb wrote:
Hello. I have three files in a VC++6 project - a header file called
Schedule.h, an implementation class called Schedule.cpp and a test class
with main called TestSchedule1.cpp. It compiles fine in VC++ and in Unix,
but when I run it in VC++ 6, I get several linking errors (55 to be exact).
Can anyone tell me how to resolve this? Funny thing is, someone showed me
how to resolve this like a year ago and it was pretty simple, but I've
completely forgotten!! Also, in runs fine when compiling with g++.

I'm going to include how the files are laid from from a preprocessor/header
perspective as I believe that's where the problem is...

Schedule.h:
#include <iostream>
#include <string>
#include <fstream>

using namespace std;

Schedule.cpp:
#include "Schedule.h"

TestSchedule1.cpp:
#include "Schedule.cpp"


You include only the *header files* and not the implementation (
read, C++ files).
Grab a good open source c++ project and look into the organization
of the source code to learn about file organization.

--
Karthik.
' Remove _nospamplz from my email to mail me. '
Jul 22 '05 #2

"sb" <vo******@hotmail.com> wrote in message
news:F_vld.761$nj.188@lakeread01...
Hello. I have three files in a VC++6 project - a header file called
Schedule.h, an implementation class called Schedule.cpp and a test class
with main called TestSchedule1.cpp. It compiles fine in VC++ and in Unix,
but when I run it in VC++ 6, I get several linking errors (55 to be
exact). Can anyone tell me how to resolve this? Funny thing is, someone
showed me how to resolve this like a year ago and it was pretty simple,
but I've completely forgotten!! Also, in runs fine when compiling with
g++.

I'm going to include how the files are laid from from a
preprocessor/header perspective as I believe that's where the problem
is...

Schedule.h:
#include <iostream>
#include <string>
#include <fstream>

using namespace std;

Schedule.cpp:
#include "Schedule.h"

TestSchedule1.cpp:
#include "Schedule.cpp"


Never #include one .cpp file in another. Somehow you have to tell VC++ to
compile both your .cpp files seperately. There is probably an 'Add file to
Project..' type menu item somewhere. Thats is what you should do instead of
#include, #include is for header files only.

It's clear from this and other issues that you don't know how to organise
your source code. This is a very important topic, but also rather a big one.
Buy a good book that discusses this.

john
Jul 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: J | last post by:
Hi everyone, I started embedding python into a 3D graphics App and I came across this linking problem. SO.lib(ScnGlobal.obj) : error LNK2001: unresolved external symbol...
5
by: hasadh | last post by:
I am building an application over QT. I loaded my files to a VC++ console application project. While trying to compile my classes, I got the following set for expcetion for all QT related classes....
1
by: yanwan | last post by:
Hello I met some problems in linking a project, and hope someone can give me some advice. -----------Configuration: lighting - Win32 Release-------------------- Linking... LINK : warning...
4
by: Gary Hughes | last post by:
Hi all, sometime I posted a problem in here where I was getting the following error from the linker in VS C++ 2003. Linking... GCClass.obj : error LNK2022: metadata operation failed (80131188)...
7
by: wmkew | last post by:
Hello everyone I'm encountering a R6002 Runtime error and several bugs when trying to generate a simple Managed C++ application with .NET 2003. The main problem seems to arise from linking with...
0
by: Rudy Ray Moore | last post by:
I've been having trouble getting incremental linking to work under Visual C++ .net 2003 7.1 for my multi-project workspace. Ronald Laeremans and Carl Daniel (and a few others) helped me figure it...
6
by: Uli | last post by:
Hello, I'm trying to use a DLL (by static linking) which was compiled with Borland C++Builder (BCB) in Visual C++ (Visual-Studio 2003). All functions are declared with the directive 'extern...
4
by: Sanjay Kumar | last post by:
Folks ! I am working with VC++ after a long time and having problem linking latest xerces 2.7 in VC++ 2005 Express Edition. I have done following: 1. downloaded and unpacked the the...
5
by: eberesche | last post by:
Hello, as a novice in ASN.1 I have me to a project in C ++ under use of ASN.1 - structures risquély. One of my colleagues means, this would deal something with masochism ;-). Result should be a DLL...
0
by: JohnIdol | last post by:
VC++6 to VC++2003 - linking troubles -------------------------------------------------------------------------------- Hi All, I successfully ported an application from VC++6 to VS2003. Solved...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.