Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include path #32

Open
mottosso opened this issue May 10, 2020 · 2 comments
Open

Include path #32

mottosso opened this issue May 10, 2020 · 2 comments

Comments

@mottosso
Copy link

Hello!

I managed to get the example project in #30 running, after having fought with #31, but then ran into one more issue with the include path not seeming to be taken into account by blink.

Original Program

From #30.

#include <iostream>
#include <windows.h>

void changefunction() {
    static int n = 6;
    // n = 0;
    std::cout << n++ << std::endl;
}


int main(int argc, char** argv) {

    while (true)
    {
        changefunction();
        Sleep(1000);
    }

    return 0;

This builds fine, and changing anything in changefunction works well. But now look here.

Changed program

#include <iostream>
#include <windows.h>
#include "cannot_be_found.h"

void changefunction() {
...

The problem

There are two of them; one making the other harder to spot.

  1. blink does not report the error
  2. The error being that "cannot_be_found.h".. cannot be found

The error message is sporadic however, I suspect some issue with STDOUT and buffering. Here's what I typically see.

Detected modification to: C:\Users\marcus\source\repos\ConsoleApplication1\ConsoleApplication1.cpp
ConsoleApplication1.cpp

Finished compiling "C:\Users\marcus\source\repos\ConsoleApplication1\ConsoleApplication1.temp.obj" with code 2.

That empty space there appears related to whether or not there's an error. When compilation succeeds, the empty line is replaced with..

Successfully linked object file into executable image.

The workaround

I found that if I replicate my include path in the environment where blink is called, things appear to work.

$ set INCLUDE=all;the;things;VS;included
$ blink.exe consoleapplication1.exe
win!

Is there another way to cope with this? I couldn't find mention of this anywhere, but I don't see how blink could be used without it?

@crosire
Copy link
Owner

crosire commented May 16, 2020

See #31 (comment). Assuming this is using VC++ 2019, the include paths used to build your project won't be added to the command-line automatically, so this has to be done manually by modifying the line mentioned in the comment.
This can probably be improved by trying to extract the include paths from the PDB (if VC++ 2019 stores them there). VC++ 2017 stored the entire command-line, hence why that was not necessary before.

@mottosso
Copy link
Author

This can probably be improved by trying to extract the include paths from the PDB (if VC++ 2019 stores them there). VC++ 2017 stored the entire command-line, hence why that was not necessary before.

Aah, yes that makes sense. Thanks for confirming!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants