Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7852949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:32:44+00:00 2026-06-02T19:32:44+00:00

I am working on a school project in C++ and am using our schools

  • 0

I am working on a school project in C++ and am using our schools unix server to write it as instructed by the professor. I am using vim and g++ to compile.

This project is built off another project, Lab0 which I had no trouble getting to build after some help from the TA, but had to do some weird stuff to get it to build (#include LinkedSortedList.cpp file at the bottom of LinkedSortedList.h). Everyone in the class did this weird stuff with #include .cpp file.

First, here are the files and what #includes they have for Lab0 which is compiling fine:

(The post is not showing my tabs in my makefile but they’re there!)

makefile:

main: *.cpp *.h

g++ -o LSL main.cpp

clean:

rm -f *.o LSL*

Lab0 (The one that builds), is like this:

Files:

main.cpp (NOT Templated):

#include "LinkedSortedList.h"
#include <iostream>
using namespace std;

SortedList.h (Templated):
Nothing

LinkedNode.h (Templated):

#include <iostream>
using namespace std;

LinkedSortedList.h (Templated):

#include "SortedList.h"
#include "LinkedNode.h"
#include <iostream>
using namespace std;

#include "LinkedSortedList.cpp" // At the bottom fo this file above the #endif to get the program to compile from what the TA told me to do for lab0 due to the templated class.

LinkedSortedList.cpp (Templated):
Nothing

No problems building and running this project.

Here is my issue:

Below is lab1, the one I am having trouble with and Lab1 uses all the files from Lab0 just adds Employee.h and Employee.cpp.

Lab1 (The one that won’t build) is like this:

Files:

lab1.cpp:

#include <iomanip>
#include <iostream>
#include <string>
#include <fstream>
#include <sstream>
#include <stdexcept>
#include "Employee.h"
#include "LinkedSortedList.h"

SortedList.h (Templated):
Nothing

LinkedNode.h (Templated):

#include <iostream>
using namespace std;

LinkedSortedList.h (Templated):

#include "SortedList.h"
#include "LinkedNode.h"
#include "Employee.h"
#include <iostream>
using namespace std;

#include "LinkedSortedList.cpp" // At the bottom fo this file above the #endif to get the program to compile from what the TA told me to do for lab0 due to the templated class.

LinkedSortedList.cpp (Templated):
Nothing

Employee.h (NOT templated):

#include <iostream>
#include <sstream>
using namespace std;

Employee.cpp (NOT templated):

#include <stdio.h>
#include <string.h>

(The post is not showing my tabs in my makefile but they’re there!)

makefile:

main: *.cpp *.h

g++ -o LSL lab1.cpp

clean:

rm -f *.o LSL*

Errors I get:

Here are the errors I am getting. It seems like the Employee.cpp/Employee.h files are not being seen. Any ideas??


unixserver:Lab1> make
g++ -o LSL lab1.cpp
/tmp/ccamnaqx.o: In function createRecord()':
lab1.cpp:(.text+0x3fb): undefined reference to
Employee::Employee()’
lab1.cpp:(.text+0x477): undefined reference to Employee::setLastName(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
lab1.cpp:(.text+0x4f2): undefined reference to
Employee::setFirstName(std::basic_string, std::allocator >)’
lab1.cpp:(.text+0x589): undefined reference to Employee::setId(int)'
lab1.cpp:(.text+0x5ce): undefined reference to
Employee::setSalary(int)’
lab1.cpp:(.text+0x60e): undefined reference to Employee::setDepartment(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
lab1.cpp:(.text+0x67c): undefined reference to
Employee::setPhoneNumber(std::basic_string, std::allocator >)’
lab1.cpp:(.text+0x6ea): undefined reference to Employee::setAddress(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
lab1.cpp:(.text+0x758): undefined reference to
Employee::setHireDate(std::basic_string, std::allocator >)’
lab1.cpp:(.text+0x7c6): undefined reference to `Employee::setEmailAddress(std::basic_string, std::allocator >)’
collect2: ld returned 1 exit status
make: * [main] Error 1

Any help would be greatly appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T19:32:45+00:00Added an answer on June 2, 2026 at 7:32 pm

    You have to compile Employee.cpp and link it into the executable:

    g++ -o LSL lab1.cpp Employee.cpp
    

    It could be that the same goes for LinkedSortedList.cpp (its purpose is not entirely clear to me).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

while working on a school project i ran into a problem using javascript to
im working on a simple C++ HTTP server as a school project and I
I'm working on a school project desktop application in c# using Visual Studio 2010
I'm currently working on a school project in Eclipse (We have just started using
I'm working on a school project using Swing and NetBeans. As a result, I
I'm recently started working on a school project using IntelliJ IDEA to develop an
I am working on a school project using Spring MVC (Spring 3.0.0). Now everything
I am currently working on a Qt project for my school. For this project
I am working on a school project where I had to write a multi-threaded
I'm working on a school project with a server application that holds centralized data,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.