Sign in to follow this  
protika

STL under VC++ 2008

Recommended Posts

protika    122
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.

Share this post


Link to post
Share on other sites
SiCrane    11839
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.

Share this post


Link to post
Share on other sites
protika    122
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this