Strange entry point not found error

closed account (Ez1h0pDG)
Please help me with my simple application here. I have tried three versions of mingw64's g++ and each has compiled the code fine into app.exe but gives each one when executed consistently gave this error:

app.exe - Entry Point Not Found
The procedure entry point
_ZNSt7__cxx1112basic_stringlcSt11char_traitslcESalcEEC1EPKcRKS3_
could not be located in the dynamic link library
C:\cpp\HelloObject\app.exe.

Here is the code for my application.

tree.h:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#ifndef TREE_H
#define TREE_H
#include <string>

class Tree
{
    std::string species;
    int age;

  public:
    void setAge(int);
    void setSpecies(std::string);
    int getAge(void);
    std::string getSpecies(void);
};
#endif 


tree.cpp:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "tree.h"

void Tree::setAge(int provided)
{
  age = provided;
}

void Tree::setSpecies(std::string provided)
{
  species = provided;
}

int Tree::getAge(void)
{
  return age;
}

std::string Tree::getSpecies(void)
{
  return species;
}


main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "tree.h"
#include <iostream>

int main()
{
  int option(0);
  Tree yardtree;
  yardtree.setSpecies("Maple");
  yardtree.setAge(25);
  std::cout << "What would you like to know?" << std::endl;
  std::cout << "(1) The species of my tree" << std::endl;
  std::cout << "(2) The age of my tree" << std::endl;
  std::cout << "Your selection: ";
  std::cin >> option;
  if ( option == 1 )
    std::cout << "The species is " << yardtree.getSpecies() << std::endl;
  else if ( option == 2 )
    std::cout << "The age is " << yardtree.getAge() << std::endl;
  else return 1;
  return 0;
}


In case you are wondering here are the commands I used in the command prompt:
g++ -c main.cpp tree.cpp
g++ -o app.exe main.o tree.o
app.exe
Last edited on
It looks like you are building your application as a dynamic link library rather than a binary executable. How are you compiling and linking your project?
closed account (Ez1h0pDG)
I'm just using a simple text editor, Atom, and I am using mingw64's g++. Have I skipped a step entirely? :(
try this:

rm app.exe *.o && g++ main.cpp tree.cpp -o app && ./app
Topic archived. No new replies allowed.