STL under VC++ 2008
I recently started looking into the stl and I cant seem to get a project using vectors to compile under visual c++ 2008 EE. Im trying to get this to compile:
#include<stdlib.h>
#include <vector>
int main()
{
std::vector<int> ayshay;
return 0;
}
The IDE recognizes std:: giving me a drop down box. I suspect there is some library or header path I need to set in the linker options but I cant seem to figure out what it is. The error it spits out when I try to compile the above is:
error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup
fatal error LNK1120: 1 unresolved externals
I have a feeling the solution is simple but I've looked around and just cant seem to figure it out. Any help is greatly appreciated.
You created a windows project and not a console project. Either recreate your project as a console project or go to your linker settings and change the subsystem from windows to console.
Thanks for the super speedy reply SiCrane, it works like a charm now. I knew it would turn out to be a silly mistake :)
edit:
Almost like a charm unfortunately; changing the project to console lets me compile the original code but adding a
ayshay.push_back(19);
gives me:
error LNK2019: unresolved external symbol __imp___CrtDbgReportW referenced in function "public: __thiscall std::_Vector_const_iterator<int,class std::allocator<int> >::_Vector_const_iterator<int,class std::allocator<int> >(int *,class std::_Container_base_secure const *)" (??0?$_Vector_const_iterator@HV?$allocator@H@std@@@std@@QAE@PAHPBV_Container_base_secure@1@@Z)
fatal error LNK1120: 1 unresolved externals
edit:
Almost like a charm unfortunately; changing the project to console lets me compile the original code but adding a
ayshay.push_back(19);
gives me:
error LNK2019: unresolved external symbol __imp___CrtDbgReportW referenced in function "public: __thiscall std::_Vector_const_iterator<int,class std::allocator<int> >::_Vector_const_iterator<int,class std::allocator<int> >(int *,class std::_Container_base_secure const *)" (??0?$_Vector_const_iterator@HV?$allocator@H@std@@@std@@QAE@PAHPBV_Container_base_secure@1@@Z)
fatal error LNK1120: 1 unresolved externals
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement