0

I have the following script in C++:

#include <iostream>
#include <vector>

using namespace std;

int main() {
    vector <string> markus = { "M", "A", "R", "K", "U", "S" };
    for (int i = 0; i < markus.size();i++) {
        cout << markus[i];
     }

     return 0;
}

I have successfully installed g++. When I try compiling this code with the command g++ -o test test.cpp, I get no errors. However, when I try running the created test.exe-file, with the command test, I get an error saying "could not find starting point". First, there is a long sequence, then the following message; "The starting point for the procedure could not be found in the library for dynamical links", and the the absolute path for test.exe.

If I remove #include <vector>, and try the following code;

#include <iostream>

using namespace std;

int main() {
    cout  << "Hello world";
    return 0;
}

, it works perfect.

I would be glad for the help.

Markus
  • 182
  • 5
  • Have you tried `#include `? Not sure if it's related. – Steve Oct 10 '17 at 23:28
  • Calling your executable `test` is begging for confusion with the shell built-in `test` command. –  Oct 10 '17 at 23:31
  • @Steve, when I try it in other online compilators it seem to work without the #include -statement. Like my code in the OP. – Markus Oct 10 '17 at 23:55
  • @Neil Butterworth - that may be a dumb thing to do, yes. But the program, which had no problem running, had the same name; "test". – Markus Oct 10 '17 at 23:58
  • iostream often includes string, but one shouldn't count on it. Since you are successfully compiling, this isn't your problem. Unable to reproduce. – user4581301 Oct 11 '17 at 00:09
  • 1
    It seems somewhat unlikely that the code itself would cause this issue, so make sure, that the code is really the only difference between the two builds. If you're sure, try to narrow down what exactly causes the problem: Start with the second version and transform it step by step into the first version (e.g. include , but don't use it at first, etc.) until it breaks. – Knoep Oct 11 '17 at 00:45
  • Try to compile without using namespace std; do std::cout instead – Krassi Em Oct 11 '17 at 04:42
  • Could you add the error message as text. It may be an issue with the command line for compiling/running the app, or the compiler installation – mksteve Oct 11 '17 at 06:48
  • The first answer in this post fixed my problem; https://stackoverflow.com/questions/18668003/the-procedure-entry-point-gxx-personality-v0-could-not-be-located – Markus Oct 11 '17 at 14:40

0 Answers0