-3

The problem with the problem is, I don't know where the problem exists, so I can't paste all my source codes here.

The error is a LNK error, LNK 1152 to be exact. I get 3 warnings brought with it:

error LNK1152: cannot resolve one or more undecorated symbols   
warning LNK4002: "int __clrcall main(cli::array<class System::String ^ >^)" (?main@@$$HYMHP$01AP$AAVString@System@@@Z) defined in Release\Note Reminder.obj
warning LNK4002: "int __clrcall main(int,char * * const)" (?main@@$$HYMHHQAPAD@Z) defined in Release\INIwriter.obj
warning LNK4022: cannot find unique match for symbol 'main

I have NO IDEA how to fix this error. Someone had this before, and fixed it?

Lightness Races in Orbit
  • 378,754
  • 76
  • 643
  • 1,055
Miracle
  • 11
  • 1
  • 6
  • `The problem with the problem is, I don't know where the problem exists, so I can't paste all my source codes here.` Then you haven't made any attempt at narrowing down the problem to a 10-20 line testcase as one of your first debugging steps, which is unfortunate. Plus, that isn't C++. – Lightness Races in Orbit Mar 13 '12 at 19:57
  • it seems that you have two definitions of the `main` function. One in the object file `Note Reminder.obj` and the other in the file `INIwriter.obj`. Each function with a different signature. The second one seems to be the entry point of the program. – user1192525 Mar 13 '12 at 19:57
  • From the looks of the error messages, *you* may think it's C++, but the compiler/linker think you're using C++/CLI, which is not the same thing. In this case, what the compiler thinks governs how the code will be treated. – Jerry Coffin Mar 13 '12 at 19:58

2 Answers2

2

If you don't understand why you get the error, you should start by resolving the warnings, which in this case is pretty straight forward.

warning LNK4022: cannot find unique match for symbol 'main

.. You have two main functions, remove or rename one of them. this should also resolve your linking error.

Terkel
  • 1,575
  • 8
  • 9
  • Mm, that'd be hard, because my source is pretty damn big. I can try to use the ctrl + F and search for 'main' but I did already and the only thing I found was the mainDLL. – Miracle Mar 13 '12 at 19:57
  • How did your source become "pretty damn big" without you noticing that you had conflicting function definitions? Did you not try to run it even once along the way? – Lightness Races in Orbit Mar 13 '12 at 19:58
  • Ye, but I already tried to comment ALL parts, and decomment them bit by bit.. And error stays popping up, Couldn't it be something in the project properties? – Miracle Mar 13 '12 at 20:00
  • Or where should I start searching than? – Miracle Mar 13 '12 at 20:01
  • 1
    @Miracle, You have two files `INIwriter.cpp` and `Note Reminder.cpp` which both contains a main function each. So look in those. If you can't find it then there's sadly not much more we can do to help you. – Terkel Mar 13 '12 at 20:03
2

This appears to be C++-CLI or something, not C++. You're defining main in more than one object file. You're even told which files those are.

Lightness Races in Orbit
  • 378,754
  • 76
  • 643
  • 1,055