Greetings
I'm very new to C. I would like to know the most minimal amount of steps/code for making a basic window using raylib. I'm using Linux and have followed the steps on github https://github.com/raysan5/raylib/wiki/Working-on-GNU-Linux, but I honestly don't know where to begin to build my own project. Is cmake or make required for a basic window like in the example: core_basic_window.c, that I'm able to compile (using the instructions from github, but I'm not sure how to modify/simply the code for my own project). Thank you : )
I've tried to copy and past this code from the github pull/project/directory and run gcc on it but I get error messages:
// Filename: core_basic_window.c
#include "raylib.h"
int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
const int screenWidth = 800;
const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window");
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
// TODO: Update your variables here
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}
Couldn't compile:
########-ThinkPad-T430:~/Documents/c/bin/tmp$ gcc core_basic_window.c
/usr/bin/ld: /tmp/ccB5BYug.o: in function `main':
blah.c:(.text+0x2d): undefined reference to `InitWindow'
/usr/bin/ld: blah.c:(.text+0x37): undefined reference to `SetTargetFPS'
/usr/bin/ld: blah.c:(.text+0x3e): undefined reference to `BeginDrawing'
/usr/bin/ld: blah.c:(.text+0x65): undefined reference to `ClearBackground'
/usr/bin/ld: blah.c:(.text+0xa6): undefined reference to `DrawText'
/usr/bin/ld: blah.c:(.text+0xab): undefined reference to `EndDrawing'
/usr/bin/ld: blah.c:(.text+0xb0): undefined reference to `WindowShouldClose'
/usr/bin/ld: blah.c:(.text+0xbc): undefined reference to `CloseWindow'
collect2: error: ld returned 1 exit status
You didn't like your libraries right. If you are using the Notepad++ option then:
Create a Folder, and create a main.cpp/.c file. ->
Navigate to the Raylib download folder, extracted of course, and click npp->then click notepad++.exe
In notepad++ click file->Open (or Ctrl-O) then navigate to the folder you created for your project-> Write code then click F6 to run. That should be simple to follow instructions.
Compiler Flags (for GCC)
echo > Setup required Environment
echo -------------------------------------
SET RAYLIB_PATH=C:\raylib\raylib
SET COMPILER_PATH=C:\raylib\w64devkit\bin
ENV_SET PATH=$(COMPILER_PATH)
SET CC=gcc
SET CFLAGS=$(RAYLIB_PATH)\src\raylib.rc.data -s -static -Os -std=c99 -Wall -I$(RAYLIB_PATH)\src -Iexternal -DPLATFORM_DESKTOP
SET LDFLAGS=-lraylib -lopengl32 -lgdi32 -lwinmm
cd $(CURRENT_DIRECTORY)
echo
echo > Clean latest build
echo ------------------------
cmd /c IF EXIST $(NAME_PART).exe del /F $(NAME_PART).exe
echo
echo > Saving Current File
echo -------------------------
npp_save
echo
echo > Compile program
echo -----------------------
$(CC) -o $(NAME_PART).exe $(FILE_NAME) $(CFLAGS) $(LDFLAGS)
echo
echo > Reset Environment
echo --------------------------
ENV_UNSET PATH
echo
echo > Execute program
echo -----------------------
cmd /c IF EXIST $(NAME_PART).exe $(NAME_PART).exe
If you put this into a main.bat file or something it should give you a raylib runtime.
I am trying to read 2 integers from a file and write their sum to another file. On running the following code in release mode (Visual Studio 2017 Community)
// Kickstart.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include<iostream>
#include<fstream>
#include<string>
int main()
{
using namespace std;
string inpath = "E:\\Pratik\\Kickstart\\Inputs\\Sum.txt";
string outpath = "E:\\Pratik\\Kickstart\\Outputs\\Sum.txt";
ifstream fin;
ofstream fout;
fin.open(inpath);
fout.open(outpath);
if (!fin)
{
cerr << "Unable to open input file";
exit(1);
}
if (!fout)
{
cerr << "Unable to open output file";
exit(1);
}
int sum = 0;
int a, b;
fin >> a >> b;
cout << "a: " << a << "b: " << b << endl; //Line in question
fout << a + b;
fin.close();
fout.close();
system("pause");
return 0;
}
I get this error on running it in Release mode (x64, Local Windows Debugger)
1>------ Build started: Project: Kickstart, Configuration: Release x64 ------
1>Kickstart.cpp
1>Generating code
1>LINK : fatal error C1001: An internal error has occurred in the compiler.
1>(compiler file 'f:\dd\vctools\compiler\utc\src\p2\main.c', line 258)
1> To work around this problem, try simplifying or changing the program near the locations listed above.
1>Please choose the Technical Support command on the Visual C++
1> Help menu, or open the Technical Support help file for more information
1> link!InvokeCompilerPass()+0x1f1b9
1> link!InvokeCompilerPass()+0x1f1b9
1> link!InvokeCompilerPass()+0x1ebd3
1> link!DllGetC2Telemetry()+0x10769b
1>
1>LINK : fatal error C1001: An internal error has occurred in the compiler.
1>(compiler file 'f:\dd\vctools\compiler\utc\src\p2\main.c', line 258)
1> To work around this problem, try simplifying or changing the program near the locations listed above.
1>Please choose the Technical Support command on the Visual C++
1> Help menu, or open the Technical Support help file for more information
1> link!InvokeCompilerPass()+0x1f1b9
1> link!InvokeCompilerPass()+0x1ebd3
1> link!DllGetC2Telemetry()+0x10769b
1>
1>
1>LINK : fatal error LNK1000: Internal error during IMAGE::BuildImage
1>
1> Version 14.12.25831.0
1>
1> ExceptionCode = C0000005
1> ExceptionFlags = 00000000
1> ExceptionAddress = 063636E6 (05F30000) "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\bin\HostX86\x64\c2.dll"
1> NumberParameters = 00000002
1> ExceptionInformation[ 0] = 00000000
1> ExceptionInformation[ 1] = 0FA6D358
1>
1>CONTEXT:
1> Eax = 0FA6D358 Esp = 008FE9E8
1> Ebx = 05A500EC Ebp = 008FEA18
1> Ecx = 00000005 Esi = 0FA6D358
1> Edx = 08C8C02C Edi = 008FE9F8
1> Eip = 063636E6 EFlags = 00010202
1> SegCs = 00000023 SegDs = 0000002B
1> SegSs = 0000002B SegEs = 0000002B
1> SegFs = 00000053 SegGs = 0000002B
1> Dr0 = 00000000 Dr3 = 00000000
1> Dr1 = 00000000 Dr6 = 00000000
1> Dr2 = 00000000 Dr7 = 00000000
1>Done building project "Kickstart.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
On tinkering with the code, I discovered that commenting out the cout line (has a "Line in question" comment) makes the code run properly. My initial suspicion was that since the 2 variables are written to stdout stream, they cannot be written to ofstream. However, when I comment out the "fout"<<"a"<<"b" line (next to "Line in question"), I get the same error. This means the variables just refuse to be loaded in stdout stream (Am I right?). I am not able to figure out why is this happening. A google search for "writing variables to multiple streams in C++" was not helpful either.
Now, when I select Debug mode in Visual Studio and apply a breakpoint (at string inpath declaration and assignment) and step through the code (no code is commented. The code given above is stepped through as it is), it runs successfully. It prints the values of a and b on stdout (console screen) and the sum is also written in the output file.
So there are 2 things happening here:
1 - In Release mode, the variables can be written only to ofstream but not on console screen.
2 - In Debug mode, the code behaves exactly the way I want.
Note - The content in my input file is 2 numbers (5 and 9) separated by a space. I am running Visual Studio 2017 community on Windows 10
Can someone please explain what exactly is happening here? Thanks!
I have the following code which causes an error in the context of a larger codebase:
struct Quadruple
{
double _sum;
double _corr;
// Fast multiply by -1, 0 or +1 (doesn't need extended precision operations).
__device__ inline Quadruple& MulSign(const int8_t sign);
};
// ...
__device__ inline Quadruple& Quadruple::MulSign(const int8_t sign)
{
__assume(-1 <= sign && sign <= 1); // enable more optimization premises
_sum *= sign;
_corr *= sign;
return *this;
}
// ...
int8_t y = /* ... read from memory ... */;
Quadruple a = /* ... computed here ... */;
Quadruple b = Quadruple(a).MulSign(y);
When compiling the code with CUDA 8RC + MSVC++2013 I get the following error:
1> Compiling CUDA source file Example.gpu.cu...
1>
1> D:\ExDir>"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin\nvcc.exe" -gencode=arch=compute_20,code=\"sm_21,compute_20\" --use-local-env --cl-version 2013 -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\x86_amd64" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\include" --keep-dir x64\Release -maxrregcount=0 --machine 64 --compile -cudart static -D_DENSE_REP -DWIN32 -DWIN64 -DNDEBUG -D_CONSOLE -D_MBCS -Xcompiler "/EHsc /W4 /nologo /Ox /Zi /MD " -o x64\Release\Example.gpu.cu.obj "D:\ExDir\Example.gpu.cu"
1>ptxas C : /Users/ExUser/AppData/Local/Temp/tmpxft_00002ffc_00000000-4_CuSvm.gpu.ptx, line 2513; error : Call has wrong number of parameters
1> ptxas fatal : Ptx assembly aborted due to errors
1> Example.gpu.cu
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\BuildCustomizations\CUDA 8.0.targets(599,9): error MSB3721: The command ""C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin\nvcc.exe" -gencode=arch=compute_20,code=\"sm_21,compute_20\" --use-local-env --cl-version 2013 -ccbin "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\x86_amd64" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\include" --keep-dir x64\Release -maxrregcount=0 --machine 64 --compile -cudart static -D_DENSE_REP -DWIN32 -DWIN64 -DNDEBUG -D_CONSOLE -D_MBCS -Xcompiler "/EHsc /W4 /nologo /Ox /Zi /MD " -o x64\Release\Example.gpu.cu.obj "D:\ExDir\Example.gpu.cu"" exited with code 255.
After commenting out __assume(-1 <= sign && sign <= 1);, the code compiles ok.
Is it a bug in NVCC, or is MSVC++'s __assume just not supported by NVCC, or am I doing something wrong? Is there a workaround (keeping __assume or an equivalent, of course)?
__assume() is a Microsoft (and subsequently Intel icc) compiler intrinsic. It isn't part of the C++ language and it isn't supported in CUDA (or in GCC or Clang for that matter).
I'm looking for the clojure-way of building a live streaming server. The particular problem I'm struggling with is how to send the values from a single provider (the webcam) to an undefined number of threads (the connected clients). Obviously when a client connects it's not interested in the full video file from the webcam, basically it needs to be sent a header and then whatever packages are arriving from the webcam at that exact moment.
In straight java, I think it would be easy. Whenever a client connects, add the connection to an array, when it disconnects remove the connection from the array, and whenever a new package from the webcam arrives send it to each entry in the array. Lock the array so that either we're adding/removing entries, or looping through it to send packets to. Of course we could build the same in clojure, but this sounds really evil.
In a message passing multi-threaded architecture this sounds equally easy.
The only solution I could think of in clojure is with a lazy sequence of promises. Indeed it works, but I was wondering whether there is another way that leads to cleaner code and more clojure-zen :)
Just to illustrate: a simplified problem, with promises and atoms:
One provider function generating data, one thread that reads this data. Later some other threads are created that would like to get the data from this first thread, but can't get to it.
(defn provider []
(lazy-seq
(do
(Thread/sleep 100)
(cons (rand) (provider)))))
(def printer (agent nil))
(defn log [& line]
(send-off printer (fn [x] (apply println line))))
(def promises (atom (repeatedly promise)))
(defn client-connected-thread [x input]
(log "Client connection " x " is connected with the provider and just received" #(first input))
(recur x (rest input)))
(.start (Thread. (fn []
(loop [stream (provider)]
(when-let [item (first stream)]
(log "I received " item", will share now")
(deliver (first #promises) item)
(swap! promises rest))
(recur (rest stream))))))
(Thread/sleep 300)
(.start (Thread. #(client-connected-thread 1 #promises)))
(Thread/sleep 100)
(.start (Thread. #(client-connected-thread 2 #promises)))
(Thread/sleep 50)
(.start (Thread. #(client-connected-thread 3 #promises)))
So, basically the question is: is this the right way to tackle this problem?
Also, we're talking about a streaming media server here, so the provider function will provide tens of thousands of items per second, and there may be 10 clients connected. Is the promise-system meant for such heavy use?
Clojure has agents for situations where you need to send information asynchronously which seems like a good match for your use case.
you are very close indeed, just stuck the work agents in a couple spots to finish the though.
"In straight Clojure, I think it would be easy. Whenever a client connects, add the connection to an vector of agents in an agent, when it disconnects remove the connection from the agent of agents, and whenever a new package from the webcam arrives send it to each agent in the agent."
make sure you use send-off instead of send to keep from emptying your thread pool.
This has a bunch of advantages over the "lock an array" approach:
one slow client wont stop you from adding or removing or adding connections
clients will eventually get all the frames with out having to track each separately
you don't have to worry about locking
you don't have to manually allocate threads
you can use watches and such to report performance with out changing the simple core of the algorithm.
a rough outline would look like:
user> (def connections-stub (range))
user> (def connections (agent []))
#'user/connections
user> (defn accept-connection [connection]
(send connections conj (agent connection)))
#'user/accept-connection
user> (map accept-connection (take 10 connections-stub))
(#<Agent#2a81df82: [#<Agent#3478e59b: 0> #<Agent#6d2a3e06: 1>]> #<Agent#2a81df82: [#<Agent#3478e59b: 0> #<Agent#6d2a3e06: 1> #<Agent#704e33e7: 2>]> #<Agent#2a81df82: [#<Agent#3478e59b: 0> #<Agent#6d2a3e06: 1> #<Agent#704e33e7: 2> #<Agent#1e31bc4b: 3>]> #<Agent#2a81df82: [#<Agent#3478e59b: 0> #<Agent#6d2a3e06: 1> #<Agent#704e33e7: 2> #<Agent#1e31bc4b: 3> #<Agent#5340ef69: 4>]> #<Agent#2a81df82: [#<Agent#3478e59b: 0> #<Agent#6d2a3e06: 1> #<Agent#704e33e7: 2> #<Agent#1e31bc4b: 3> #<Agent#5340ef69: 4> #<Agent#4c260132: 5>]> #<Agent#2a81df82: [#<Agent#3478e59b: 0> #<Agent#6d2a3e06: 1> #<Agent#704e33e7: 2> #<Agent#1e31bc4b: 3> #<Agent#5340ef69: 4> #<Agent#4c260132: 5> #<Agent#5318a0ac: 6>]> #<Agent#2a81df82: [#<Agent#3478e59b: 0> #<Agent#6d2a3e06: 1> #<Agent#704e33e7: 2> #<Agent#1e31bc4b: 3> #<Agent#5340ef69: 4> #<Agent#4c260132: 5> #<Agent#5318a0ac: 6> #<Agent#75dca6d2: 7>]> #<Agent#2a81df82: [#<Agent#3478e59b: 0> #<Agent#6d2a3e06: 1> #<Agent#704e33e7: 2> #<Agent#1e31bc4b: 3> #<Agent#5340ef69: 4> #<Agent#4c260132: 5> #<Agent#5318a0ac: 6> #<Agent#75dca6d2: 7> #<Agent#694c6171: 8>]> #<Agent#2a81df82: [#<Agent#3478e59b: 0> #<Agent#6d2a3e06: 1> #<Agent#704e33e7: 2> #<Agent#1e31bc4b: 3> #<Agent#5340ef69: 4> #<Agent#4c260132: 5> #<Agent#5318a0ac: 6> #<Agent#75dca6d2: 7> #<Agent#694c6171: 8> #<Agent#159177b9: 9>]> #<Agent#2a81df82: [#<Agent#3478e59b: 0> #<Agent#6d2a3e06: 1> #<Agent#704e33e7: 2> #<Agent#1e31bc4b: 3> #<Agent#5340ef69: 4> #<Agent#4c260132: 5> #<Agent#5318a0ac: 6> #<Agent#75dca6d2: 7> #<Agent#694c6171: 8> #<Agent#159177b9: 9>]>)
user> (defn send-frame [con-agent frame]
(send con-agent
(fn [connection frame]
(println "sending " frame " to " connection) connection) frame))
#'user/send-frame
user> (send-frame (first #connections) "hello")
sending hello to 0
#<Agent#da69a9c: 0>
user> (defn dispatch-frame [frame]
(doall (map #(send-frame % frame) #connections)))
#'user/dispatch-frame
user> (dispatch-frame "hello")
sending hello to 0
sending hello to 1
sending hello to 2
sending hello to 3
sending hello to 4
sending hello to 5
sending hello to 6
sending hello to 7
sending hello to 8
sending hello to 9
(#<Agent#da69a9c: 0> #<Agent#34f07ec4: 1> #<Agent#11ee68d1: 2> #<Agent#3b237a89: 3> #<Agent#1641d6b4: 4> #<Agent#3c76ced6: 5> #<Agent#1c05629d: 6> #<Agent#258d3fca: 7> #<Agent#5c56fa08: 8> #<Agent#52395294: 9>)
user>
Take a look at Aleph. This is a library for providing "async channels" which can help you to implement the required scenario.
I'm compiling on VC++ 2010. The following code is for a homework assignment:
#include <iostream>
#include <map>
#include "PaintJobEst.h"
using namespace std;
int main( void )
{
map< string, double > data;
double numRooms = 0, costPerGallon = 0, sqrFtWallSpace = 0;
cout << "How many rooms wil you be painting today? " << endl;
cin >> numRooms;
const bool numRoomsAtLeastOne = ( numRooms >= 1 );
if ( !numRoomsAtLeastOne )
{
cout << "INVALID ENTRY: Please enter a value greater than or equal to 1 for the amount of rooms you wish to paint" << endl;
main();
}
cout << "What is the cost of paint per gallon? " << endl;
cin >> costPerGallon;
const bool costCheck = ( costPerGallon >= 10.00 );
if ( !costCheck )
{
cout << "INVALID ENTRY: Please enter a value greater than or equal to 10.00 for the cost-per-gallon of paint you wish to use." << endl;
main();
}
cout << "What is the square feet of wallspace per gallon of paint you wish to cover? " << endl;
cin >> sqrFtWallSpace;
const bool sqrFeetCheck = ( sqrFtWallSpace >= 0 );
if ( !sqrFeetCheck )
{
cout << "INVALID ENTRY: Please enter a value which is NON-NEGATIVE for covering the square feet of wallspace per gallon" << endl;
main();
}
data.insert( pair< string, double >( "numRooms", numRooms ) );
data.insert( pair< string, double >( "costPerGallon", costPerGallon ) );
data.insert( pair< string, double >( "sqrFtWallSpace", sqrFtWallSpace ) );
Estimate( data );
system("pause");
}
Yet, when I compile it, I get flooded with strange errors which are related to how the xfunctional file. Why this is happening, I have no idea. Am I missing an include file somewhere?
Errors
>------ Build started: Project: Project17, Configuration: Debug Win32 ------
1> main.cpp
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::_Tree<_Traits> &,const std::_Tree<_Traits> &)' : could not deduce template argument for 'const std::_Tree<_Traits> &' from 'const std::string'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xtree(1885) : see declaration of 'std::operator <'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xfunctional(124) : while compiling class template member function 'bool std::less<_Ty>::operator ()(const _Ty &,const _Ty &) const'
1> with
1> [
1> _Ty=std::string
1> ]
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\map(71) : see reference to class template instantiation 'std::less<_Ty>' being compiled
1> with
1> [
1> _Ty=std::string
1> ]
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xtree(451) : see reference to class template instantiation 'std::_Tmap_traits<_Kty,_Ty,_Pr,_Alloc,_Mfl>' being compiled
1> with
1> [
1> _Kty=std::string,
1> _Ty=double,
1> _Pr=std::less<std::string>,
1> _Alloc=std::allocator<std::pair<const std::string,double>>,
1> _Mfl=false
1> ]
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xtree(520) : see reference to class template instantiation 'std::_Tree_nod<_Traits>' being compiled
1> with
1> [
1> _Traits=std::_Tmap_traits<std::string,double,std::less<std::string>,std::allocator<std::pair<const std::string,double>>,false>
1> ]
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xtree(659) : see reference to class template instantiation 'std::_Tree_val<_Traits>' being compiled
1> with
1> [
1> _Traits=std::_Tmap_traits<std::string,double,std::less<std::string>,std::allocator<std::pair<const std::string,double>>,false>
1> ]
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\map(81) : see reference to class template instantiation 'std::_Tree<_Traits>' being compiled
1> with
1> [
1> _Traits=std::_Tmap_traits<std::string,double,std::less<std::string>,std::allocator<std::pair<const std::string,double>>,false>
1> ]
1> c:\users\holland\documents\code\projects\studying\chapter6\project17\project17\main.cpp(13) : see reference to class template instantiation 'std::map<_Kty,_Ty>' being compiled
1> with
1> [
1> _Kty=std::string,
1> _Ty=double
1> ]
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::_Tree<_Traits> &,const std::_Tree<_Traits> &)' : could not deduce template argument for 'const std::_Tree<_Traits> &' from 'const std::string'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xtree(1885) : see declaration of 'std::operator <'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::_Tree<_Traits> &,const std::_Tree<_Traits> &)' : could not deduce template argument for 'const std::_Tree<_Traits> &' from 'const std::string'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xtree(1885) : see declaration of 'std::operator <'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::unique_ptr<_Ty,_Dx> &,const std::unique_ptr<_Ty2,_Dx2> &)' : could not deduce template argument for 'const std::unique_ptr<_Ty,_Dx> &' from 'const std::string'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\memory(2582) : see declaration of 'std::operator <'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::unique_ptr<_Ty,_Dx> &,const std::unique_ptr<_Ty2,_Dx2> &)' : could not deduce template argument for 'const std::unique_ptr<_Ty,_Dx> &' from 'const std::string'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\memory(2582) : see declaration of 'std::operator <'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::unique_ptr<_Ty,_Dx> &,const std::unique_ptr<_Ty2,_Dx2> &)' : could not deduce template argument for 'const std::unique_ptr<_Ty,_Dx> &' from 'const std::string'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\memory(2582) : see declaration of 'std::operator <'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::reverse_iterator<_RanIt> &,const std::reverse_iterator<_RanIt2> &)' : could not deduce template argument for 'const std::reverse_iterator<_RanIt> &' from 'const std::string'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xutility(1356) : see declaration of 'std::operator <'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::reverse_iterator<_RanIt> &,const std::reverse_iterator<_RanIt2> &)' : could not deduce template argument for 'const std::reverse_iterator<_RanIt> &' from 'const std::string'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xutility(1356) : see declaration of 'std::operator <'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::reverse_iterator<_RanIt> &,const std::reverse_iterator<_RanIt2> &)' : could not deduce template argument for 'const std::reverse_iterator<_RanIt> &' from 'const std::string'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xutility(1356) : see declaration of 'std::operator <'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::_Revranit<_RanIt,_Base> &,const std::_Revranit<_RanIt2,_Base2> &)' : could not deduce template argument for 'const std::_Revranit<_RanIt,_Base> &' from 'const std::string'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xutility(1179) : see declaration of 'std::operator <'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::_Revranit<_RanIt,_Base> &,const std::_Revranit<_RanIt2,_Base2> &)' : could not deduce template argument for 'const std::_Revranit<_RanIt,_Base> &' from 'const std::string'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xutility(1179) : see declaration of 'std::operator <'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::_Revranit<_RanIt,_Base> &,const std::_Revranit<_RanIt2,_Base2> &)' : could not deduce template argument for 'const std::_Revranit<_RanIt,_Base> &' from 'const std::string'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xutility(1179) : see declaration of 'std::operator <'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::pair<_Ty1,_Ty2> &,const std::pair<_Ty1,_Ty2> &)' : could not deduce template argument for 'const std::pair<_Ty1,_Ty2> &' from 'const std::string'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\utility(318) : see declaration of 'std::operator <'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::pair<_Ty1,_Ty2> &,const std::pair<_Ty1,_Ty2> &)' : could not deduce template argument for 'const std::pair<_Ty1,_Ty2> &' from 'const std::string'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\utility(318) : see declaration of 'std::operator <'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::pair<_Ty1,_Ty2> &,const std::pair<_Ty1,_Ty2> &)' : could not deduce template argument for 'const std::pair<_Ty1,_Ty2> &' from 'const std::string'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\utility(318) : see declaration of 'std::operator <'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2676: binary '<' : 'const std::string' does not define this operator or a conversion to a type acceptable to the predefined operator
1> PaintJobEst.cpp
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2784: 'bool std::operator <(const std::_Tree<_Traits> &,const std::_Tree<_Traits> &)' : could not deduce template argument for 'const std::_Tree<_Traits> &' from 'const std::string'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xtree(1885) : see declaration of 'std::operator <'
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xfunctional(124) : while compiling class template member function 'bool std::less<_Ty>::operator ()(const _Ty &,const _Ty &) const'
1> with
1> [
1> _Ty=std::string
1> ]
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\map(71) : see reference to class template instantiation 'std::less<_Ty>' being compiled
1> with
1> [
1> _Ty=std::string
1> ]
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xtree(451) : see reference to class template instantiation 'std::_Tmap_traits<_Kty,_Ty,_Pr,_Alloc,_Mfl>' being compiled
1> with
1> [
1> _Kty=std::string,
1> _Ty=double,
1> _Pr=std::less<std::string>,
1> _Alloc=std::allocator<std::pair<const std::string,double>>,
1> _Mfl=false
1> ]
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xtree(520) : see reference to class template instantiation 'std::_Tree_nod<_Traits>' being compiled
1> with
1> [
1> _Traits=std::_Tmap_traits<std::string,double,std::less<std::string>,std::allocator<std::pair<const std::string,double>>,false>
1> ]
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xtree(659) : see reference to class template instantiation 'std::_Tree_val<_Traits>' being compiled
1> with
1> [
1> _Traits=std::_Tmap_traits<std::string,double,std::less<std::string>,std::allocator<std::pair<const std::string,double>>,false>
1> ]
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\map(81) : see reference to class template instantiation 'std::_Tree<_Traits>' being compiled
1> with
1> [
1> _Traits=std::_Tmap_traits<std::string,double,std::less<std::string>,std::allocator<std::pair<const std::string,double>>,false>
1> ]
1> c:\users\holland\documents\code\projects\studying\chapter6\project17\project17\paintjobest.cpp(9) : see reference to class template instantiation 'std::map<_Kty,_Ty>' being compiled
1> with
1> [
1> _Kty=std::string,
1> _Ty=double
1> ]
Add #include <string> and the problem goes away for me on VC++ 2010.